|Название: Ruby on Rails Background Jobs with Sidekiq: Run Code Later without Complicating Your App
Автор: David Bryant Copeland
Издательство: The Pragmatic Programmers
Год: October 2023 (Version: P1.0)
Формат: pdf, epub, mobi
Размер: 10.2 MB
Sidekiq is a reliable, well-supported, high-performing way to run code in the background of any Rails app. This book will give you a solid, practical foundation for creating resilient, well-tested, self-healing code that uses background jobs. You'll be able to simulate real-world failure modes and learn how to write idempotent code that can be safely run with Sidekiq. Whether you need to offload slow code out of a controller action, or make a flaky API call more fault tolerant, Sidekiq is the way to do that.
One of the best ways to improve your Rails app's performance is to use background jobs with Sidekiq. While Sidekiq is easy to get set up, you need to do more than just move code around to reap the benefits. In this book, you'll get solutions to what sort of code should go into a Sidekiq job and how to manage those jobs.
Even though you just need a few lines of code to run a Sidekiq job, there is quite a bit of complexity hiding in the shadows. A Rails app with Sidekiq jobs is really a distributed system. It has all the same challenges as a massive microservices-based architecture. Your jobs will fail and you need to know when they do. Your code will need to evolve to allow these failures to self-heal, and this requires shedding some naivete about software design.
You'll create a Sidekiq configuration that will serve as a solid foundation for your app, including how to be notified when jobs inevitably fail. You'll then tame alerting fatigue by designing idempotent jobs that can be safely retried in the face of the types of transient failures that are common in networked applications, all without alerting you until action is needed. With that foundation, you'll get a conceptual framework for general monitoring and alerting around your Sidekiq installation and the Redis database it uses, as well as practical tips for organizing the code around your Sidekiq jobs. You'll also learn valuable testing strategies for code that uses Sidekiq jobs.
In no time at all you'll build a Rails app using Sidekiq that is efficient, manageable, and sustainable.
What You Need:
You should have some experience with Ruby and Rails. You should have a basic understanding of what a background job is. You'll need to be able to run Docker in order to set up all the software.
Скачать Ruby on Rails Background Jobs with Sidekiq