durusmail: quixote-users: Need Medusa users to test patch (improving large response performance)...
Need Medusa users to test patch (improving large response performance)...
2003-06-04
Need Medusa users to test patch (improving large response performance)...
Re: Need Medusa users to test patch (improving large response performance)...
2003-06-05
Medusa patch rev. 2 (Re: Need Medusa users to test patch (improving large response performance)...)
2003-06-05
Need Medusa users to test patch (improving large response performance)...
Neil Schemenauer
2003-06-04
On Wed, Jun 04, 2003 at 01:33:00PM -0400, Graham Fawcett wrote:
> Using Quixote on Medusa to serve up static files, I was getting really
> terrible performance when the file sizes started to increase. CPU would
> shoot through the roof on the server, and througput downgraded very quickly.
>
> I've got a patch that seems to solve the problem... for me, anyway. Instead
> of pushing the content of the response to Medusa as a string, I push a
> Medusan file_producer, wrapped around the already-built StringIO,
> output_file.

I'd like to see a more general fix.  Instead of the publisher always
calling str() on the response it should be possible to return a
"streamed response".  Something like:

    # in http_response.py
    class ResponseStream:
        def __iter__(self):
            ...

and then in publisher.py publish():

    if output:
        response.response.set_body(output)
    request.response.write(stdout)

finally in http_response.py:

    def write(self, file):
        ...
        if isinstance(self.body, ResponseStream):
            for chunk in self.body:
                file.write(chunk)
        else:
            stdout.write(str(self.body))

There are a obviously a few details to resolve but I think it would be a
feasible solution.  Does someone want to try to make a patch?

  Neil

reply