Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Dev

Gracefull restart speed up suggestion

 

 

Apache dev RSS feed   Index | Next | Previous | View Threaded


azurit at pobox

Oct 22, 2009, 8:21 AM

Post #1 of 4 (433 views)
Permalink
Gracefull restart speed up suggestion

Hi,

we are using Apache on quite high traffic servers and needs to do gracefull restart very often. Problem is that it takes 5 to 10 seconds when Apache goes to normal state after gracefull. I would like to suggest some speed ups which could be made - maybe I'm totally wrong, I really doesn't know the inner structure of Apache.

Gracefull restart is, if I'm informed good, doing this:
1.) Apache's main process will receive gracefull restart signal.
2.) Apache's main process will send restart signal to all it's childs.
3.) Apache's main process is waiting for all childs to restart.
4.) Every child will complete it's current request and do a shutdown.
5.) Apache's main process will start to spawn new processes.

I suggest this:
1.) Apache's main process will receive gracefull restart signal.
2.) Apache's main process will send restart signal to all it's childs.
3.) Apache's main process now doesn't care about 'old' childs and will start to spawn new (with new configuration).
4.) Every 'old' child will complete it's current request and do a shutdown.

So, when 'old' childs are shutting down, Apache is fully working, spawning new processes and accepting connections. This, if it's possible, will lower time needed for gracefull restart to only few seconds. What do you think ?

azur


minfrin at sharp

Oct 22, 2009, 9:27 AM

Post #2 of 4 (413 views)
Permalink
Re: Gracefull restart speed up suggestion [In reply to]

azurIt wrote:

> So, when 'old' childs are shutting down, Apache is fully working,
> spawning new processes and accepting connections. This, if it's possible,
> will lower time needed for gracefull restart to only few seconds. What
> do you think ?

The tradeoff on this is that while the old threads/processes are busy
shutting down, and your new threads/processes are busy starting up,
you're now using twice as much RAM and other resources as you were
before. This is likely to make the problem worse, not better. :(

Regards,
Graham
--


azurit at pobox

Oct 22, 2009, 11:43 AM

Post #3 of 4 (419 views)
Permalink
Re: Gracefull restart speed up suggestion [In reply to]

>The tradeoff on this is that while the old threads/processes are busy
>shutting down, and your new threads/processes are busy starting up,
>you're now using twice as much RAM and other resources as you were
>before. This is likely to make the problem worse, not better. :(

Are you sure it will take so much resources ? Apache processes are starting/ending all the time and i can't see any problems with this. Isn't there any module, which implements this behavior so we can test it ? 10 seconds without accepting connections is just too much :(

Anyway, why processes needs to be shutdown on reload at all ? Cannot they just re-read the configuration file/s ? Thnx for explanation.

azur


minfrin at sharp

Oct 22, 2009, 3:58 PM

Post #4 of 4 (406 views)
Permalink
Re: Gracefull restart speed up suggestion [In reply to]

azurIt wrote:

> Are you sure it will take so much resources ?

Yep, if you have 100 processes in the process of shutting down, and you
start up another 100 processes before the first 100 have finished
shutting down, you've now potentially doubled your RAM footprint. If you
infrastructure is under strain already, that will probably make things
worse.

> Apache processes are starting/ending all the time and i can't see any problems with this.

Under normal circumstances, Apache processes shouldn't be
starting/ending all the time, they are designed to be long running.
Apache processes that are in the process of starting and shutting down
most of the time are crucially not serving requests, and sounds like a
symptom of a badly tuned server.

> Isn't there any module, which implements this behavior so we can test
> it ? 10 seconds without accepting connections is just too much :(

That sounds like a tuning issue to me. What is running within the httpd
processes that makes them so heavy?

> Anyway, why processes needs to be shutdown on reload at all ? Cannot
> they just re-read the configuration file/s ? Thnx for explanation.

Because of copy-on-write.

Under normal circumstances, a parent process reads the config file just
once, and then spawns threads and processes as required, each of which
inherit this common config. On condition you make no attempt to write to
this config (and httpd makes a point of doing this), the OS gets clever,
and stores just one memory resident copy of the config, all shared by
the same 100 processes.

If each process decided to reload the config as you suggest, not only
would we have 100 child processes parsing 100 configurations (instead of
1 parent process parsing 1 configuration), but 100 child processes will
store 100 separate copies of 100 configuration trees in memory, with a
memory footprint 100 times larger than we have now.

It makes a big performance difference.

Regards,
Graham
--

Apache dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.