Tuesday, May 20, 2014

NGINX + PostgreSQL + PostGIS - performance baseline/diff

Just wanted to share some of the initial benchmark from http_load on the project I'm working right now. Why the excitement? I've been an MS oriented guy for the last 20 years and moving away from IIS and MSSQL (where you can be waiting 20-30 seconds for the initial IIS/.NET/SQL app startup) to NGINX with PostgreSQL stack is life changing - no exaggeration!

So here is what I got on Digital Ocean lowest spec machine (1 core, 20GB SSD, 512 MB RAM, Ubuntu 12) with a bare NGINX:

34178 fetches, 10 max parallel, 683560 bytes, in 5 seconds
20 mean bytes/connection
6835.6 fetches/sec, 136712 bytes/sec
msecs/connect: 0.0445469 mean, 0.937 max, 0.021 min
msecs/first-response: 1.41242 mean, 101.975 max, 0.257 min

And with the full nginx->postgresql with postgis searching for speed limits around submitted location (but only a few limits present in db for a moment):

5574 fetches, 10 max parallel, 6.22058e+06 bytes, in 5 seconds
1116 mean bytes/connection
1114.8 fetches/sec, 1.24412e+06 bytes/sec
msecs/connect: 0.0561055 mean, 0.37 max, 0.023 min
msecs/first-response: 8.68285 mean, 187.733 max, 0.812 min

So it got from almost 7k to 1k per second, still that's from the different universe compared to what IIS/.NET would do for me, and look at the machine spec! Plus, $0.0 for nginx + $0.0 for posgre/postgis - pure win!

-- Stan.
Post a Comment