WorkerKiller

Resource and / or memory leaks and fragmentation are common problems in all programming languages. It doesn't matter if there is a garbage collector there or not, a compiled language or an interpreted one. Ruby is no exception, and today we will talk a little about these problems, options for solving them, and even write our own.





The problem can and does appear when we have a process running for a long time and doing a lot of different work. Most of these problems are related to errors in the code, whereby the code continues to perform its business function quite correctly. They are not always easy to find and fix. But memory fragmentation awaits us a little from the other side, and even correct code can gradually accumulate fragmented memory. In the world of Rails processes that fall under the category of "long-playing" are, in fact, a web server and various management background / pending tasks -β€Š DelayedJob



, Sidekiq



etc. That's about them and then we'll talk..





Web server

β€œβ€ . /, (puma, unicorn), Phusion Passenger . β€œβ€ -, Rails-. , :





, β€œβ€ β€Šβ€”β€Š . β€Šβ€”β€Š β€Šβ€”β€Š. β€Šβ€”β€Š Passenger Enterprise .





 

- , DelayedJob



, ActiveJob



( β€œ ” ). β€Šβ€”β€Š β€Šβ€”β€Š . Sidekiq



, DelayedJob



!





- DelayedJob



WorkerKiller



β€Šβ€”β€Š!





?

middleware



, , .





CPU, . β€Šβ€”β€Š , , , β€œ"β€Šβ€”β€Š Limiter



.





β€Šβ€”β€Š Killer



. unicornβ€Š



β€”β€Š SIGTERM. β€Šβ€”β€Š , Passenger Master Process . , , β€œinflight” . , :





passenger-config detach-process <PID>
      
      



, 500 , 100. Passenger β€Šβ€”β€Š -, , .





!





-, , , - DelayedJob



. , , .





!









? WorkerKiller ? , . β€Šβ€”β€Š , , , . β€Šβ€”β€Š , .





Band-Aid on a bullet wound
Band-Aid on a bullet wound





, :





  • Giltab Unicorn killer





  • Gitlab Sidekiq killer





  • Killer puma





  • How to count memory in Linux β€Š- only for real men





  • Killer for unicorn β€Š- he was the first!





  • How to debug Ruby leaks








All Articles