Hi John, 

thanks for the fast response! 
I was digging deeper, and found a workaround :-)

begin
   .. process the AR model .. 
ensure     
   ActiveRecord::Base.clear_active_connections!
end


>> we have a lot of LocalParticipants which need to connect  Postgres (via 
>> ActiveRecord).
>> Trying to run them multithreaded leads to too many postgres connections 
>> quite fast:
>> 
>> postgres.log:
>> FATAL:  sorry, too many clients already
>> 
>> Finally we run all Participants connecting to postgres via:
>> 
>> def do_not_thread
>>  true
>> end
> 
> Well done, limiting the participants to use the same thread as the worker
> should limit them to use the one connection bound to the thread (IIRC that's
> how activerecord does its connection management).
> 
> Thanks for sharing the tip!
> 
> 
>> regardless of multithreaded or not I encountered the following warning:
>> 
>> postgres.log
>> LOG:  unexpected EOF on client connection

LOG:  unexpected EOF on client connection
was because of an resque-background job .. seams not to be the fault of ruote 
:-)


> Sorry, I don't know what your participant looks like, how db-intensive it is.
> 
> I'd google for that error message, maybe pitching in "activerecord".
> 
> 
>> btw. our Postgres (version 9.1) max_connections is set to 100.
>> the scenario happens regardless of the number of ruote-workers (1-5)
> 
> Well, Ruby runtimes won't share connections...
> 
> By scenario, do you mean the scenario with #do_not_thread set to false that
> triggers the "FAIL: too many clients already" or the scenario where
> #do_not_thread is set to true and triggers "LOG: unexpected EOF"?
> 
> I am sorry, I have trouble understanding the variant articulation in your
> report.

Now in my participant I use this workaround for the 'too many clients already' 
error.

begin
   .. process the AR model .. 
ensure     
   ActiveRecord::Base.clear_active_connections!
end

Seams to solve the problem :-)

Thanks,
Marco

> 
> 
> Best regards,
> 
> --
> John Mettraux - http://lambda.io/jmettraux
> 
> -- 
> you received this message because you are subscribed to the "ruote users" 
> group.
> to post : send email to openwferu-users@googlegroups.com
> to unsubscribe : send email to openwferu-users+unsubscr...@googlegroups.com
> more options : http://groups.google.com/group/openwferu-users?hl=en


Schöne Grüße Marco


-- 





 
NinjaConcept GmbH
Marco Sehrer
Geschäftsführung
 
Amalienstrasse. 44
76133 Karlsruhe
 
fon:    (+49) 0721 1803523-1
fax:    (+49) 721 961402-99
mobile: (+49) 151 20314416
 
email:  m...@ninjaconcept.com
www:    http://www.ninjaconcept.com/




-- 
you received this message because you are subscribed to the "ruote users" group.
to post : send email to openwferu-users@googlegroups.com
to unsubscribe : send email to openwferu-users+unsubscr...@googlegroups.com
more options : http://groups.google.com/group/openwferu-users?hl=en

<<inline: logo_240x60.gif>>

Reply via email to