restarting apache

Status
Not open for further replies.

wickedDUDE

New member
Jun 25, 2006
1,054
12
0
hello.. i have a dedicated server and from time to time the site seems slow... so i restart apache and things seem to be faster...

is there any way that apache could restart automatically as soon as the site gets slow? (this way I dont have to keep checking?) or perhaps it could restart early in the morning or late at night -- automatically?

what does everyone else do about this? what should I do?
 


you can use a cronjob to restart apache every 12 hours or every 6 hours, it's up to you
the command line for a graceful apache restart is apachectl -k graceful
 
so where do I go to do this? sorry i'm very new to WHM...

And, what actually happens when apache restarts? I mean, why does this speed up the site? And what causes it to slow down? Im just interested in hearing what actually goes on from a servers perspective.

Thanks.
 
To be honest I've never dealt with WHM but I'll get to play with it tomorrow. I finally ordered a reseller's account so I'll see what the fuss is about.

That said I don't know (yet) where to run the command in WHM because I have no clue what it looks like
But what I can do is give you a brief understanding of what happens behind the scenes.
There are two ways to restart Apache. A graceful restart is the preferred method, because it won't disconnect any existing connections. Say for example a user is downloading a file and you do a hard reboot, any requests in progress are terminated. A graceful restart will keep that download running.
In general the way Apache work is by starting child processes that handle requests. The more people visit your site, the more children it starts. Each child can handle a maximum amount of connections before the parent spawns another child. When you have too many children processes running, you run out of memory.

It's hard for me to tell you why it slows down your server. You may have too many child processes running, or in other words you have too much traffic and need a faster server. Then again you might have a memory leak somewhere. Is this a dedicated box? Is it a datacenter or are you leasing it? If you lease, I would ask support to take a look at it for you while its at its peak.
 
Thanks for the explanation. I am currently on a dedicated box... hosting almost 19 sites in total. The majority of the time things are fine.. but it's just the odd time where I'll log on and notice that things are slower than usual... so I'll go into WHM and restart Apache, which makes everything run fast again. I'm just worried that I'm not catching all the 'slow' times. So it would be great if Apache just automatically restarted every 12 hours or so... did you manage to get your reseller account up and running?
 
yep. Im browsing around WHM but its still a little new to me. It's not a dedicated box so I dont get a shell account, and Im used to seeing the terminal.

I'd send them a quick email and see what they say, they should be more knowledgable than I am.
 
Status
Not open for further replies.