Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Swap problem |
|
Author |
|
informatica
Joined: 10 Oct 2012 Posts: 2
|
Posted: Wed 10 Oct '12 14:58 Post subject: Swap problem |
|
|
Hi everybody, I am new here and this is my first post.
I have an important webpage with a lot of traffic (30000 uniq visitors per day) and sometimes I am having problems with my memory consumption.
I have a script that check every minute for my swap because suddenly starts to grow and grow and the problem is in apache.When the script check that I have more than 700Mb of swap I kill all apache process and the start again. Doing that I avoid a system halt.
mysite is in php and I am having this problem for 2 year and I cant detect which php is causing this.
What I have done is taking a picture of the /server-status page at that moment but I cant figure wich php is the problem.
Now I have installed also cacti to view the process and all that and I can see that I have a lot of keep alive in that moment.
Here I attach some imgs.
The question is, what can I do to debug, examine, analyse to detect my problem?
http://imageshack.us/a/img204/4427/graphimagec.png
http://imageshack.us/a/img204/3186/graphimage1.png |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Wed 10 Oct '12 16:00 Post subject: |
|
|
For me the solution was to run PHP over fcgid which separates PHP from the apache process. Also you let the fcgid php processes die after some execution time to free the memory. it works kinda like the old cgi variant, but without the loss of speed. If a single php-cgi process runs out of memory you can use kill -9. For me my systems run smoother with that solution. Also the advantage is that you can use worker or even event mpm.
For debugging your PHP code I recommend xdebug. But you can't use that on a productive server since it slows PHP down.
Well you could / should add more RAM to your server if possible that would solve the problem the easiest way |
|
Back to top |
|
informatica
Joined: 10 Oct 2012 Posts: 2
|
Posted: Wed 10 Oct '12 20:48 Post subject: |
|
|
Thanks James for your quick answer.
I do not have idea how to run fcgid but I will read about it.
Do you have an easy and great tutorial about this? |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
|
Back to top |
|
|
|
|
|
|