Serving Large Files with Zope
Here are some timings using asyn_http_bench before and after a small change was applied to ZServer/HTTPServer.py:
asyn_http_bench myhost 80 /myurl 3 3
/myurl returns a string of varying length (10Mb, 20Mb, etc)
| Size | Before | After |
|---|---|---|
| 10 Mb | 26.5 sec | 9.8 sec |
| 20 Mb | 88.4 sec | 20.47 sec |
| 30 Mb | 194.6 sec | 30.3 sec |
| 40 Mb | connection errors | 40.2 sec |
$ diff -c HTTPServer.py.ZopeVendor HTTPServer.py.ZopePatch27
*** HTTPServer.py.ZopeVendor Thu Sep 7 16:49:08 2006
--- HTTPServer.py.ZopePatch27 Thu Sep 7 16:48:50 2006
***************
*** 74,79 ****
--- 74,81 ----
class zhttp_collector:
+ ac_in_buffer_size = 1< <20
+
def __init__(self, handler, request, size):
from ZServer import LARGE_FILE_THRESHOLD
self.handler = handler
***************
*** 303,309 ****
# producers by default
if self.closed:
return
! self.producer_fifo.push(producer)
if send: self.initiate_send()
push_with_producer=push
--- 306,315 ----
# producers by default
if self.closed:
return
! if type(producer) == type(''):
! self.producer_fifo.push (producers.scanning_producer (producer, self.ac_out_buffer_size))
! else:
! self.producer_fifo.push (producer)
if send: self.initiate_send()
Update: 27/04/2007 – There are some simple optimizations available in asyncore for Zope to serve large files
About this entry
You’re currently reading “ Serving Large Files with Zope ,” an entry on Chui's Counterpoint
- Published:
- 9.7.06 / 7pm
- Category:
- Python
2 Comments
Jump to comment form | comments rss [?] | trackback uri [?]