snacktime
2006-Nov-06 01:51 UTC
[Eventmachine-talk] close_connection taking a full second to close
I have two Connection classes that can call each other''s close_connection method. What would cause unbind to be called almost a full second after close_connection is called? With certain configurations of apache ab that''s what''s happening. Specifically when I have it set to only use one concurrent connection. More than one and the problem goes away. I think ab doesn''t handle things that well when it''s expecting a persistant connection and doesnt'' get it. Is there anyway it could be forcing the socket to remain open longer? Chris
Francis Cianfrocca
2006-Nov-06 04:55 UTC
[Eventmachine-talk] close_connection taking a full second to
On 11/6/06, snacktime <snacktime at gmail.com> wrote:> > I have two Connection classes that can call each other''s > close_connection method. What would cause unbind to be called almost > a full second after close_connection is called? With certain > configurations of apache ab that''s what''s happening. Specifically > when I have it set to only use one concurrent connection. More than > one and the problem goes away. I think ab doesn''t handle things that > well when it''s expecting a persistant connection and doesnt'' get it. > Is there anyway it could be forcing the socket to remain open longer?It would be important to rule out some kind of interaction with EM''s select loop. Try changing EM''s time quantum (EventMachine#set_quantum) and see if the delay changes with it. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20061106/28a608a7/attachment.html
snacktime
2006-Nov-06 13:18 UTC
[Eventmachine-talk] close_connection taking a full second to
> > It would be important to rule out some kind of interaction with EM''s select > loop. Try changing EM''s time quantum (EventMachine#set_quantum) and see if > the delay changes with it. >changing set_quantum didn''t make any difference. The delay between calling close_connection on the server and when unbind in the server is called varies from a couple tenth''s of a second to a full second, with the average being in the middle. The following code shows the unbind methods of the server and client. Interestingly, when http_client.close_connection is called from the server''s unbind method, there is no extra delay. # unbind method in client def unbind @connected = false if @response.content.size > 0 @http_server.send_data(@response.content) @response.request_finished end puts "http client unbind" if $DEBUG if @http_server.connected? @http_server.close_connection puts "calling close_connection on server #{Time.now.to_f}" if $DEBUG end end And the unbind method in the server: def unbind puts "http server unbind #{Time.now.to_f}" if $DEBUG @connected = false @http_client.close_connection if !@http_client.nil? and @http_client.connected? end