Why this is one of the best alternatives to Ruby on Rails

Sep 8 | Henrique F. Teixeira

If you are a Ruby dev thinking about building a new project and looking for alternatives to Rails, whether for performance or architecture reasons, consider the Roda framework.

Roda was created by Jeremy Evans, a Ruby core committer and one of the most influential developers in the community, and in my opinion, it is the most well-written framework considering the language's characteristics: it takes advantage of syntax and metaprogramming in an intelligent yet simple way while delivering extreme productivity, extensibility, and high performance.

In this article, I explain why.

Performance

When Ruby was created by Yukihiro Matsumoto (known as "Matz") in 1993, the primary goal wasn't maximum performance, but rather to make software development more pleasant and efficient, which translates to:

  • Expressive and readable syntax.
  • Less code to solve problems.
  • Preference for productivity and maintainability over raw performance.

Today, more than 30 years later, we can say that Matz achieved (and continues to achieve) his goal, with strong adoption among high-growth startups, especially through Ruby on Rails.

However, in exchange for these benefits, the language brings a few important limitations:

  • CPU: Ruby is an interpreted, highly dynamic language. Methods can be redefined at runtime, classes can be modified at any time, and method call resolution happens in a more complex manner than in statically compiled languages. Modern Ruby's JIT (YJIT) has improved the scenario significantly, but Ruby still tends to be noticeably slower in CPU-intensive tasks.

  • Garbage Collector: Ruby uses a relatively advanced generational and incremental GC (Garbage Collector), but collection pauses can still impact latency. Applications with many object allocations can spend a considerable portion of their time running the GC instead of business logic.

  • Memory fragmentation: Even after the GC frees objects, the Ruby process doesn't always return this memory to the operating system efficiently. In long-running applications, it is common to observe gradual growth in memory consumption.

In summary, a Ruby system with many abstractions, allocated objects, and metaprogramming can end up costing more and requiring more hardware.

With that in mind, let's compare a few frameworks. I used the ObjectSpace class to identify how many objects are created in a Ruby web application, comparing Rails ("minimal" mode), Hanami, and Roda generated with roda-project (the fastest way to create a fullstack Roda application with several plugins enabled). This means I compared 3 tools that include equivalent functionality—not just a routing system—and even gave Rails an advantage by using its lightest mode.

For each of these applications, I added a /home/index route and a view with the following code:

<% @objects = ObjectSpace.count_objects %>
Total (slots): <%= @objects[:TOTAL]  %>
Free (free slots): <%= @objects[:FREE] %>
Objects (active objects): <%= @objects[:T_OBJECT] %>

To make the tests a bit more realistic, I also sent a heavy load of requests to the endpoints using Apache Benchmark (ab), and for each one I used Puma with 1 worker and 3 threads.

These were the results:

  • Rails (minimal): Total: 409268, Free: 47989, Objects: 25264
  • Hanami: Total: 346016, Free: 47648, Objects: 10682
  • Roda (with roda-project): Total: 239621, Free: 14515, Objects: 7661

In memory (verified with top -p), these allocated objects represented:

  • Rails (minimal): 222MB
  • Hanami: 139MB
  • Roda (with roda-project): 136MB

And here is the number of requests per second:

  • Roda (with roda-project): 939.89rqs
  • Hanami: 376.38rqs
  • Rails (minimal): 242.81rqs

With simple logic, we can translate these benchmark results into money spent: Imagine we have the same application from the benchmark running for multiple users and currently spend $3000 on servers using Ruby on Rails. We would spend approximately $1937 if we were using Hanami, and only $775 using Roda. Of course, this is a simplistic and hypothetical example; performance can vary drastically depending on the code we write and the problem we're solving. Furthermore, the database is usually the biggest performance offender in web applications.

But we can't deny one fact: Roda is the framework that delivers more with less when it comes to memory and performance, and much of this is due to its architecture and routing system:

  • Request evaluation stops at the exact moment the path matches its corresponding block.
  • Internal caching ensures minimal overhead (precompiled templates, lookup tables for static routes, app freezing).
  • No heavy metaprogramming: Many frameworks use method_missing or define methods dynamically at runtime, which degrades performance.

Check out the benchmarks on techempower.com as well, where Roda consistently ranks among the top-performing frameworks in the Ruby ecosystem.

Plugins / Extensibility

Roda was designed around an extremely simple and predictable plugin system.

Unlike other frameworks that expose dozens of extension points scattered across callbacks, middleware, generators, and conventions, Roda concentrates practically all of its extensibility into plugins that explicitly modify the application class.

When we write:

class App < Roda
  plugin :render
  plugin :json
  plugin :all_verbs
end

Each plugin adds methods, behavior, or features directly to the application. There is no hidden magic. You can trace exactly where each functionality came from.

Another important aspect is that Roda's core is extremely small. Routing—the framework's main responsibility—remains separated from additional features. This allows features such as rendering, authentication, sessions, caching, CSRF, JSON, and others to be implemented as independent plugins without increasing core complexity, while also ensuring our application doesn't waste resources on features we won't use.

Finally, Roda's plugin system is used by the framework itself. Many features considered "native" are implemented in the exact same way as plugins created by users. This is the sign of an extensible architecture: the mechanisms used internally are the same ones available to application developers.

See how simple it is to create plugins for Roda by following the steps described in the repository: github.com/jeremyevans/roda#label-Plugins

Productivity

Despite being an apparently "small" framework, when analyzing the amount of native plugins and plugins provided by the community, we have enough resources available to make it similar to Rails in features and build any type of application.

There are more than 100 official plugins listed in the official documentation, including essentials like:

  • CSRF
  • Sessions and Cookies
  • I18n
  • Views / Rendering
  • Hooks
  • Logs
  • Email delivery

Furthermore, among the alternatives to Rails, Roda is the only framework that has its own robust authentication gem. The rodauth gem adds an extremely complete and secure authentication system to our app, packed with features such as:

  • Account management
  • Password recovery
  • JWT
  • SMS codes / Recovery codes
  • Passwordless Authentication

To make creating and developing new applications easier, we have the roda-project gem, which provides a modern scaffold for Roda applications, including generators and several essential tasks, bringing the development experience close to Rails.

It's also worth highlighting that the entire Ruby gem ecosystem is at our disposal for whatever we need, including sidekiq, dry-rb, rom, async, etc.

Maturity

Roda has been around for over 10 years and has more than 20 million downloads. The framework is a solid choice for companies already using Ruby that want to extract maximum performance with low memory consumption. Currently, major projects use the framework in production, notably Ubicloud. In addition, Jeremy Evans's work is well known for his zero-tolerance policy for bugs and fast responses on GitHub. Bug fixes and security releases typically arrive in extremely short timeframes, ensuring a dependable codebase.

Conclusion

For a long time, the community lived with the premise that development velocity in the Ruby ecosystem required an inevitable sacrifice: high infrastructure consumption, heavy processes, and a lot of "magic" behind the scenes. Roda completely deconstructs this idea, representing a paradigm shift and uniting what previously seemed impossible in the Ruby world: the expressiveness and productivity we love, with real server savings and high-level performance.

If Rails was the tool that popularized Ruby by allowing businesses to be built quickly, Roda is the mature answer for modern software engineering—and when I say engineering, I don't mean "layers upon layers" of abstraction; I mean solving problems with the right tools in an intelligent way, selecting and using only what is necessary while maintaining simplicity and maintainability (without "overengineering" or "underengineering").

Hey, what did you think of this article??

Share and give your opinion by clicking on one of the networks below:


Thank you very much!