The ActiveRecord query cache can defeat effective garbage collection when working on big batches of data. Disabling it entirely in background jobs can be a solid memory consumption win. Here's how to do it:
class SidekiqArCache def call(worker, msg, queue) ActiveRecord:: . . .
If you have various projects which used either "main" or "master" as the main branch, and also have a remote which uses the other naming (e.g. heroku or another PaaS), you might find yourself accidentally switching to the wrong branch name and working on it. Here's how to inhibit that.
Put this in . . .
Thread has two interesting settings related to behavior when an error happens:
There are a few good articles out there about this, but a couple things gets overlooked a bit:
- behavior which depends on if a thread is
joined or not
- the interaction of the two settings . . .
to improve garbage collection
Here's something about memory in Rails background jobs that I sort of encountered over the years but only recently fully figured out. I'll jump straight to the point.
The rails query cache causes ruby to be less effective at garbage collection. This is an acceptable tradeoff in web processes which do not run for a long time . . .
In a discussion recently someone was asking for feedback on how to go about expanding a system to cover more use cases without clumsily breaking the abstraction. I had these thoughts:
Maybe questions to ask are:
- How easy is this to change later?
- How easy is this for others to use?
- Are there any fundamental . . .
For example, to cover pg_search queries
I recently did a big cleanup of how fonts are used on a project. Here's a quick rundown of some things I learned along the way. Each building block is pretty straightforward and easy to find documentation for, but overall best practices, and explanations for how it all comes together, are lacking, so hopefully this guide will fix that . . .