[Twisted-Python] How to improve response time of twisted.web?

Pavel pbastov at gmail.com
Thu Mar 27 23:57:01 EDT 2008


Thanks for the replies.

In fact, I just tried to compare it against the static files -- almost
the same result --
a little bit faster, but far from Apache :(

On Thu, Mar 27, 2008 at 10:26 PM, Drew Smathers <drew.smathers at gmail.com> wrote:
> On Wed, Mar 26, 2008 at 10:53 PM, Pavel <pbastov at gmail.com> wrote:
>  > Yes, I wrote my own resource. Looks like this:
>  >
>  >  class MyRoot(Resource):
>  >         def getChild(self, name, request):
>  >                 if "" == name:
>  >                         return self
>  >                 return Resource
>  >
>  >         def render_GET(self, request):
>  >                 path = "/path/to/file"
>  >                 f = open(path)
>  >                 content = f.read()
>  >                 f.close()
>  >                 return content
>  >
>  >
>
>  You should probably be using twisted.web.static.File for a better
>  comparison of static file serving performance. In fact, you could do
>  this without writing any code at all:
>
>  $ twistd web --path=<dir>
>
>
>  Cheers,
>  --
>  \\\\\/\"/\\\\\\\\\\\
>  \\\\/ // //\/\\\\\\\
>  \\\/ \\// /\ \/\\\\
>  \\/ /\/ / /\/ /\ \\\
>  \/ / /\/ /\ /\\\ \\
>  / /\\\ /\\\ \\\\\/\
>  \/\\\\\/\\\\\/\\\\\\
>   d.p.s
>
>
>
>  _______________________________________________
>  Twisted-Python mailing list
>  Twisted-Python at twistedmatrix.com
>  http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>



-- 
Good luck,

Pavel Bastov
xooChat Team Leader
http://www.xoochat.com/




More information about the Twisted-Python mailing list