Suresh Lakshmanan
suresh.lakshmanan at gmail.com
Wed Jan 24 04:23:41 EST 2007
Hi Graham, my libxx makes openssl calls to do some crypto stuff. only a few http requests land up on that code path. i made this test... for a url say, http://myserver/myapp/test. i put sleep in the python handler code. //python handler for the above url { import time log('before sleep') time.sleep(60) log('after sleep') } when multiple clients access the url, the calls are serialized. the second client waits for a minute and then comes to this handler. why is this so? that's why i was lead to believe that the requests were serialized. am i missing something in the config? this is httpd -l output. worker.c is compiled in Compiled in modules: core.c mod_authn_file.c mod_authn_default.c mod_authz_host.c mod_authz_groupfile.c mod_authz_user.c mod_authz_default.c mod_auth_basic.c mod_auth_digest.c mod_include.c mod_filter.c mod_deflate.c mod_log_config.c mod_env.c mod_expires.c mod_setenvif.c mod_proxy.c mod_proxy_connect.c mod_proxy_ftp.c mod_proxy_http.c mod_proxy_ajp.c mod_proxy_balancer.c mod_ssl.c worker.c http_core.c mod_mime.c mod_status.c mod_autoindex.c mod_asis.c mod_negotiation.c mod_dir.c mod_actions.c mod_userdir.c mod_alias.c mod_rewrite.c mod_so.c On 1/24/07, Graham Dumpleton <grahamd at dscpl.com.au> wrote: > > Suresh Lakshmanan wrote .. > > Hi Graham, > > I'm not very familiar with the apache MPM model. Thanks for your > references, > > im able to get an idea of how the subinterpreters work in mod_python. > > > > My python application is a django based application. It uses a few > python > > modules like > > PIL (python imaging library), dnspython, django, libxx (our c++ > extension > > written in python) > > > > Multiple requests to my django application (running inside apache with > > mod_python) are serialized and they execute one by one. > > Lot of them get 503 responses. > > > > Here's my apache conf. > > Does running: > > httpd -l > > actually show worker.c in the list of files. Ie. to confirm that worker > MPM is > actually compiled in. > > > # worker MPM > > # StartServers: initial number of server processes to start > > # MaxClients: maximum number of simultaneous client connections > > # MinSpareThreads: minimum number of worker threads which are kept spare > > # MaxSpareThreads: maximum number of worker threads which are kept spare > > # ThreadsPerChild: constant number of worker threads in each server > process > > # MaxRequestsPerChild: maximum number of requests a server process > serves > > <IfModule worker.c> > > StartServers 1 > > MaxClients 64 > > MinSpareThreads 64 > > MaxSpareThreads 64 > > ThreadsPerChild 64 > > MaxRequestsPerChild 0 > > ServerLimit 1 > > This is what I was talking about with limiting the maximum number of child > process to 1. Because you have this, if a single request takes some time > to > execute and the point it is waiting or taking time in is in C/C++ code in > a > external Python module, and that module doesn't properly release the > Python > GIL, all other requests will bank up behind that one request waiting for > it to > return out of the C/C++ code. > > In your libxx module, do you perform things in the C++ code that take a > while > or do you make calls to stuff which can block. Do you ensure that you wrap > time > consuming operations of code that can block in: > > Py_BEGIN_ALLOW_THREADS > ... blocking or time consuming operation. > Py_END_ALLOW_THREADS > > > </IfModule> > > > > <Location "/reg/"> > > SetEnv PYTHONHOME "/usr/local/bin/python2.4" > > This will not actually do anything for mod_python itself. Would only > affect CGI > scripts which are written in Python. > > > SetHandler python-program > > PythonPath "['/usr/local/pi/applications/', > > '/usr/local/pi/nodes/data/regist > > ration', '/usr/local/pi/pimgr/lib', '/usr/local/pi/pimgr/lib/ca' , > > '/usr/local/p > > i/pimgr/lib/MySQLdb'] + sys.path" > > PythonHandler django.core.handlers.modpython > > SetEnv PINET_HOME > > "/usr/local/pi/nodes/data/registration/pimgr/reg/ca/config > > " > > SetEnv PIMGR_PATH "/usr/local/pi/nodes/data/registration/pimgr" > > SetEnv DJANGO_SETTINGS_MODULE pimgr.settings > > PythonDebug On > > </Location> > > > -- "Little by little, through patience and repeated effort, the mind will become stilled in the Self." - Bhagawad Gita -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070124/d2f1c50c/attachment.html
|