> ## Content Index
> Fetch the complete content index at: https://www.jvrc.ca/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to ensure an existing ruby app is thread-safe
- URL: https://www.jvrc.ca/how-to-ensure-an-existing-ruby-app-is-thread-safe/
- Published: 2026-04-16T20:30:00.000Z
- Updated: 2026-09-18T20:35:26.000Z
- Author: Javier Cervantes
- Tags: existing-topic, rubyforum

You’re probably considering switching to puma to solve an issue with a service or you need to review that you’re workers code is thread safe because you want to use Sidekiq.

A first good step would be to use [rubocop-thread\_safety](https://github.com/rubocop/rubocop-thread%5Fsafety?ref=jvrc.ca) to make a static analysis. You can also use [threads](https://github.com/yegor256/threads?ref=jvrc.ca) gem if you’ve identified a potentially gnarly bunch of code you want to make thread-safe.

Additionally, you need to make sure you have a comprehensive test suite that will check for any potential issues in the code. For web requests, you want carefully audit any state that the application saves about the web request to avoid leaking data across requests.

After those checks have passed, you can the following process to release it safely:

1. Use the new code in your local and test environments for a period of time (without releasing it) to ensure the behaviour matches the original.
2. Before full rollout, make a canary release. By having a portion of your production traffic going to only one or two (vs. N) of the servers using the new code and monitor closely.

I hope you find this guide helpful, if you have any other recommendations or real-life experience with a similar process, please reply!