Hi,

I'm having performance problems with mod_wsgi+mod_deflate. When the
gzip output encoding is in effect, responses takes a long time to
complete (625 ms) even though no data is being sent during the last
~600 ms.

Here is my test application:

#!/usr/bin/python
def application(environ, start_response):
  status = "200 OK"
  output = "Hello, world 2!"

  response_headers = [("Content-Type", "text/plain"),
                      ("Content-Length", str(len(output)))]
  start_response(status, response_headers)

  return [output]

This is being run under Apache 2.2 with mod_wsgi 2.5 in daemon mode.
Apache has mod_deflate enabled for content type text/plain, and here
are the response headers:

Date: Fri, 20 Aug 2010 01:51:31 GMT
Server: Apache/2.2.12 (Ubuntu)
Vary: Accept-Encoding
Content-Encoding: gzip
Keep-Alive: timeout=15, max=94
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/plain

This seems to cause Firefox to wait for a long time until deciding
it's the end of content (625 ms). The Firebug request timeline looks
like:

        0       Started
        0       0       DNS Lookup
        0       0       Connecting
        0       0       Blocking
        0       0       Sending
        0       31ms    Waiting
        +31ms   594ms   Receiving
        +631ms  'DOMContentLoaded' (event)
        +644ms  'load' (event)

If I set the Content-Type so that mod_deflate doesn't match it and the
content is sent plainly (without mod_deflate), Content-Length is
passed through nicely and the requests complete in < 50 ms:

HTTP/1.1 200 OK
Date: Fri, 20 Aug 2010 02:11:22 GMT
Server: Apache/2.2.12 (Ubuntu)
Content-Length: 15
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: text/plain,frigoffdeflate

And response timeline:

        0       Started
        0       0       DNS Lookup
        0       0       Connecting
        0       0       Blocking
        0       0       Sending
        0       32ms    Waiting
        +32ms   0       Receiving
        +91ms   'DOMContentLoaded' (event)
        +109ms  'load' (event)

Ideally I would like to have mod_deflate working to reduce transfer
time, but also have it send Content-Length for the compressed content
so responses complete as soon as the data is finished. This appears to
be the case when Apache serves static files with mod_deflate:

HTTP/1.1 200 OK
Date: Fri, 20 Aug 2010 02:12:12 GMT
Server: Apache/2.2.12 (Ubuntu)
Last-Modified: Wed, 04 Aug 2010 06:49:27 GMT
Etag: "25b51d-167-48cf9d5b50bc0"
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 201
Keep-Alive: timeout=15, max=97
Connection: Keep-Alive
Content-Type: text/css

Any idea how to the this working properly?

Thanks,
Catalin

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

Reply via email to