4

Situation

I have root access to a virtual private server (on Dreamhost) where I host my web sites. I am limited by RAM (currently 500 MB) so if one site (script of this site) demands too much RAM my whole VPS is shut down and restarted, taking all other sites down with it!

My average usage is about 100 MB, so nowhere near the limit, yet somehow some script still does this: asks for too much RAM and then Dreamhost's watchdog kills my VPS. It all happens in milliseconds (so they say) and I can't easily find out what's happening.

Question

How can I find out what script is causing this? Dreamhost hasn't been helpful with this and I'm not exactly the best linux hacker :).

Some more details

All my sites are hosted on Apache and they are all in PHP.

5
  • 1
    Which webserver do you use, apache? These scripts are they done in PHP? A little more information would be great.
    – Comradin
    Aug 10, 2011 at 8:35
  • You're right. Yes, it's PHP on Apache. I've added this to the question. Are there any more details that I have to provide?
    – duality_
    Aug 10, 2011 at 10:56
  • 1
    @duality_ i would also change webhoster. Probably it's not their fault, but why the hell they kill your VPS, they should simply make it run slow but not giving it the needed memory and not kill it stright away. Aug 10, 2011 at 18:54
  • Maaan, I thought it was just me thinking exactly the same thing! I've been talking to admins at least 5 times, since my sites (all of them!) were dropping on average three times per day for about half an hour each time! You can imagine my clients calling me... Maybe I should start a good question to find a better host. Any suggestions? :)
    – duality_
    Aug 10, 2011 at 20:45
  • We don't do shopping questions here; see serverfault.com/questions/292013/…
    – womble
    Aug 11, 2011 at 9:51

1 Answer 1

6

Drop the PHP memory limit to a lower value (memory_limit config var in php.ini); the script that's consuming all the memory will error out and that'll identify the problem. If the problem still happens without visible error, keep dropping the memory limit. If everything starts erroring out, you dropped it too far. If you can't find a happy medium between "everything dies" and "nothing dies", consider the possibility that it's not actually a PHP script hogging all your memory, and start looking at other possibilities (cron jobs, background processing jobs, that sort of thing).

4
  • Great suggestion! I'll try that and report back (this might take daaays).
    – duality_
    Aug 10, 2011 at 10:57
  • Yeah, it'd be a lot easier to diagnose if the provider didn't just kill your VM (that would be unacceptable behaviour in my world).
    – womble
    Aug 10, 2011 at 20:10
  • womble: where do you host your sites?
    – duality_
    Oct 28, 2011 at 12:58
  • I use Anchor Systems, but I'm biased since I work there.
    – womble
    Oct 29, 2011 at 3:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .