On 6 Juli, 00:56, Graham Dumpleton <graham.dumple...@gmail.com> wrote:
> I would though question why you are using embedded mode in the first
> place and not using daemon mode. Daemon mode would be the preferred
> way to use mod_wsgi unless you have some good reasons for using
> embedded mode. If you don't know why you are using embedded mode, then
> there is possibly no justification for you doing so and you only
> happen to be because that is historically the default.
>

I made the choice after lots of reading. (The mod_wsgi documentation
and your blog posts are excellent, thanks a lot!). I use a hand-
configured very stripped apache configuration, with the only loaded
module being mod_wsgi. I have setup the MPM settings properly etc.

It seems slightly more inefficient to have apache workers that don't
do anything, and separate WSGI-daemon processes instead of running the
Python apps in Apache directly. I see daemon process as a good fit if
you have a couple of different users/sites that uses the same Apache.
I will however run lots of completely different Apache instances
(under different users), so the number one priority is to make them as
slim as possible.

> BTW, in respect of graceful restart, you do need to be a bit careful
> when using embedded mode for other reasons. This is because Apache
> will start up new processes while allowing time for existing processes
> to shutdown. If your application uses a lot of memory, this
> potentially means you can as much as double the amount of memory in
> use during the graceful restart. If you were close to memory limits
> and this caused the box to start swapping, performance will drop and
> in worst case Apache could think it doesn't have enough processes to
> serve incoming requests and created more processes making it even
> worse. This is a mini version of the problem described for prefork
> mode in 
> 'http://blog.dscpl.com.au/2009/03/load-spikes-and-excessive-memory-usa...,
> but one which can technically also affect worker MPM, although
> obviously not to the same scale as if prefork mode were used. If you
> were close to memory limits of your box though, the affect could still
> be significant.
>
> In contrast, in daemon mode there isn't a graceful restart mode in as
> much as existing processes must exit before new ones start up. This
> was done deliberately so there wasn't a risk of spikes in memory
> usage.

The mod_wsgi-daemon-mode-way does indeed sound like a better reloading
plan than the graceful one.

The double-memory issue is annoying, however it won't be a real
problem since there will always be enough free memory to endure the
graceful restarts. I would rather use the daemon-process-way of
restarting apps though.

Would you still recommend me to use daemon mode instead of embedded
mode?

(maybe this deserve its own thread) Do the process management differ
between mod_wsgi-daemon and MPM-worker in other similar ways? Would
one be to prefer to the other in my case? I have a lot of small sites,
that does get very few requests, and some sites that gets lots of
traffic. mod_wsgi-daemon has inactivity-timeout to manage the smaller
ones, does MPM-worker do anything similar?

Andreas

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to modw...@googlegroups.com.
To unsubscribe from this group, send email to 
modwsgi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to