Hi, I actually have a mysql error in my ruby script. After several requests I have the "too many connections" error. But I don''t why because I created a queue that runs 5 threads. Every thread execute many mysql requests. I limited the queue to 5 threads to not overload mysql. But it seems that doesn''t work. Here is an example of my script. I precise that I use activerecord. threads = (1..5).map do |i| Thread.new(QUEUE) do |q| until ( q == (tab = q.deq)) functions_that_executes_many_mysql_requests end end end 10.times do |t| 30.times do |s| QUEUE.enq(des_parametres) end threads.size.times { QUEUE.enq QUEUE} threads.each {|u| u.join} end I hope someone can help me Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.