Featured post
django - gzip - questions about performance -
firstly, i'm using django. django provides gzip middleware works fine. nginx provides gzip module. make more sense use nginx's gzip module because implemented purely in c, or there other performance considerations i'm missing.
secondly, django doesn't gzip under 200 bytes. because gzipping expensive have value when compressing output smaller that?
thirdly, api i'm building purely dynamic little caching. gzipping expensive enough make unpractical use in situation (vs situation cache gzipped output on webserver)?
1) imagine 1 gzip compression enough , nginx faster, although haven't benchmarked yet. gzipmiddleware
utilizes few built-ins, might optimized, too.
# http://www.xhaus.com/alan/python/httpcomp.html#gzip # used permission. def compress_string(s): import cstringio, gzip zbuf = cstringio.stringio() zfile = gzip.gzipfile(mode='wb', compresslevel=6, fileobj=zbuf) zfile.write(s) zfile.close() return zbuf.getvalue()
2) small gzip'd files can't take advantage compression (in fact small files might bigger, when processed), 1 can save time skipping step.
3) design test suite including sample data. decide on data, works best application.
- Get link
- X
- Other Apps
Comments
Post a Comment