one socket opened per send
Reported by geir | December 30th, 2008 @ 12:25 PM
It seems that couchrest opens one socket per send. The program :
require 'couchrest'
def save(n) couch = CouchRest.new("http://localhost:5984") db = couch.database('geirtest') n.times { db.save({ "name" => "geir" }) } end
t1 = Time.now
thread1 = Thread.new{save(100)} thread1.join
t2 = Time.now
puts t2 - t1
opens lots of sockets.
1) Am I interpreting things right?
2) Can there be a mode where the library takes advantage of keepalive to avoid the socket creation overhead?
Forgive my crappy ruby code.
Comments and changes to this ticket
-
CodeMonkeyKevin August 13th, 2010 @ 07:43 PM
- Milestone order changed from 0 to 0
You wouldn't want to do this without some sort of thread queue or thread management as under heavy loads the ruby vm will not hold up with N# of Threads spawned. The better way is and I already started this is moving away from IO blocking http client RestClient/Curb/Net::Http. I started to break up the http calls in to and generic interface. RestAPI generic module calls the http client adapter. I just did this for curb(libcurl) http://github.com/CodeMonkeyKevin/couchrest but the same can be done for EventMachine.http, much like em-couchdb where the calls are not IO blocking.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
"CouchDB, close to the metal." <a href="http://github.com/jchris/couchrest/tree/master">CouchRest</a> is a RESTful layer for accessing CouchDB, based off CouchDB's included Javascript reference client. CouchRest also includes helpers for running large queries etc. There is also a base class for ActiveRecord / Datamapper style ORM, called CouchRest::Model.