Skip to first unread message

Samuel Lown

Jul 10, 2015, 7:31:52 AM7/10/15
to couc...@googlegroups.com
Hi All,

I wanted to communicate a pull request [1] I've been working on this week for the CouchRest gem. There are a few possibly breaking API changes, so I've bumped the version up to 2.0.0.beta1. Despite only being a PR, I've packaged a gem for convenience.

The change boils down to replacing RestClient with HTTPClient [2] which adds support for:

 * Persistent HTTP connections
 * Built-in streaming

As a consequence, I've added CouchRest's own exception models for response errors, instead of relying on RestClient. Timeout or Connection errors are still handled directly by HTTPClient which may or may not be a good idea.

Most of the API remains the same, but the recommended approach now is to send requests via a `CouchRest::Server` instance instead of the less efficient `CouchRest#get` and related class methods.

Persistent connections are a big win for performance, especially with SSL, and results with our own system have been positive so far. I've not had time yet to create benchmarks yet.

Finally, I'm also working on CouchRest Model to support the new streaming API with views which is way more efficient than loading massive view result sets into memory.

It'd be great if anyone out there has time to checkout the beta and let me know how it goes before releasing a final version.



Samuel Lown

Jul 13, 2015, 6:28:33 AM7/13/15
to couc...@googlegroups.com
Quick update, I managed to create a simple benchmark with CouchRest Model:

Results with old version creating 100 documents, and reading them one by one:

       user     system      total        real
Create:          2.540000   0.180000   2.720000 (  3.248365)
Fetch inc/docs:  0.210000   0.010000   0.220000 (  0.255698)
Fetch:           2.300000   0.100000   2.400000 (  2.701406)

And using persistent connections in the new CouchRest library, including an extra test using streaming view blocks:

       user     system      total        real
Create:          0.590000   0.070000   0.660000 (  1.141762)
Fetch inc/docs:  0.050000   0.010000   0.060000 (  0.129377)
Fetch:           0.160000   0.040000   0.200000 (  0.447520)
Fetch w/block:   0.180000   0.040000   0.220000 (  0.471253)

The difference in CPU time for multiple-requests is impressive, but the 50% decrease in response time for the "Fetch inc/docs", a single request, suggest HTTPClient is much more efficient in general. 

The streaming response time is also very encouraging. It appears there is very little additional overhead, so dealing with big data sets is likely to be much better.


You received this message because you are subscribed to the Google Groups "CouchRest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to couchrest+...@googlegroups.com.
To post to this group, send email to couc...@googlegroups.com.
Visit this group at http://groups.google.com/group/couchrest.
For more options, visit https://groups.google.com/d/optout.


Ryan Graham

Jul 17, 2015, 3:29:12 AM7/17/15
to couc...@googlegroups.com

I've moved on from both Ruby and CouchDB since subscribing to this list, but just wanted to say that those are some promising looking results.

Great job, Sam, keep it up!


Reply all
Reply to author
0 new messages