From e0cd796b1bbd3311eeebae4f1a983fcc69ff50b6 Mon Sep 17 00:00:00 2001 From: Jonathan Hyman Date: Wed, 2 Jul 2014 13:38:54 -0400 Subject: [PATCH] Adds a note about Kiqstand and reusing connections. --- source/en/mongoid/v3/tips.haml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/en/mongoid/v3/tips.haml b/source/en/mongoid/v3/tips.haml index fa44c9e1..e4fcb4f0 100644 --- a/source/en/mongoid/v3/tips.haml +++ b/source/en/mongoid/v3/tips.haml @@ -251,13 +251,19 @@ %h2 Sidekiq %p - If you are using Sidekiq, you need to ensure that MongoDB sessions are - diconnected after each worker runs, or you will quickly overload MongoDB - with more active connections than it can handle. In order to handle this + If you are using Sidekiq, you need to ensure that your identity map is cleared + after each job runs. In order to handle this seamlessly for you, we have provided a gem with a Sidekiq middleware that handles this - Kiqstand. You will need to be on Mongoid version 3.0.3 or higher. + %p + When using Sidekiq, connections will disconnect from MongoDB at each job since + sessions are stored on Fiber-local variables. If you want to reuse connections, + you can patch Celluloid::Thread. See + this discussion on the Mongoid + users group for more information. + %p To use Kiqstand, first add it to your Gemfile.