[Twisted-web] Extremely slow POST request?

Magnus Hult magnus at spotify.com
Thu Jul 5 05:23:26 EDT 2007


I have a simple resource that selects rows from a database and returns
the answer as some kind of XML:

class Bounces(resource.Resource):
    def render(self, request):
        request.setHeader('Content-Type', 'text/xml')
        bounces = Bounce.table.select(Bounce.c.id.in_(*request.args['id']))
        return as_xml(bounces)

In an application set up like

root = resource.Resource()
root.putChild('bounces', Bounces())
site = server.Site(root)
from twisted.application import service, strports
application = service.Application("bounceinfo")
s = strports.service('tcp:8090', site)

A GET request to /bounces?id=...&id=... with a few ids finishes in no
time (like 0.04 seconds), but the exact same request as a POST (with
the parameters as urlencoded form data) takes over two seconds (!).
Any ideas why?

Best regards,

More information about the Twisted-web mailing list