TileStache: crappy CGI timings

I made the mistake of doing a bunch of testing of TileStache with the simple Python CGIHTTPServer. It’s a great little test apparatus, but it’s single threaded. Also it’s slow by itself.

  • CGIHTTPServer: 750ms to load a single tile, 10,000ms to load a whole map with 24 or so tiles
  • Gunicorn with 4 workers (sync): 650ms to load a single file, 2154ms to load a whole map.

Some comparisons on Gunicorn settings to load a map with 24 tiles.

  • 1 worker, default sync worker: 4800ms
  • 2 workers, default sync worker: 2500ms
  • 4 workers, default sync worker: 2300ms
  • 24 workers, default sync worker: 1700ms

Interestingly the gevent worker seems slower, also more variable. OTOH it’s necessary if you’re serving GUnicorn direct to the web, without a proxy in front.

The backend server is mostly waiting on IO to Postgres, it’s no surprise doing that in parallel will be better. All on a single 4 core 2012 iMac with some SSD-backed storage. I should add I’m doing this all without benefit of any caching, so it’s all kind of fake.