Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Swap Memory in Use
PostPosted: Sun May 05, 2013 2:09 am 
Offline
Junior Member

Joined: Fri Apr 26, 2013 3:58 am
Posts: 23
I have recently set up linode 1024 and hosted 2 websites in LAMP server.

Visits as per Google Analytics:-

Blog: 4000 per day.
Forum: 800 per day.

Pageviews as per Google Analytics:-

Blog: 10000 per day.
Forum: 4500 per day.

When I run, free -m:

total used free shared buffers cached
Mem: 987 724 262 0 20 209
-/+ buffers/cache: 494 493
Swap: 255 4 251

I contacted support and learned to use:

swapoff -a
swapon -a

I get swap memory free at that moment but again it is used. (often used 13 MB). Is it normal?


Top
   
 Post subject: Re: Swap Memory in Use
PostPosted: Sun May 05, 2013 2:16 am 
Offline
Senior Member

Joined: Mon Sep 12, 2011 3:29 am
Posts: 63
ICQ: 1081190
Website: http://kyhwana.org
AOL: kyhwana
Location: New Zealand
See http://linuxatemyram.com

You're only using half your RAM, the rest is being used as file system cache. (That's good).

Things will get swapped out occasionally even if you have free RAM, if the RAM manager decides some RAM isn't going to be used for a while, it will swap it out. So yes, it's normal.

It's only a problem if you're swapping a lot, since swap is slow and hits your disk as well, slowing everything else down.


Top
   
 Post subject: Re: Swap Memory in Use
PostPosted: Sun May 05, 2013 2:21 am 
Offline
Senior Member

Joined: Tue Feb 19, 2008 10:55 am
Posts: 164
i don't know why support would tell you to turn swap off and on.

it's not only normal, it is good for efficiency to have a little swapped out.
(swap out is good, swap in is bad)

what you have to watch out for is swap in, if you run free (not free -m) a handful of times during peak period and the swap used number doesn't change, you're all good.


Top
   
 Post subject: Re: Swap Memory in Use
PostPosted: Sun May 05, 2013 9:47 am 
Offline
Junior Member

Joined: Fri Apr 26, 2013 3:58 am
Posts: 23
kyhwana wrote:
You're only using half your RAM, the rest is being used as file system cache. (That's good).

Here is the output of free command. I am currently using 688MB out of 1GB Memory and 7MB out of 256MB Swap space.

total used free shared buffers cached
Mem: 1011432 688500 322932 0 22628 156628
-/+ buffers/cache: 509244 502188
Swap: 262140 7700 254440

chesty wrote:
if you run free (not free -m) a handful of times during peak period and the swap used number doesn't change, you're all good.

I checked 5 times the output of free and always got the same swap used space i.e. 7700. :D

However, I am attaching the graphs for your kind perusal. Please let me confirm that my system is optimized and configured properly. Thank you.

Image
Image
Image
Image

I could not understand why spikes are present in the graph. I have not set up any cron jobs. I am presently running a wordpress and a phpBB site.


Top
   
 Post subject: Re: Swap Memory in Use
PostPosted: Sun May 05, 2013 10:52 am 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
Is everything working OK?

If so, then everything is working OK.

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject: Re: Swap Memory in Use
PostPosted: Sun May 05, 2013 11:11 am 
Offline
Junior Member

Joined: Fri Mar 08, 2013 11:15 am
Posts: 30
Website: http://www.jasonlitka.com
A small amount of swap being used is normal as long as it's only writes and not reads. If your box never touches swap at all then you've allocated way to much RAM to the system.

_________________
Jason Litka
Utter Ramblings


Top
   
 Post subject: Re: Swap Memory in Use
PostPosted: Mon May 06, 2013 1:23 am 
Offline
Senior Member

Joined: Tue Feb 19, 2008 10:55 am
Posts: 164
the default os installs have standard hourly, daily, weekly and monthly cron jobs installed.

I'm guessing the spike around 6am is the daily cron job, possible the one that updates the package index.

it's possible to tune your system further, but you can learn over time, since your sites are purring along there's no hurry.
for mysql there's mysqltuner.pl there're also a number of different things you can do to speed up apache and php. they don't
come without risks, you might make things worse, so make one change at a time and document and measure everything, give each
change time to bed in over a few days/weeks.

or leave things as they are, since it's working fine.


Top
   
 Post subject: Re: Swap Memory in Use
PostPosted: Mon May 06, 2013 12:47 pm 
Offline
Junior Member

Joined: Fri Apr 26, 2013 3:58 am
Posts: 23
@ chesty: Thank you very much for your kind words. I would rather concentrate in my websites with peace of mind, keeping the existing settings until any problem arises in future. I feel relaxed now. :-)


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


Who is online

Users browsing this forum: No registered users and 2 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