seanjensengrey / cogen

Automatically exported from code.google.com/p/cogen
MIT License
0 stars 0 forks source link

WSGI upload speed is .12 kb/s #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Using the latest trunk I am using the cogen.wsgi server to handle file uploads 
with this code:

          buff = StringIO()
          stalled = False
          while not stalled:
            yield environ['cogen.input'].readline() #read(1024) #readline(512)
            result = environ['cogen.wsgi'].result
            if isinstance(result, events.OperationTimeout):
              stalled = True
            elif isinstance(result, Exception):
              import traceback
              traceback.print_exception(*environ['cogen.wsgi'].exception)
            else:
              if not result:
                break
              buff.write(result)

However a 3.8 kb gzip file is taking 30 seconds to upload. py2.6 builtin epoll 
is available. Running on a debian etch 
server VPS, and my development machine (mac os x) gives the same results. I've 
tried using different read ops, ie: 
readline(512), readline(8192), read(8192), read(512), but none seem to give any 
benefit.

Original issue reported on code.google.com by samuraib...@gmail.com on 14 Sep 2009 at 11:26

GoogleCodeExporter commented 8 years ago
Can you attach a test client for this ?

Original comment by ionel...@gmail.com on 14 Sep 2009 at 11:37

GoogleCodeExporter commented 8 years ago
something like this... sorry for the mess

Original comment by samuraib...@gmail.com on 15 Sep 2009 at 3:00

Attachments:

GoogleCodeExporter commented 8 years ago
I can't reproduce it - however, you must do content-length boundary checking in 
the
wsgi app like here:
http://code.google.com/p/cogen/source/browse/trunk/cogen/web/async.py#109

Original comment by ionel...@gmail.com on 15 Sep 2009 at 9:27

GoogleCodeExporter commented 8 years ago
you seem to have spotted my error. thank you for helping, upload speed is now 
very quick!

Thanks!

Original comment by samuraib...@gmail.com on 16 Sep 2009 at 8:32

GoogleCodeExporter commented 8 years ago

Original comment by ionel...@gmail.com on 17 Sep 2009 at 7:13