1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00
mperham--sidekiq/docs/7.0-Upgrade.md

68 lines
3.2 KiB
Markdown
Raw Normal View History

2022-02-14 15:27:16 -08:00
# Welcome to Sidekiq 7.0!
2022-09-01 10:12:30 -07:00
Sidekiq 7.0 contains major new features and some breaking changes which streamline proper operation of Sidekiq.
It completes the transition from the `redis` gem to the `redis-client` gem, which adds support for the RESP3 protocol and provides better compatibility with future versions of Redis.
2022-02-14 15:27:16 -08:00
2022-09-01 10:12:30 -07:00
# What's New
## Job Metrics
Sidekiq 7.0 adds a new "Metrics" tab in the Web UI with high-resolution data on job execution times along with the ability to mark deploy times.
This allows you to monitor job execution times minute by minute and see when a deploy causes a performance regression.
## Embedding
Embedding is an experimental new way to run Sidekiq. Previously, you could only run Sidekiq by starting a new process with `bundle exec sidekiq`. Now you can embed Sidekiq within another process with just a few lines of Ruby code. See the [Embedding](/mperham/sidekiq/wiki/Embedding) wiki page for details. I'm labeling this "experimental" because it's quite possible that 3rd party plugins or various edge cases within Sidekiq could break. Feedback is very much appreciated if you try out embedding, even if just "works great for us!".
## Capsules
Sidekiq 7.0 allows you to define "capsules" which execute jobs from queues. The `default` capsule spins up `10` Threads to fetch jobs from the `default` queue. You can change these values and/or define your own separate Capsules if you wish to throttle execution from a given queue. For instance, here's how to define a single-threaded capsule for thread-unsafe jobs:
```ruby
Sidekiq.configure_server do |config|
# edits the default capsule
config.queues = %w[critical default low]
config.concurrency = 5
# define a new capsule which processes jobs from the `single` queue one at a time
config.capsule("single-threaded") do |cap|
cap.concurrency = 1
cap.queues = %w[single]
end
end
```
This Sidekiq instance will have 6 threads executing jobs. Note the concurrency is per-instance; Capsules do not provide cluster-wide throttling but only limit concurrency per instance.
2022-02-14 15:27:16 -08:00
2022-05-12 08:42:23 -07:00
### redis-client
2022-02-14 15:27:16 -08:00
2022-05-12 08:42:23 -07:00
Sidekiq 6.5 introduced beta support for the `redis-client` gem while defaulting to
using the `redis` gem. Sidekiq 7.0 completes this transition and no longer uses
the `redis` gem internally. **Your app can still continue to use `redis`.** If you use `Sidekiq.redis` to access Redis connections, that API is now exposing a connection based on `redis-client`.
### redis-namespace
Support for `redis-namespace` has been removed. [I have advised against its usage for many years now.](https://www.mikeperham.com/2017/04/10/migrating-from-redis-namespace/) One option is to use Redis's numbered databases instead.
## Version Support
- Redis 6.2+ is now required
- Ruby 2.7+ is now required
- Rails 6.0+ is now supported
Support is only guaranteed for the current and previous major versions. With the release of Sidekiq 7, Sidekiq 5.x is no longer supported.
2022-02-14 15:27:16 -08:00
## Upgrade
As always, please upgrade Sidekiq **one major version at a time**.
If you are already running Sidekiq 6.x, then:
* Upgrade to the latest Sidekiq 6.x.
```ruby
gem 'sidekiq', '< 7'
```
* Fix any deprecation warnings you see.
* Upgrade to 7.x.
```ruby
gem 'sidekiq', '< 8'
2022-05-12 08:42:23 -07:00
```