Search code examples
apachemod-wsgiwerkzeug

page is being received too long


I have rewritten web application from using mod_python to using mod_wsgi. Problem is that now it takes at least 15 seconds before any request is served (firebug hints that almost all of this time is spent by receiving data). Before the rewrite it took less than 1 second. I’m using werkzeug for app development and apache as a server. Server load seems to be minimal and same goes for memory usage. I’m using apache2-mpm-prefork.

I’m using the default setting for mod_wsgi - I think it’s called the ‘embedded mode’. I have tested if switching to apache2-mpm-worker would help but it didn’t. Judging from app log it seems that app is done with request quite fast - less than 1 second. I have changed the apache logging to debug, but I can’t see anything suspicious. I have moved the app to run on a different machine but it was all the same.

Thank in advance for any help.


Solution

  • Sounds a bit like your response content length doesn't match how much data you are actually sending back, with content length returned being longer. Thus browser waits for more data until possibly times out.

    Use something like:

    http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Tracking_Request_and_Response

    to verify what data is being sent back and that things like content length match.

    Otherwise it is impossible to guess what issue is if you aren't showing small self contained example of code illustrating problem.