1

Running linux ubuntu 14.04 on a digitalOcean server which gives me 512MB ram. Surprisingly, when trying to run activator for a play app I came to realice that almost all the memory was used. Using 'htop' command I get this output. which process should I kill (I am using 2 ssh connections, one to monitor and the other one to do stuff).

I could also assign swap memory but that would affect performance. I thought 512MB should be more than enough to run a play server. I mean, seriously, we put a man on the moon with reaaaaly much less.

Imgur

jugutier
  • 179
  • 1
  • 13
  • 1
    Looks like you are only using 79 of 490mb... Ubuntu Server 14.04 only needs 192mb of ram to operate. You have plenty of room for running a really slow web server. – JNevill Oct 16 '14 at 14:33
  • OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c5550000, 715849728, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (malloc) failed to allocate 715849728 bytes for committing reserved memory. # An error report file with more information is saved as: # /root/activator/activator-1.2.10-minimal/hs_err_pid10978.log – jugutier Oct 16 '14 at 14:39
  • So in order to run activator on your droplet you are going to need 179mb for the operating system plus 715.85mb for activator. Looks like you will need a bigger droplet. https://www.digitalocean.com/community/tutorials/how-to-resize-droplets-using-snapshots – JNevill Oct 16 '14 at 14:42
  • do you think there is another way to do that on this droplet? maybe giving activator less memory? I thought it should be 'lightway' as they say on the site.. – jugutier Oct 16 '14 at 14:53
  • 1
    Check this out, 512mb is still pretty small for what you are doing, but perhaps this might help: http://stackoverflow.com/questions/20157775/running-a-play-framework-app-in-amazon-ec2-micro-instance – JNevill Oct 16 '14 at 14:55
  • What exactly do you want to do with this server? Which "play app" do you mean? And why choose Ubuntu 14.04? EDIT: Can you post a full process list? – MrGucky2010 Oct 16 '14 at 14:31
  • I choose ubuntu because it's a distribution that I use and am familiar with. For the moment a basic template play app. The problem came in with just typing activator (once downloaded the zip). I plan to host a play server on jvm 7, perhaps a mail server, and nginx (I could live without the last 2) – jugutier Oct 16 '14 at 14:35
  • http://pastebin.com/75A37KY7 – jugutier Oct 16 '14 at 14:49

1 Answers1

2

Linux makes as much use of memory as it can, but that doesn't mean that it's not available for your applications. It will use memory to cache certain things (such as files) and memory for buffers. In your screenshot you'll see the memory usage bar is made of different coloured sections:

Green is memory in use

Blue is buffer

Yellow is cache

So generally any applications you run that require more memory will allocate it out of the memory used to cache data.

Having swap space is generally a good idea - it won't affect performance unless the kernel starts swapping heavily, but that's generally better than the alternative which is your applications will crash with an out-of-memory error.

wheelybird
  • 21
  • 1
  • using swap on this scenario would lead to heavy swapping right? I mean having 79 MB from linux and 700 from the JVM. Is that a normal memory size for a jvm? – jugutier Oct 16 '14 at 14:54
  • Well there's no normal memory size for a JVM - I suspect that the application you're trying to run has specifically configured that amount of memory (and probably with good reason - it could be a memory-hungry app). You'll see command parameters like -Xms and -Xmx passed to the JVM - they configure the 'heap', which is how much memory Java will try to allocate; the -Xms is the minimum amount of memory it needs which is what's likely test to the high value. I'm afraid that adding swap will decrease performance because to allocate that much memory the kernel will be constantly swapping. – wheelybird Oct 16 '14 at 15:07
  • I havent loaded my application per se, its just the activator command from play. I'll get a bigger droplet or use the post @jnevill suggested. Thanks!! – jugutier Oct 16 '14 at 15:17