Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have a linux virtual server hosted through GoDaddy, and our site has been running slow recently. I poked around the server a bit (I am not a sysadmin and have very limited experience with linux, mostly from C programming classes).

Here is what the free -m command gets me:

[~]# free -m 
             total       used       free     shared    buffers     cached
Mem:          2048       2048          0          0          0          0
-/+ buffers/cache:       2048          0
Swap:            0          0          0

My understanding of this command and the results is that all of the memory is being used, none of it is in buffers, which strikes me as very bad. I do notice that our mysql potion is using about 22% of the memory, but I don't want to mess with that since databases are important (not that I think it would break the database, but it would definitely make it inaccessible which is bad). I'm thinking a server restart is what is best here, but my boss is not wanting the site down for even a second, so that's out for now. What else can I do to improve the situation?

I'm not sure what information is vital and useful here, so I will update this with information if it gets requested. This is a production server, so I don't want to do anything like drop caches.

share|improve this question
5  
Stop using this "server" at once. Stop using GoDaddy. Don't use any VPS based on OpenVZ/Virtuozzo. –  Michael Hampton Aug 5 at 19:43
    
I would love to, unfortunately, that is not currently an option. –  Marshall Tigerus Aug 5 at 19:48
    
@MarshallTigerus There's always another option! –  ewwhite Aug 5 at 19:51
    
Yes, and I'm considering quitting, but until then I have to work with what the previous guy left me with. He actually went to godaddy to improve the website speed. –  Marshall Tigerus Aug 5 at 19:52
1  
The output you are getting from free looks unrealistic. If this is some sort of not-quite-virtualized system, I am guessing the kernel is not telling you the entire truth. Could you include contents of /proc/meminfo and /proc/version in your question? –  kasperd Aug 5 at 21:03

2 Answers 2

You have no memory left. You have to either optimize your processes (mysql, apache or nginx) or upgrade to the next virtual server package with more memory.

A reboot will not fix your problem as memory will go up again.

Do you have any scripts running on your website? Have you made sure they are not memory leaking from code?

Install HTOP, it's an improved version of TOP to view your resource usage:

yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
yum install htop
share|improve this answer
    
HE has plenty of memory left. It's all in buffers. –  John Aug 5 at 19:49
2  
Nope, John. This is the best answer so far. I think you need to re-read the question and think about the output from 'free' that was posted. –  Magellan Aug 5 at 21:38
    
Not only will it go up again but the OOM Killer will eventually get invoked (unless it's been disabled) and take down your production service anyway. You need to add more memory and/or carefully manage the memory usage of your application. –  HTTP500 Aug 5 at 21:51

As stated in the other answer, check htop for the top running processes. In addition, be sure to upgrade any packages with yum update

As old ones could potentially have memory leaks. Also since you said you run a website, you likely run apache. Try switching to nginx (recommend) or lighttpd. Apache is known to eat up resources so a lighter web server could help a lot.

If your web application can, try using SQLite instead of MySQL. Its much lighter. Finally, (apparently Godaddy uses OpenVZ), there is a VERY high chance your VPS is just oversold like hell and the host node is legitimately out of memory. I know you said you can't switch, but if the opportunity comes up, look for KVM or Xen. DigitalOcean is a very good KVM provider with very affordable prices. Linode uses Xen and is also great.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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