Our #devs
channel is a cross-project, shared space where the entire dev team of SINAPTIA can ask questions, share opinions, and discuss interesting articles or tech they come across. The idea is to post a curated extract of what happens there every week.
On Rails Performance
Last week, we discussed Rails performance extensively due to some work we’re doing on one of our client’s Ruby on Rails applications. Fernando shared an article about DHH’s take on N+1 queries: “N+1 is a feature”. Used with a Russian doll caching setup, it could be even more performant than eager loading. The topic is a bit controversial, as DHH’s opinions usually are, but we found the thought exercise fruitful. Both problems (eager loading and caching) are challenging, and there’s no single correct solution; each particular case must be thoroughly evaluated.
In relation to this, Fernando also shared a tweet by Nate Berkopec, which is related to having an app full of unoptimized code hidden behind layers of cache. This is a risky spot to be in! Say goodbye to your app if your Redis instance goes down 🙃
Fernando shared this Reddit post where the maintainer of Pitchfork answers why he forked Unicorn instead of using Puma at Shopify. Super interesting thread, full of first-hand information and technical details behind the app server that supports one of the biggest Rails apps in the world. Go get a quick read if you haven’t.
Patricio shared a post by tenderlove on Ruby’s memory allocations. As is usual with Tenderlove’s posts, this one is super rich and well-explained. It also delves into tiny technical details about the inner workings of the Ruby VM and garbage collector. Super interesting!
Rails World
We watched DHH’s opening keynote and commented on our excitement for Rails 8, especially regarding the simplicity of deploying simple apps to a VPS. We also discussed SQLite’s performance and the challenges of maintaining a Rails app using SQLite. Fernando shared an article about tuning SQLite for better performance.
Dev Containers
Patricio opened up a pull request in rails/devcontainer. The pull request introduces a new devcontainer feature to provide a bundler cache, speeding up the startup of dev containers using it.
The good news: It has been merged! Props to Patricio 👏🏻
Audited Gem
Nazareno asked if it was possible to add custom attributes to audited’s Audit model. He got it working by monkey-patching the Audit model but wanted to know if there was a better alternative. After discussing various alternatives with Fernando and Patricio, he decided to open up this pull request to address this issue.
Well done, Naza!
That’s it for this issue. See you around next week!