logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Swap problem
Author
informatica



Joined: 10 Oct 2012
Posts: 2

PostPosted: Wed 10 Oct '12 14:58    Post subject: Swap problem Reply with quote

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: 7354
Location: Germany, Next to Hamburg

PostPosted: Wed 10 Oct '12 16:00    Post subject: Reply with quote

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 Wink
Back to top
informatica



Joined: 10 Oct 2012
Posts: 2

PostPosted: Wed 10 Oct '12 20:48    Post subject: Reply with quote

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: 7354
Location: Germany, Next to Hamburg

PostPosted: Wed 10 Oct '12 22:15    Post subject: Reply with quote

I used ubuntu and before I compiled apache myself on linux I just used the system packages to run php over fcgid --> http://mariobrandt.de/archives/php/changed-to-worker-mpm-156/ Later I used the same config, but decided to compile apache myself since I wanted to use 2.4 with event mpm --> http://mariobrandt.de/archives/apache/compling-apache-2-4-on-ubuntu-or-debian-519/

If that isn't enough info please ask again.


But more RAM is always better Wink
Back to top


Reply to topic   Topic: Swap problem View previous topic :: View next topic
Post new topic   Forum Index -> Apache