GitHub: Our upgrade to programming language Ruby 2.7 fixes over 11,000 issues

If you have doubts about upgrading a big web app to Ruby, GitHub says cast them aside. But be ready for difficulties.

GitHub's transparency report: How and when it removes or block content

Microsoft-owned online code-hosting service GitHub has detailed its massive upgrade to version 2.7 of the Ruby programming language, which it deployed to production in July after a months-long project to prepare for it.

The move to Ruby 2.7 sets the stage for GitHub to run 'deprecation free' and removes obstacles to future upgrades as they become available. Ruby 2.7 was released last December and precedes Ruby 3, the next major upgrade that's scheduled for release later this year. 

GitHub is one of the largest websites built on Ruby and the online git version-control service is recommending that others make the leap to Ruby 2.7 too, despite the challenges of laying the groundwork for the upgrade. 

SEE: Hiring Kit: Python developer (TechRepublic Premium)

"Ruby 2.7 is a unique upgrade because the Ruby Core team has deprecated how keyword arguments behave," explains GitHub's Eileen Uchitelle. 

"With this release, future versions of Ruby will no longer accept passing an options hash when a method expects keyword arguments. At GitHub, we're committed to running deprecation-free on both Ruby and Rails to prevent falling behind on future upgrades."

But to achieve deprecation-free status in Ruby 2.7, GitHub needed to fix over 11,000 issues or Ruby warnings across 40 teams, including warnings that were caused by external software libraries, which required dozens of updates to the Ruby Gems package manager for add-ons in Ruby. 

Uchitelle notes that GitHub's Ruby application consists of over 400,000 lines of code, which necessitates several hundred pull requests per day. To make upgrades easier, GitHub engineers set up the application to be dual-bootable in Ruby 2.6 and Ruby 2.7. 

"This made it easy for us to make backwards-compatible changes, merge those to the main branch, and avoid maintaining a long running branch for our upgrade," she notes. 

Then came the challenge of ensuring the warnings were collected and managed to allocate fixes among its various engineering teams. Once the issues were addressed, affected teams were given directions for booting the application in Ruby 2.7.  

"After a few months, coordinating with 40 teams, 30+ gem upgrades, and 11,000 warnings our CI (continuous integration) build was 100% warning-free. Gems that were unmaintained were replaced with maintained gems. Once we had fixed the warnings, we altered our monkey patch to raise errors in Ruby 2.7, which ensured that all new code going into the GitHub codebase was warning-free," explains Uchitelle. 

Uchitelle assures developers using Ruby that the upgrade to Ruby 2.7 is worth it, claiming to have seen an "impressive" improvement in performance while the Ruby Core team looks set to deliver three times faster performance in Ruby 3. So it's worth doing the upgrade just to remove obstacles to that release. 

SEE: Microsoft to developers: These are our biggest and best open-source projects

GitHub has seen its application boot time in production mode fall from 90 seconds to around 70 seconds, which improves deployment times and gives access to features and bug fixes too. 

"In addition to an improvement in boot time, we saw a decrease in object allocations which went from ~780k allocations to ~668k allocations," she notes. 

"For any companies that are wondering if this upgrade is worth it the answer is: 100%. Even without the performance improvements, falling behind on Ruby upgrades has drastic negative effects on the stability of your codebase. Upgrading Ruby supports your application health, improves performance, fixes language and framework bugs, and guides the future of the language."

For those interested in more details about the upgrade, Uchitelle has outlined some key tips for those considering Ruby upgrades and upgrades to the Ruby on Rails web application framework.