Sidekiq embedding runs Sidekiq inside another process, such as Puma, so you do not need to run a separate Sidekiq process. This post is for Ruby and JavaScript developers. In this post you will learn how to embed Sidekiq in Puma, what an embedded Sidekiq instance gives up, and what changed after 7.0. This matters because embedding comes with limits you should know first. Each fact names its source.
We love reading, watching, and listening in order to keep our skills sharp and our perspectives fresh. Here are some of the resources we learned from this month.
Embedding with Sidekiq 7.0#
Mike Perham, the creator of Sidekiq, wrote a blog post discussing one of the features of the newly released Sidekiq 7.0: embedding! Prior to version 7.0, an entirely separate Sidekiq process was required for background job processing. Now, Sidekiq can be embedded within another process, making for simpler deployments and less total memory usage. There are some drawbacks though, which are mostly around the limited number of threads that can be run with embedded processes.
What is Sidekiq embedding, and why use it instead of a separate Sidekiq process?#
Sidekiq embedding means Sidekiq runs inside another process, so you do not start a separate Sidekiq process. Mike Perham gives two reasons to use it: you deploy and monitor one process instead of two, and the two share memory. The Sidekiq wiki says: "Starting in 7.0, Sidekiq can be embedded within another process so you do not need to run a separate Sidekiq process. This is called embedding." This post's Sidekiq tip describes the earlier setup: "an entirely separate Sidekiq process was required for background job processing."
The Sidekiq 7.0 upgrade notes say: "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."
Mike Perham explains why in Sidekiq 7.0: Embedding, published October 27, 2022. He writes: "Embedding can make for a simpler deployment: you deploy one larger process instead of two separate processes, now you only need to monitor and manage one process." He adds: "Embedding also requires less total memory since both subsystems will share most of the Ruby data structures and code in memory."
He also names the cost: "Embedding does have a serious limitation: Ruby’s Global VM Lock limits the process to one core which pretty drastically limits how many threads you can run in a process."
How do you embed Sidekiq in Puma?#
Create the embedded Sidekiq instance with Sidekiq.configure_embed inside Puma's on_worker_boot hook, call run on it, and stop it in on_worker_shutdown. The Sidekiq wiki's Embedding page gives this config/puma.rb and says: "The process will typically have some sort of lifecycle callbacks which you can use to create, start and stop the Sidekiq instance."
# config/puma.rb
workers 2
threads 1, 3
# preloading the application is necessary to ensure
# the configuration in your initializer runs before
# the boot callback below.
preload_app!
x = nil
on_worker_boot do
x = Sidekiq.configure_embed do |config|
# config.logger.level = Logger::DEBUG
config.queues = %w[critical default low]
config.concurrency = 2
end
x.run
end
on_worker_shutdown do
x&.stop
endPuma's changelog lists on_worker_boot to before_worker_boot and on_worker_shutdown to before_worker_shutdown among the hooks renamed in Puma 7.0.0, released September 3, 2025. Check the hook names for your Puma version.
The same page gives a Passenger version for config/application.rb. It starts Sidekiq on the starting_worker_process event and stops it on the stopping_worker_process event.
On concurrency, the wiki says: "I strongly recommend keeping your concurrency very low, i.e. 1-2." Its reason: "Embedding Sidekiq within an MRI process means that it shares one GVL with all other threads within the process."
It then gives a rule and an example: "A good rule of thumb is that your puma threads + sidekiq concurrency should never be greater than 5. You'll create a puma process for every core so if your machine has 8 cores, you'll have 8*3 = 24 Puma threads and 8*2 = 16 Sidekiq threads. As with any rule of thumb, YMMV."
What does an embedded Sidekiq instance give up?#
An embedded Sidekiq instance does not read config/sidekiq.yml or command line arguments. It does not respond to signals itself, and it does not support graceful restarts, a Sidekiq Enterprise feature. The Sidekiq wiki lists these in its Notes. The table quotes each one, plus the Puma phased restart limit.
| What changes | The Sidekiq wiki's words |
|---|---|
| Signals | "The process owner owns any signal traps; the embedded Sidekiq instance does not directly respond to Ctrl-C, TERM or any other signal." |
| config/ | "The embedded instance does not look at config/sidekiq.yml or command line arguments. You can only configure it via Ruby." |
| Sidekiq. | "Sidekiq.server? will return false because this is not a Sidekiq process but configure_server callbacks will still be run so gems can install their middleware and extensions." |
| Graceful restarts | "Graceful restarts (a Sidekiq Enterprise feature) are not supported because we do not have full control of the process." |
| Puma phased restart | "Embedding does not currently work with Puma's phased restart feature." |
What should a Sidekiq job look like?#
Give a job small, simple arguments, and write it so it can safely run more than once. The Sidekiq wiki page on job design gives these as rules for Sidekiq jobs in general. It says: "Sidekiq persists the arguments to perform_async to Redis as JSON."
| Point on the page | The page's words |
|---|---|
| Simple identifiers | "Don’t save state to Sidekiq, save simple identifiers." |
| JSON datatypes | "The arguments you pass to perform_async must be composed of simple JSON datatypes: string, integer, float, boolean, null(nil), array and hash." |
| Idempotent jobs | "Idempotency means that your job can safely execute multiple times." |
| Retries | "with the error retry functionality, your job might be half-processed, throw an error, and then be re-executed over and over until it successfully completes." |
| Exactly once | "Sidekiq makes no exactly-once guarantee at all." |
| Completed jobs | "Even a job which has completed can be re-run." |
| Concurrency | "Sidekiq is designed for parallel execution so design your jobs so you can run lots of them in parallel." |
The Gnar Company's engineering post Useful Sidekiq Patterns lists "keeping your workers idempotent" among the patterns that make it "possible to create very resilient and well-organized worker classes."
What changed in Sidekiq after 7.0?#
Since 7.0, Sidekiq has changed how embedded instances behave, added iterable jobs in 7.3.0, and moved to 8.0 in March 2025. Sidekiq 8.1.7, published August 17, 2026, is the newest version on RubyGems as of November 18, 2026. Sidekiq 8.0.0 came out on March 5, 2025, and the Changes.md file lists a line for each release below. The 7.0.1 and 7.0.3 lines are about embedding. The 7.3.0 line adds iterable jobs. The Sidekiq wiki's Iteration page says: "Starting with v7.3, Sidekiq allows jobs to declare themselves as Iterable. This means that the job can be decomposed into a sequence of elements to process; Sidekiq can stop and restart the job anywhere within this sequence using a cursor."
| Version | Published on RubyGems | A line from Changes.md |
|---|---|---|
| 7.0.0 | October 27, 2022 | "Embedded mode!" |
| 7.0.1 | November 4, 2022 | "Allow an embedding process to reuse its own heartbeat thread" |
| 7.0.3 | January 11, 2023 | "Don't allow Quiet/Stop on embedded Sidekiq instances" |
| 7.3.0 | July 1, 2024 | "Add Sidekiq::IterableJob, iteration support for long-running jobs." |
| 8.0.0 | March 5, 2025 | "The created_at, enqueued_at, failed_at and retried_at attributes are now stored as epoch milliseconds, rather than epoch floats." |
| 8.0.7 | August 8, 2025 | "Provide a Plain log formatter which does not colorize output" |
| 8.1.7 | August 17, 2026 | "Many minor fixes and test improvements" |
The Sidekiq README lists these requirements: "Redis: Redis 7.0+, Valkey 7.2+ or Dragonfly 1.27+" and "Ruby: MRI 3.2+ or JRuby 9.4+."
rubyfmt#
A recent tweet mentioned that 100% of Stripe's Ruby codebase was autoformatted using rubyfmt, a newcomer to the autoformatting space. We love using tools like Prettier that help to keep our JavaScript code styles clean and consistent but the Rubyists on the team have yet to find something comparable. Could this be it??? 🤞
How do you install and run rubyfmt?#
Install it with brew install rubyfmt, then run rubyfmt -i myfile.rb to format a file in place. The project now lives in the rubyfmt repository on GitHub, and its latest release is v0.14.1, published May 28, 2026. The old penelopezone address redirects there.
The README also gives build steps: "Make sure you have Cargo installed", "Run cargo build --release", and "Copy target/release/rubyfmt-main to somewhere on your path as rubyfmt".
| Command | What the README says it does |
|---|---|
| rubyfmt file.rb | "Output formatted code to stdout" |
| rubyfmt -i file.rb | "Format file in place" |
| rubyfmt -c file.rb | "Show diff of changes" |
| cat file.rb | rubyfmt | "Read from stdin" |
The README says a .rubyfmtignore file "uses the same syntax as .gitignore". For editors, the README says "The popular ruby-lsp extension has a rubyfmt add-on", and it says to install that add-on with gem install ruby-lsp-rubyfmt-formatter before adding "rubyLsp.formatter": "rubyfmt" to .vscode/settings.json.
The State of Frontend 2022#
You don't have to scroll far to see the reason why I thought this front-end-focused article was interesting: 3,703 surveys, 125 countries, 19 front-end experts. This report provides some interesting insight into the developer's favorite (and least favorite) frameworks, libraries, static-site generators, hosting services, and more.
Anchor Links and Sticky Headers#
Easily add smooth scrolling to internal anchors with the CSS property scroll-behavior. You may still need to reach for scrollTo for complete browser support. This is a great way to progressively enhance your project while still being able to keep accessibility concerns in mind with the CSS "prefers-reduced-motion" fallback.
How do you keep a sticky header off an anchor target?#
Set scroll-padding-top on the scrolling element. MDN says scroll-padding-top allows "the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars)." MDN defines its value as "An inwards offset from the top edge of the scrollport, as a valid length or a percentage." Its syntax examples include scroll-padding-top: 10px and scroll-padding-top: 1em.
The Go Make Things article is from March 4, 2020. It says: "And yesterday, we looked at how to prevent anchor links from scrolling behind it with the scroll-margin-top property." It also says: "When using scroll-behavior, you should add a @media check for prefers-reduced-motion: reduce, and revert to the default auto."
| Property or feature | MDN's words |
|---|---|
| scroll-behavior | "sets the behavior for a scrolling box when scrolling is triggered by the navigation or CSSOM scrolling APIs" |
| scroll-padding- | "defines offsets for the top of the optimal viewing region of the scrollport" |
| scroll-margin- | "defines the top margin of the scroll snap area that is used for snapping this box to the snapport" |
| prefers-reduced- | "Indicates that a user has enabled the setting on their device for reduced motion." |
MDN's scroll-behavior page adds a caveat: "User agents are allowed to ignore this property."
Generator Functions in JavaScript#
This mind-bending JS blog article describes an aspect of the language that I had never directly come across: Generator functions. This post dives deep into when you might want to use these low-level features, but also stresses that you may not need to, coming at the reader with a genuine interest in making them more fully aware of the tools at your disposal. A great read for those looking to work with large data sets or those who just want to better understand the tools they work with.
What does a JavaScript generator function return?#
Calling a generator function returns a Generator object. MDN's function* page says: "Each time a generator function is called, it returns a new Generator object, which conforms to the iterator protocol." It defines the idea this way: "A generator function can be exited and later re-entered, with its context (variable bindings) saved across re-entrances."
| Method | What MDN says it does |
|---|---|
| next() | "Returns a value yielded by the yield expression." |
| return() | "Acts as if a return statement is inserted in the generator's body at the current suspended position" |
| throw() | "Acts as if a throw statement is inserted in the generator's body at the current suspended position" |
MDN also says: "Generator functions do not have arrow function counterparts."
In the article this tip links, J. R. Sinclair writes: "the most immediate and obvious application is to make lazy iterators." This post's point about large data sets matches his line: "We can, for example, process large data sets by loading one item at a time into memory." His list of uses also includes "Passing messages between two functions."
react-use#
The react-use library is a collection of React hooks, sometimes referred to as "the lodash of hooks". There are all sorts of helpful hooks in this npm package from common use cases such as setting the page title/favicon and throttling/debouncing to less common use cases such as vibration controls, geolocation tracking, and video/audio playback. If you've ever wondered, "I wish there was an easy way to [know when a user is idle|check network state|detect a long press/click|etc]" then chances are this package can help!
Which react-use hook does each task?#
Each task this tip names maps to a hook in the react-use README, such as useTitle for the page title and useIdle for an idle user. Install it with npm i react-use. npm lists 17.6.1, published June 10, 2026, as the latest version.
| Task in this post | Hook | The README's words |
|---|---|---|
| Page title | useTitle | "sets title of the page" |
| Favicon | useFavicon | "sets favicon of the page" |
| Throttling | useThrottle and useThrottleFn | "throttles a function" |
| Debouncing | useDebounce | "debounces a function" |
| Vibration | useVibrate | "provide physical feedback using the Vibration API" |
| Geolocation | useGeolocation | "tracks geo location state of user's device" |
| Video | useVideo | "plays video, tracks its state, and exposes playback controls" |
| Audio | useAudio | "plays audio and exposes its controls" |
| Idle user | useIdle | "tracks whether user is being inactive" |
| Network state | useNetworkState | "tracks the state of browser's network connection" |
| Long press | useLongPress | "tracks long press gesture of some element" |
The README describes the library as "Collection of essential React Hooks". It sorts its hooks under Sensors, UI, Animations, Side-effects, Lifecycles, State and Miscellaneous.
The State of GraphQL 2022#
Yeah, that's right, two "The State of…" articles in this issue. 😉 It's just that time of year. This one, in particular, stood out because not only was it chock full of cool things about GraphQL, but it was also a joy to interact with from a UX perspective. The report contains information on demographics, features, libraries, usage, and more. I've just recently started interacting with Shopify's GraphQL API and the biggest takeaway from this survey is that I have only scratched the surface!
Are there newer editions of the two surveys?#
The State of Frontend has a 2024 report from The Software House. The State of GraphQL site still lists 2022 under "Most Recent", as read on November 18, 2026.
The link in this post's State of Frontend tip now opens the 2024 report. The 2022 report is at tsh.io/state-of-frontend-2022.
| Measure | 2022 report | 2024 report |
|---|---|---|
| Edition | Second | Third |
| Countries | 125 | 139 |
| Experts | 19 | 23 |
The 2022 column matches the tip's "3,703 surveys, 125 countries, 19 front-end experts". The 2024 report's subhead reads "The third edition of the biggest frontend report." The 2022 GraphQL report says: "Over 3,000 developers took part this year".
Contributors:#
- Alex Jarvis
- Ethan Fertsch
- Mike Stone
- Royce Threadgill
- Steve Meisner
Learn more about how The Gnar builds software.


