Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

one socket opened per send

#29

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.

Reported by geir · December 30th, 2008 @ 12:25 PM

State: new
Milestone: none
Assigned to: nobody

Activity

  1. geir
    geir

    Sorry - formatting for code was bad. Code is here :

    http://friendpaste.com/2vnIZk6dA...

    December 30th, 2008 @ 12:56 PM

  2. CodeMonkeyKevin
    CodeMonkeyKevin
    • 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.

    August 13th, 2010 @ 07:43 PM

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.