Use nodelay socket option for couchdb httpd server
Some python libraries that provide api for couchdb access will take much longer than using plain @requests@ lib:
# put 100 docs using requests, couchdb and couchdbreq libs # couchdb server doesn't have nodelay option set in this run requests finished in 0.578608036041 secs mean: 0.005786 couchdb finished in 4.32773804665 secs mean: 0.043277 couchdbreq finished in 4.60177111626 secs mean: 0.046018
Note that using plain @requests@ is in this case almost 10 times faster than using the other libs. It is still unclear why this is the case.
If you do add the @nodelay@ flag in @/etc/couchdb/default.ini@:
[httpd] (...) socket_options = [(...), {nodelay, true}]
Then it's much faster:
# put 100 docs using requests, couchdb and couchdbreq libs # couchdb server *does* have nodelay option set in this run requests finished in 0.586463928223 secs mean: 0.005865 couchdb finished in 0.275610923767 secs mean: 0.002756 couchdbreq finished in 0.53059887886 secs mean: 0.005306
Note that it doesn't make much a difference when using plain @requests@ lib, but it makes a huge difference when using the other libraries. We are currently using the @couchdb@ library (the second one in the measurements), so this actually makes a big difference for our case.
See: https://stackoverflow.com/questions/13807706/couchdbkit-10x-slower-than-requests
In my tests running soledad client, server and couchdb in localhost, i have the following results:
# upload 100 documents, without nodelay socket option set in couchdb real 0m31.011s # upload 100 documents, with nodelay socket option set in couchdb real 0m12.493s
That is a factor of 2.5 gain in speed. Note, however, that i'm performing tests in localhost connections so when using a real network the gain might be lower.
(from redmine: created on 2016-07-21, closed on 2016-08-03, relates #6154)