Patching Rails Performance
06 Aug 2015In a recent patch we improved Rails response time by >10%, our largest improvement to date. I’m going to show you how I did it, and introduce you to the tools I used, because.. who doesn’t want fast apps?
In a recent patch we improved Rails response time by >10%, our largest improvement to date. I’m going to show you how I did it, and introduce you to the tools I used, because.. who doesn’t want fast apps?
It started screaming for life. Sucking in air and yelling out with a beautiful pain. I couldn’t stop smiling.
Every program wants to live forever. What happens when a program is forced to exit before it’s done running, and why would we want to do that?
I’ve never met a developer who complained about code getting faster or taking up less RAM. In Ruby, memory is especially important, yet few developers know the ins-and-outs of why their memory use goes up or down as their code executes. This article will start you off with a basic understanding of how Ruby objects relate to memory use, and we’ll cover a few common tricks to speed up your code while using less memory.
When we moved into our house on the East Side, the interior walls were all supported by 1 inch thick long leaf pine. A builder looking at the material during a site visit casually mentioned he would make something out of it. This peaked my interests and set me down my recent woodworking path. The only problem was that I didn’t have many tools.
“Why exactly is RubyGems slow?” is the question that more than one developer has asked, but few have bothered to do anything about. Recently @mfazekas took up the task for profiling an especially slow case using dtrace. This resulted in several high profile pull requests to improve performance and drop memory allocations. These in turn lead me to ask the question, just what is Rubygems doing that takes so long? The short answer is, way more than you ever thought; for the long answer, keep reading.
I first started getting casual emails “we’ve been looking over your GitHub and we are impressed” and it was validation for me. I enjoyed the attention. It made me feel powerful. I eventually realized that more than a few of those emails came from bots. It was algorithmic, robotic attention. But so what? It still felt good. Occasionally I would get an email from a startup CEO that was personalized beyond a doubt with calls out to specific things I had done. That felt better. Over the years though, these messages went from uplifting, to annoying. These recruiters wanted something from me, they wanted me. But what did I want?
This month marks my third year anniversary with Heroku. It’s the longest I’ve worked at a single company and has been the greatest single career move I’ve made to date.
What is symbol GC and why should you care? Ruby 2.2 was just released and in addition to incremental GC, one of the other big features is Symbol GC. If you’ve been around the Ruby block, you’ve heard the term “symbol DoS”. A symbol denial of service attack occurs when a system creates so many symbols that it runs out of memory. This is because, prior to Ruby 2.2, symbols lived forever. For example in Ruby 2.1:
Debugging a large codebase is hard. Ruby makes debugging easier by exposing method metadata and caller stack inside Ruby’s own process. Recently in Ruby 2.2.0 this meta inspection got another useful feature by exposing super method metadata. In this post we will look at how this information can be used to debug and why it needed to be added.