Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Is swap a bad thing?
PostPosted: Fri Aug 10, 2012 12:20 pm 
Offline
Junior Member

Joined: Fri Jan 02, 2009 9:11 am
Posts: 36
I am running my application on a 512 linode and due to some extra in memory processing I have just developed in the application I have noticed that it is starting to use the swap space. At the moment the application gets very little traffic so I guess using swap space is not a problem. If I was to start getting much more traffic would using swap space start to slow the application down?

In this case can I assume just upgrading to a larger linode with more memory would remove the problem? I do not cache anything in memory its just the fact that I load 1-20mb of data to process per page request.


Top
   
 Post subject: Re: Is swap a bad thing?
PostPosted: Fri Aug 10, 2012 12:34 pm 
Offline
Senior Member

Joined: Fri Feb 18, 2005 4:09 pm
Posts: 594
I had the same problem some time ago. Moving to a larger Linode worked for me.

James


Top
   
 Post subject: Re: Is swap a bad thing?
PostPosted: Mon Aug 13, 2012 11:45 am 
Offline
Junior Member
User avatar

Joined: Wed Apr 11, 2012 8:46 am
Posts: 31
Website: http://www.neomallers.com
Location: Toronto Canada
Gonna hijack this thread.. My memory usage is ~250 mb out of the 512 but it's using 62 MB swap.. is that a bad thing?


Top
   
 Post subject: Re: Is swap a bad thing?
PostPosted: Mon Aug 13, 2012 12:13 pm 
Offline
Senior Member

Joined: Tue Feb 19, 2008 10:55 am
Posts: 164
swapping out is good, swapping in is bad.

run

vmstat 1

and watch the si and so columns, if there's constant activity, you need to do something.
you should get to know what's normal and what's not, so run it often so when things do become slow or OOM, you'll know what it's meant to look like. That goes for all monitoring tools, like top, etc.

If you're using apache prefork and especially if you're using mod_php, you need to modify maxclients and possible keep-alives to make your server degrade gracefully under a high web load, otherwise with the default settings, your vps will OOM and require a reboot, whereas if you tune apache, your web sites will be very slow to load under a high web load, but your vps will be up and happy, you'll be able to log into it, etc.

I won't go into all the details, you can find guides in the library or on google.


Top
   
 Post subject: Re: Is swap a bad thing?
PostPosted: Tue Jan 01, 2013 1:09 pm 
Offline
Junior Member
User avatar

Joined: Wed Apr 11, 2012 8:46 am
Posts: 31
Website: http://www.neomallers.com
Location: Toronto Canada
Sorry for the really slow replies. Took a while to get used to these things. I shall keep tabs on that. Thanks!


Top
   
 Post subject: Re: Is swap a bad thing?
PostPosted: Tue Jan 29, 2013 2:24 am 
Offline
Newbie

Joined: Tue Jan 29, 2013 2:19 am
Posts: 3
if you use your swap space. there will be a considerable slowness in your application


Top
   
 Post subject: Re: Is swap a bad thing?
PostPosted: Wed Jan 30, 2013 9:34 pm 
Offline
Senior Member

Joined: Sat May 03, 2008 4:01 pm
Posts: 569
Website: http://www.mattnordhoff.com/
nalanda wrote:
if you use your swap space. there will be a considerable slowness in your application

As chesty said, that's only a problem if you're swapping in a lot. If you swap out a chunk of some daemon that starts on boot and then does nothing ever, it actually helps performance, since it's more useful to use the RAM for the disk cache.

_________________
Matt Nordhoff (aka Peng on IRC)


Top
   
 Post subject: Re: Is swap a bad thing?
PostPosted: Thu Jan 31, 2013 12:46 pm 
Offline
Senior Member
User avatar

Joined: Tue May 26, 2009 3:29 pm
Posts: 1691
Location: Montreal, QC
Which is why it's good to have a little bit of swap, but not much. I'd say you should have 1/4th or 1/8th of your RAM as swap, just to give you enough room to take some of that unnecessary stuff out of RAM, but not enough to cause slowdowns.


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


Who is online

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