Socket select performance

I’m not sure if this is a performance issue with select per say, or if
it’s more a question of what’s the best strategy for what we are
doing. This is with jruby-1.6.7.

For each request our rails app handles, we make 3-4 outgoing http
calls (these go to an api server that sits on top of our mongodb
clusters). The cpu time (according to visualvm cpu sampling) spent in
SelectBlob.doSelect eventually grows to just under 50%, at which point
we are doing around 2000 http calls per second.

I’m assuming the increased cpu time is because there is one selector
per socket, and doSelect gets called once for every http call?

My inclination at this point is to put in an eventmachine based http
client, so we just have one poller for all file descriptors. But I
wanted to make sure there isn’t something I am missing here before I
do that.

Chris

where is the cpu being used? 50% just in doSelect?

On Mon, Mar 5, 2012 at 8:53 AM, Roger P. [email protected] wrote:

where is the cpu being used? 50% just in doSelect?

Yep it’s all in doSelect. Although I’m not that surprised because
that’s with several hundred separate select() calls all happening at
once.

Chris

so you have 2000 threads all calling through to select?