Low bandwidth Apache / mod_wsgi

I have a trivial WSGI application running on pesto, mod_wsgi and Apache:

def viewData(request):
    return Response("aaaaaaaaaa" * 120000) # return 1,2MB of data

On my test machine, I get a bandwidth of about 100 kbps, that is, the request takes about 12 seconds. Downloading static files from the same instance of Apache gives me about 20 MB / s. Why is there such a huge difference, and how can I speed up the WSGI application?

Software Version: Ubuntu 10.04, Apache 2.2.14, Python 2.6.5, mod_wsgi 2.6 (all Ubuntu packages by default), pesto-18

edit . The real application presented in this example does not attempt to send static files, but dynamically creates a large amount of HTML. HTML generation is fast (I passed it through cProfileand timeit), but the transfer was slow and I would like to fix this specific problem.

edit 2 : I tested the current versions of pesto (21) and mod_wsgi (3.3) on the same stack, throughput has not changed much. I also replaced mod_wsgi with spawning 0.9.5 for apache mod_proxy - this increased the bandwidth by four times, but it's still far from d like it to be.

+5
source share
1 answer

WSGI . , , .

:

def viewData(request):
    return Response(["aaaaaaaaaa" * 120000])

.

+4

All Articles