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.

My website seems to go down for up to an hour almost every day. My host says it's running out of RAM. I don't know much about servers so would appreciate advice on what to do next.

The website (3dsbuzz.com) has a Wordpress section, Wiki, Gallery and a VBulletin forum each with their own custom code and plug-ins. So there are lots of potential places which could be inefficiently coded. It runs from a cloud server with 2GB of RAM. The MySQL database is 370MB. We get around 30,000 page views per day.

What would be the best way to reduce the amount of down time? Should I upgrade my server (I can't really afford to) or is 2GB reasonable? I have plenty of errors in my error log, but they don't always occur around the same times as the server going down, so I'm not sure how relevant it is.

share|improve this question
2  
OS? Are here any cronjobs? Does it alway occur around the same time? Have you tried disabling some plug-ins? –  Bart De Vos Sep 6 '11 at 11:30
    
As you said, there are a lot of places which can affect this. Unfortunately, this website is not suitable for guiding you towards tracing these potential issues. So I'd propose you either hire a professional or lean the trade yourself. –  Holger Just Sep 6 '11 at 11:31
2  
I disagree Holger - if the OP comes back with enough information we could at least try to help –  Chopper3 Sep 6 '11 at 11:34
1  
start monitoring your server - install munin or something similar and gather some counters to see trends; consider dropping apache2 [headers from 3dsbuzz.com suggest you use it], and using nginx. this will save you some memory. if you cannot do it for the dynamic part - consider doing it just for static assets [i guess cdn is out of question due to your budget]. take a look here serverfault.com/questions/11739/lamp-server-performance-tips as well. –  pQd Sep 6 '11 at 11:34
    
If it's not always at the same time, it reduces the chances it's a cron job or regular task. If you have log analysis tools running you should see how much traffic you're getting around the time of the server going down. Does it come back up on its own? Recover on its own? Does it reboot? What errors are in the logs? You need give more information. –  Bart Silverstrim Sep 6 '11 at 11:59

3 Answers 3

2GB of RAM looks ok.

Some clues to check:

  • Database

    • Configure mysql to get slowlog - to find bottlenecks.
    • Check mysql engine.
      • If there is MyISAM - it could be problem because of whole table locks with writes (for example VBulletin could cause many writes).
      • If this is the problem - convert every table not using FULLTEXT index (or at least often changed tables) to InnoDb (or even better XtraDB from MariaDB or Percona)
  • Web serwer

    • Biggest problem could be apache with mod_php. (especially if because of mysql it top time requests beginning to lasts longer).
      • If you have this:
        • preferable switch to nginx.
        • If you cant - use fcgi php (preferable php5-fpm).

And consider hiring professional who can audit situation and help with configuration.

share|improve this answer

A few potential memory related things for server issues:

  • Apache (or your web server application) is incorrectly setup such that it may eat up a lot of memory in some cases. A common cause in Apache, for example, is setting MaxClients far too high which will result in it using up all the RAM/memory whenever there are enough concurrent users.
  • MySQL is setup to be "RAM hungry" which leaves little memory for your web server, cache, or other applications.
  • Some other application you are running is using up too much RAM. It could be a memory leak in a program/extension or just a misbehaving program configured to use too much memory.

Things you can do to check and confirm what is causing the problem (all this assumes command line access to the server):

  • Use top to see the memory usage of all programs (sort using 'M' I believe). This should give you a good start on what program(s) is using the memory. Check during "good" times to better compare to the "bad".
  • Use free -m or vmstat to check on your swap usage. Ideally you want the swap usage to be (near) zero and generally you never want Apache/MySQL to have to use swap memory as this will kill your server's performance (and may be the reason of your site outages).

There isn't much else to say without more details of the issue and your setup.

share|improve this answer

No OS mentioned. If you are using Windows with IIS you better use a dedicated pool for which you can keep restrictions like how much CPU percentage to be used.

If you want to check what is the causing this issue go to "event viewer" and check the log to find your errors.

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.