[modwsgi] Re: Is this correct way for using mod_wsgi

2009-04-17 Thread Graham Dumpleton

2009/4/17 Johny pyt...@hope.cz:

 Graham,
 Thank you for your reply.
 I red the articles with given link but yet not sure how I should set
 mod_wsgi.
 I have this Apache settings( MPM worker)
 StartServers         2
 MaxClients         150
 MinSpareThreads     25
 MaxSpareThreads     75
 ThreadsPerChild     25
 MaxRequestsPerChild  0

 that means only max 6 processes will be allowed to be run at the same
 time. Is it so?

No. What it means is that the Apache server child processes, which are
what initially accepts requests, can handle a maximum of 150
concurrent requests. This is across however many sites you have and
also counts for static file requests which the Apache child server
processes handle or dynamic requests that get proxied through to the
daemon processes.

 Does it mean that I should not set more than 6 processes in mod_wsgi ?

No. Technically for where daemon mode processes use only a single
thread, you could have up to 150 processes if you really wanted to, as
there is enough capacity within the main Apache server child processes
to proxy that many requests at a time. You don't obviously want to use
that many processes, but technically you could.

 If I have e.g. 10 virtual servers , a total number of processes in
 mod_wsgi settings must also be only 6?

No. You need to count threads, not processes.

 If there are requests for all those 10 virtual servers what happens?
 The 4 servers will not run?

Since under normal circumstances you are unlikely to get 150
concurrent requests, which is your capacity with default worker MPM
settings, everything should work just fine. That is not going to be
the bottleneck.

I can only suggest you stop trying to prematurely optimise things. Use
the default worker MPM settings and if your application is not thread
safe, give each instance 2 or 3 processes. Unless you have a heavily
loaded site, or have an application which has lots of requests which
take a long time, because of file uploads for example, even this will
probably be more than adequate. What you may end up with I can't tell
you as it depends on your particular application. You will only know
when you have your application written and run it with realistic test
traffic to see how it performs.

Graham

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
modwsgi group.
To post to this group, send email to modwsgi@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
-~--~~~~--~~--~--~---



[modwsgi] Re: Is this correct way for using mod_wsgi

2009-04-17 Thread Johny


Graham,
Thank you the explanation.
So I am recommended to give  instance 2 or 3 processes. and set
threads =1 .
But if one virtual server has about 1500 times  more requests ( and
allows  files  uploading) than other virtual servers,  how should I
set this one server?
In the same way?
Thank you for your reply
L.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
modwsgi group.
To post to this group, send email to modwsgi@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
-~--~~~~--~~--~--~---



[modwsgi] Re: Is this correct way for using mod_wsgi

2009-04-17 Thread Graham Dumpleton

2009/4/18 Johny pyt...@hope.cz:


 Graham,
 Thank you the explanation.
 So I am recommended to give  instance 2 or 3 processes. and set
 threads =1 .

If your application is not thread safe, then it would be a reasonable
starting point. If they are low traffic sites you could probably get
away with a single process if no long requests.

 But if one virtual server has about 1500 times  more requests ( and
 allows  files  uploading) than other virtual servers,  how should I
 set this one server?
 In the same way?

For that you would preferably want to make your application thread
safe and use a multithreaded process instead. That way you can handle
more requests without blowing out memory requirements.

If you can't do that, first see how it goes with 2 or 3 processes and
only then if need be for that daemon process group for that one
instance, increase number of processes.

Overall it is really really hard for me to say what you should set it
to. It is your application and you know how it works, I don't. I can
only give generalisations and you shouldn't be taking them as gospel.
As I keep saying, you can only begin with a base configuration and
then test it with realistic traffic patterns to gauge how well it
works and then tweak configuration if need be.

Graham

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
modwsgi group.
To post to this group, send email to modwsgi@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
-~--~~~~--~~--~--~---



[modwsgi] Re: Is this correct way for using mod_wsgi

2009-04-16 Thread Graham Dumpleton

