From 3bd237dcd043bb0e862dfc6d9151d869f235c194 Mon Sep 17 00:00:00 2001 From: Jonathan Hyman Date: Mon, 9 Dec 2013 14:10:56 -0500 Subject: [PATCH] Adds a note about Kiqstand and reusing connections. --- source/en/mongoid/docs/tips.haml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/en/mongoid/docs/tips.haml b/source/en/mongoid/docs/tips.haml index 7f1fdaa5..e4fcb4f0 100644 --- a/source/en/mongoid/docs/tips.haml +++ b/source/en/mongoid/docs/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 that 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.