Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm renting VPS hosting where cost is based on RAM. Currently, i'm renting 4G. However, I wonder if I could reduce it to 2GB safely or even 1GB if possible.

here my output of: "free -m" when server running on t's peak. hence, No more application or corn jobs I will run:

user@mymachine:~$ free -m
             total       used       free     shared    buffers     cached
Mem:          4048       2838       1209          0         10        850
-/+ buffers/cache:       1977       2070
Swap:          255          0        255

and this output of top command:

user@mymachine:~$ top
top - 12:38:17 up  1:11,  2 users,  load average: 5.12, 3.77, 2.16
Tasks:  97 total,   1 running,  96 sleeping,   0 stopped,   0 zombie
Cpu(s): 88.6%us,  9.2%sy,  0.0%ni,  0.2%id,  0.0%wa,  0.0%hi,  1.3%si,  0.7%st
Mem:   4145552k total,  2998500k used,  1147052k free,    10408k buffers
Swap:   262140k total,        0k used,   262140k free,   890720k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 2434 ahmed     20   0 1240m 1.1g 8300 S  262 27.3  26:30.29 java
 2546 root      20   0 2433m 817m 8908 S   77 20.2  27:39.19 java
 2008 mysql     20   0  182m  47m 5912 S   59  1.2  17:09.17 mysqld
 2259 root      20   0     0    0    0 S    1  0.0   0:04.21 flush-202:0
 2405 ahmed     20   0  8536 1592  984 S    1  0.0   0:00.34 sshd
    1 root      20   0  2732 1596 1200 S    0  0.0   0:00.57 init
    2 root      20   0     0    0    0 S    0  0.0   0:00.00 kthreadd
    3 root      20   0     0    0    0 S    0  0.0   0:00.19 ksoftirqd/0
    4 root      20   0     0    0    0 S    0  0.0   0:00.00 kworker/0:0
    5 root       0 -20     0    0    0 S    0  0.0   0:00.00 kworker/0:0H
    6 root      20   0     0    0    0 S    0  0.0   0:00.05 kworker/u:0
    7 root       0 -20     0    0    0 S    0  0.0   0:00.00 kworker/u:0H
    8 root      RT   0     0    0    0 S    0  0.0   0:00.05 migration/0
    9 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/1
   10 root      20   0     0    0    0 S    0  0.0   0:00.00 kworker/1:0
   11 root       0 -20     0    0    0 S    0  0.0   0:00.00 kworker/1:0H
   12 root      20   0     0    0    0 S    0  0.0   0:00.08 ksoftirqd/1
share|improve this question

closed as not constructive by Keltari, Dave M, Nifle, BBlake, nerdwaller Jan 31 '13 at 19:51

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
If you are really using 2.8GB, you could not safely reduce it to even 3GB. –  BenjiWiebe Jan 31 '13 at 17:43
    
This depends a bit on what ahmed is doing. Is this really a regular server process or a one-off batch job that is running with PID 2434? –  Jannik Jochem Jan 31 '13 at 17:45
    
This is regular server process tat runs continually. –  user836026 Jan 31 '13 at 17:56

1 Answer 1

up vote 2 down vote accepted

If the aim is to use the lowest possible amount, you could try to reduce it to 2 GB (edit, see comment by user836026 below), while increasing swap space. Keep in mind however, that everything will become really slow, once you start using swap.

Also make sure that the java processes are set to a limit where they will not use more than the available memory (eg. -Xmx parameter for the heap space). Same applies for mysql (max connections, buffers...), easiest way to check is mysqltuner.

share|improve this answer
1  
Thanks #Martin But I can see in the buffer/cache line there 2070 free RAM, so my understanding that around 2GB is not utilized,and hence, I can claim it. –  user836026 Jan 31 '13 at 18:55
1  
Sorry, my mistake, I think you are right. It also makes sense, because the sum of the RES column is less than 2GB and swap is not used. –  Martin Jan 31 '13 at 19:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.