2009/4/16 Johny pyt...@hope.cz:

 I have installed   Apache/2.0.59  with MPM prefork with mod_wsgi and
 it works.

 But I wanted to installed MPM worker so I compiled and installed
 Apache/2.0.63 with MPM worker to a different directory but have not
 installed again mod_wsgi .Instead I copied  the installed mod_wsgi  to
 the modules directory that   Apache/2.0.63 with MPM worker uses.
 Is it possible?
 I am asking that because I receive Segmentation fault

 Thu Apr 16 12:36:24 2009] [notice] Apache/2.0.63 (Unix) mod_wsgi/2.3
 Python/2.3.5 configured -- resuming normal operations
 [Thu Apr 16 12:36:34 2009] [notice] child pid 17305 exit signal
 Segmentation fault (11)
 [Thu Apr 16 12:36:38 2009] [notice] child pid 17306 exit signal
 Segmentation fault (11)

 How can I repair that?

Normally the compiled mod_wsgi module should work with either prefork
or worker MPM, but technically there are some things that could stop
that. I can therefore only recommend you rebuild mod_wsgi from source
against the newer Apache for the correct MPM.

Graham

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
modwsgi group.
To post to this group, send email to modwsgi@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
-~--~~~~--~~--~--~---



[modwsgi] Re: Is this correct way for using mod_wsgi

2009-04-16 Thread Johny


Graham,
Thank you for your reply.
So I tried to rebuild the mod_wsgi but it finds the old Apache
( prefork version) 2.0.59

root@ /mod_wsgi-2.4# ./configure
checking for apxs2... no
checking for apxs... /usr/sbin/apxs
checking Apache version... 2.0.59
checking for python... /usr/bin/python
configure: creating ./config.status
config.status: creating Makefile

How can I solve that?
Thank you
L.





  I have installed   Apache/2.0.59  with MPM prefork with mod_wsgi and
  it works.

  But I wanted to installed MPM worker so I compiled and installed
  Apache/2.0.63 with MPM worker to a different directory but have not
  installed again mod_wsgi .Instead I copied  the installed mod_wsgi  to
  the modules directory that   Apache/2.0.63 with MPM worker uses.
  Is it possible?
  I am asking that because I receive Segmentation fault

  Thu Apr 16 12:36:24 2009] [notice] Apache/2.0.63 (Unix) mod_wsgi/2.3
  Python/2.3.5 configured -- resuming normal operations
  [Thu Apr 16 12:36:34 2009] [notice] child pid 17305 exit signal
  Segmentation fault (11)
  [Thu Apr 16 12:36:38 2009] [notice] child pid 17306 exit signal
  Segmentation fault (11)

  How can I repair that?

 Normally the compiled mod_wsgi module should work with either prefork
 or worker MPM, but technically there are some things that could stop
 that. I can therefore only recommend you rebuild mod_wsgi from source
 against the newer Apache for the correct MPM.

 Graham
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
modwsgi group.
To post to this group, send email to modwsgi@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
-~--~~~~--~~--~--~---



[modwsgi] Re: Is this correct way for using mod_wsgi

2009-04-16 Thread Johny

Dear Graham,
Thanks for the reply.I installed mod_wsgi with MPM worker  and it
works now.But I could not see the differences, regarding memory using,
when MPM worker is used in comparison with MPM prefork.Must I change
mod_wsgi setting anyhow? I use  daemon mode with processes=3 threads=1
Thank you for help
L.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
modwsgi group.
To post to this group, send email to modwsgi@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
-~--~~~~--~~--~--~---



[modwsgi] Re: Is this correct way for using mod_wsgi

2009-04-16 Thread Graham Dumpleton

2009/4/17 Johny pyt...@hope.cz:

 Dear Graham,
 Thanks for the reply.I installed mod_wsgi with MPM worker  and it
 works now.But I could not see the differences, regarding memory using,
 when MPM worker is used in comparison with MPM prefork.Must I change
 mod_wsgi setting anyhow? I use  daemon mode with processes=3 threads=1

If using mod_wsgi daemon mode, whether you use prefork or worker MPM
doesn't really matter. If you don't have to support use of PHP on same
web server however, you are better off using worker MPM.

For some of the issues that come up with prefork MPM, especially if
you happened to be using embedded mode, see:

  http://blog.dscpl.com.au/2009/03/load-spikes-and-excessive-memory-usage.html

Also have a read of:

  http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

This explains a bit about the different modes of mod_wsgi and the
different Apache MPMs.

Graham

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
modwsgi group.
To post to this group, send email to modwsgi@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
-~--~~~~--~~--~--~---