title: Celluloid/Sidekiq & Rails 3.2 with MRI Ruby and an app not previously designed for thread-safety, is it viable?
body: <p>I've got a big project running on MRI Ruby and Rails 3.2 on Passenger with an app that was not designed with thread-safety in mind and this app handles mailings through DelayedJob and the database is paying a heavy price for this.</p>
  
  <p>Some possible problems are mentioned in the sidekiq railscast <a href="http://railscasts.com/episodes/366-sidekiq" rel="nofollow">http://railscasts.com/episodes/366-sidekiq</a> including:</p>
  
  <ol>
  <li>database connection limit (if using thread-pool of 1, the db connection limit should be doubled)</li>
  <li>thread-safety (this is probably the show stopper)</li>
  <li>fiber-safety? Is this an issue with AR?</li>
  </ol>
  
  <p>So, the question are:</p>
  
  <ol>
  <li>how viable is it to make a big project thread-safe enough for the mail generation to work in threads inside the passenger process? (mailings are complex enough to depend on AR)</li>
  <li>same question when using sidekiq, "how viable is it to make a big project thread-safe enough for the mail generation to work using sidekiq? (mailings are complex enough to depend on AR)"</li>
  <li>apart from db connection limit and thread-safety issues, is there anything else to consider or less obvious got'chas I failed to forsee?</li>
  </ol>