Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Err.. memory going crazy
PostPosted: Mon Feb 01, 2010 7:18 pm 
Offline
Senior Member

Joined: Thu Nov 19, 2009 4:55 pm
Posts: 52
Just upgraded from 360 (was swapping) to 512 and it's still gobbling up memory!

Quote:
dfischer@li93-201:~$ free -m
total used free shared buffers cached
Mem: 540 534 6 0 6 231
-/+ buffers/cache: 296 243
Swap: 255 0 255
dfischer@li93-201:~$ free -m
total used free shared buffers cached
Mem: 540 479 60 0 6 233
-/+ buffers/cache: 240 300
Swap: 255 0 255
dfischer@li93-201:~$ free -m
total used free shared buffers cached
Mem: 540 466 73 0 6 233
-/+ buffers/cache: 226 313
Swap: 255 0 255
dfischer@li93-201:~$ free -m
total used free shared buffers cached
Mem: 540 452 87 0 6 233
-/+ buffers/cache: 213 327
Swap: 255 0 255
dfischer@li93-201:~$ free -m
total used free shared buffers cached
Mem: 540 457 82 0 6 233
-/+ buffers/cache: 217 322
Swap: 255 0 255
dfischer@li93-201:~$
dfischer@li93-201:~$ free -m
total used free shared buffers cached
Mem: 540 433 106 0 6 233
-/+ buffers/cache: 193 346
Swap: 255 0 255
dfischer@li93-201:~$ free -m
total used free shared buffers cached
Mem: 540 432 108 0 6 233
-/+ buffers/cache: 192 347
Swap: 255 0 255
dfischer@li93-201:~$ free -m



That was all in the span of 10 seconds.

When I top top + shift + m

the thing at the top is mysql (8% memory) and then apache instances about 10 of them at 2-4% totaling up to about 20-30%

should I try to tweak mysql settings? it's at the default right now.


Top
   
 Post subject:
PostPosted: Mon Feb 01, 2010 7:24 pm 
Offline
Linode Staff
User avatar

Joined: Tue Apr 15, 2003 6:24 pm
Posts: 3090
Website: http://www.linode.com/
Location: Galloway, NJ
http://www.linuxatemyram.com/ !


Top
   
 Post subject:
PostPosted: Mon Feb 01, 2010 7:58 pm 
Offline
Senior Member

Joined: Thu Nov 19, 2009 4:55 pm
Posts: 52
Oh I see. I remember reading a slicehost article and I thought it was the third row for "free" on memory. i guess it's the second row. Thank you!


Top
   
 Post subject:
PostPosted: Mon May 03, 2010 9:43 pm 
Offline
Senior Member
User avatar

Joined: Tue Dec 01, 2009 10:31 pm
Posts: 57
On this topic, I can't figure out why I'd be using swap when there's plenty of free memory?

Quote:
free -m
total used free shared buffers cached
Mem: 540 464 75 0 41 276
-/+ buffers/cache: 146 393
Swap: 383 20 363


Quote:
top
top - 11:42:33 up 5 days, 2:58, 1 user, load average: 0.14, 0.16, 0.12
Tasks: 89 total, 2 running, 87 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.8%us, 0.3%sy, 0.0%ni, 98.9%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 553184k total, 476328k used, 76856k free, 43168k buffers
Swap: 393208k total, 52k used, 393156k free, 283088k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2330 mysql 15 0 77808 53m 4928 S 0 9.9 38:14.19 mysqld
22016 www-data 15 0 165m 42m 24m S 0 7.9 0:00.98 apache2
22015 www-data 15 0 156m 26m 18m S 3 4.8 0:00.70 apache2
22032 www-data 15 0 156m 25m 16m S 0 4.7 0:00.74 apache2
22031 www-data 15 0 155m 24m 17m S 0 4.6 0:00.84 apache2
22030 www-data 15 0 153m 10m 5988 S 0 2.0 0:00.17 apache2
22027 www-data 15 0 152m 9996 5164 S 0 1.8 0:00.06 apache2
22041 www-data 20 0 152m 9536 5176 S 0 1.7 0:00.03 apache2
22040 www-data 15 0 152m 9524 5132 S 0 1.7 0:00.04 apache2
2514 root 18 0 151m 8056 4812 S 0 1.5 0:10.67 apache2
2599 root 15 0 6816 4956 1544 S 0 0.9 0:00.96 munin-node
2713 root 18 0 23288 4000 1592 S 0 0.7 0:01.03 fail2ban-server



and then after reloading apache

Quote:
free -m
total used free shared buffers cached
Mem: 540 473 66 0 42 276
-/+ buffers/cache: 154 385
Swap: 383 0 383


Top
   
 Post subject:
PostPosted: Mon May 03, 2010 9:50 pm 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
Moses wrote:
On this topic, I can't figure out why I'd be using swap when there's plenty of free memory?

Quote:
free -m
total used free shared buffers cached
Mem: 540 464 75 0 41 276
-/+ buffers/cache: 146 393
Swap: 383 20 363

You're using 20Mb of swap. This is a feature of the Linux kernel to throw things out that really aren't in use. Even when you have free memory Linux can swap stuff out that really isn't in use.

My real machine at home has 4Gb RAM, currently has 182Mb in use and has swapped 200Kb. My linode 360 has 40Mb in use, but has 5Mb swapped. My Panix v-colo 360 has 43Mb in use and 4Mb swap.

It's just how Linux tries to optimise memory usage. That 20Mb of swap space used means 20Mb of extra RAM for real usage.

_________________
Rgds
Stephen
(Linux user since kernel version 0.11)


Top
   
 Post subject:
PostPosted: Mon May 03, 2010 9:56 pm 
Offline
Senior Member
User avatar

Joined: Tue Dec 01, 2009 10:31 pm
Posts: 57
Thanks for that info sweh, seems obvious when you know the answer!


Top
   
 Post subject:
PostPosted: Mon May 03, 2010 10:59 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
If you want to reduce the chance of swap being used run

sysctl -w vm.swappiness=<number between 0 and 100>

To make this persistent after a reboot use the following

echo "vm.swappiness=<number between 0 and 100>" > /etc/sysctl.d/60-swappiness.conf

The lower the number the less chance of swapping, 0 switches it off. I have it set at 30, I think the default is 50.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group