Django vs Rails in production: performance, hosting and hiring in Ireland, the UK, Germany and Austria

TL;DR

Difficulty: Intermediate

Both frameworks are fast enough: in the most realistic public benchmark Rails and Django finish level, and a business application like a six workshop repair chain needs about 10 requests a second at its busiest.

  • Request time goes to database queries, outside services and code habits. Fixing N + 1 queries, moving slow calls into background jobs and caching beat a faster interpreter by about five to one.
  • Ruby 3.3 YJIT and the faster CPython help, but only on the share of time spent running language code (Amdahl's law).
  • Both run on the same servers and platforms. Rails 7.1 ships a production Dockerfile and Kamal exists for deployment, Django gives you a checklist and Gunicorn or Uvicorn.
  • Hiring: Python outnumbers Ruby 5 to 11 times, but Django outnumbers Rails only 1 to 3 times, and in Ireland the two frameworks are nearly level. Count the framework, not the language.

Once the philosophy is settled, three practical questions remain: is one faster, is one easier to run, and can I hire for it where I live? Here are the answers with the arithmetic shown, worked through on an invented chain of bicycle repair workshops in Limerick, with developer numbers for Ireland, the UK, Germany and Austria.

The question, and the short answer

Three questions come up in every framework decision once the philosophy is settled. Is one of them faster? Is one of them easier to run in production? And will I be able to hire for it, here, in my country?

The short answer is that both Django and Ruby on Rails are fast enough for nearly every business application, both run on the same kinds of servers, and the hiring picture is closer than the language statistics suggest. The long answer is more useful, because it tells you where speed really comes from, what each framework needs around it in production, and which numbers to look at when you hire. That is this article.

I build web applications on Ruby on Rails, so I have a side. Everything below that is not my opinion is sourced, and where I give a view I mark it as mine. The comparisons are meant to be ones a senior Django developer would sign off.

Throughout this series I use one invented business. Freewheel Cycles is a chain of six bicycle repair workshops in Limerick (freewheelcycles.example), founded by Niamh. It has 38 mechanics, about 1,150 repair bookings a week and 9,000 active customers, and it is replacing its spreadsheets and a rented booking widget with its own web application. Its two developers are Aisling, who has four years of Python, and Cian, who has three years of JavaScript and TypeScript. Neither has used Ruby. They are building a two week spike of the core in both frameworks before they choose. If you have not read them yet, the two answers to the same question sets out the philosophies, and where each framework shines covers the strengths. This chapter is about what happens once the thing is live.

Ten requests a second is the number that matters

Most performance arguments about frameworks skip the first step: working out how much load the business will actually put on the application. Once you do that sum, most of the argument dissolves. A typical small or medium business application needs single digit or low double digit requests per second at its busiest. Framework benchmarks talk about thousands. That gap decides how many processors you rent. It almost never decides whether the product works.

A request is one call from a browser or an app to the server: loading a page, submitting a form, moving a job card. Requests per second is the rate at which they arrive. To estimate it, you start from the business numbers and convert them step by step.

Example: sizing Freewheel Cycles' busiest hour

Freewheel's numbers are fixed: about 1,150 bookings a week, and 30% of the week's online bookings arrive between Friday 6pm and Saturday noon. That window is 18 hours long. Bookings do not arrive evenly inside it either, so I assume the busiest single hour carries three times the window's average. That factor is my assumption for the example, labelled as such.

Foundations: ratios and rates

bpeak=B×p×kTb_{peak} = \frac{B \times p \times k}{T}

where BB is bookings per week (1,150), pp is the share that arrives in the peak window (0.30), TT is the length of that window in hours (18) and kk is the peak hour factor (3, assumed). So:

bpeak=1150×0.30×318=57.5 bookings in the busiest hourb_{peak} = \frac{1150 \times 0.30 \times 3}{18} = 57.5 \text{ bookings in the busiest hour}

Bookings are not requests. Each booking comes with browsing that does not end in a booking, and each visit makes several requests. I assume one visit in five ends with a booking (v=5v = 5 visits per booking) and that a visit makes 12 requests the application itself has to answer (r=12r = 12), not counting images, stylesheets and scripts, which a web server or content delivery network serves without touching Rails or Django. Both are assumptions for the example.

Staff use the application too. On a Saturday morning the 38 mechanics and, say, one manager in each of the six workshops (44 people, s=44s = 44) move job cards, open them and upload photos. I assume each of them makes one request every 20 seconds (ts=20t_s = 20). Together, as rates added up (Foundations: ratios and rates):

λ=bpeak×v×r3600+sts\lambda = \frac{b_{peak} \times v \times r}{3600} + \frac{s}{t_s}

where λ\lambda is requests per second, 3,600 is the number of seconds in an hour, and the other symbols are as above.

λ=57.5×5×123600+4420=0.96+2.2=3.16 requests per second\lambda = \frac{57.5 \times 5 \times 12}{3600} + \frac{44}{20} = 0.96 + 2.2 = 3.16 \text{ requests per second}

Then I add a safety factor f=3f = 3 for the bad Saturday nobody planned (a promotion, a sunny weekend after a wet month): λd=f×λ=9.5\lambda_d = f \times \lambda = 9.5, so I design for 10 requests per second.

The last step tells you how many requests are being worked on at the same moment. Little's law, a result from queueing theory that John Little proved in 1961, says the average number of items in a system equals their arrival rate times the average time each spends inside it1. The arithmetic is the same rates and ratios as above (Foundations: ratios and rates):

L=λd×WL = \lambda_d \times W

where LL is the number of requests in progress at once, λd\lambda_d is the design rate (10 per second) and WW is the average time to answer one request. If a page takes 0.3 seconds on average, L=10×0.3=3L = 10 \times 0.3 = 3. At Freewheel's worst hour, with a safety margin on top, the server is working on about three requests at a time.

Three. Hold on to that number, because it turns the rest of the performance question from a matter of faith into simple arithmetic. If bookings grew to about 3,100 a week, every figure above grows by the same factor of 2.7, and the answer becomes about eight requests in progress at once. Still a small number.

What a benchmark measures, and what it does not

The best known public comparison of web frameworks is the TechEmpower Framework Benchmarks, an open source project that runs hundreds of frameworks through the same set of tests on the same hardware. Round 22 was published in late 20232.

The test closest to a real application is called Fortunes. Each request makes the framework fetch every row of a small database table through its object relational mapper (ORM, the layer that turns database rows into objects in your code), add one row in memory, sort the list and render it through an HTML template with proper escaping3. It touches the database, the ORM and the template engine, which is more than the "hello world" tests do.

Example: reading the Fortunes results with Freewheel's eyes

I read the published raw data for Round 22 and took the best result for each configuration across the concurrency levels tested. The run used TechEmpower's Citrine environment, dedicated servers with 28 hardware threads each4. The figures below are my own calculation from that file, requests completed divided by the 15 second test duration:

Configuration in Round 22 (Fortunes)Responses per second, best level
Rails with Puma and PostgreSQLabout 14,300
Django with Meinheld and MySQLabout 14,100
Rails with Puma and MySQLabout 14,800
Django with Meinheld and PostgreSQLabout 14,700
The fastest entry in the testabout 585,000

Three readings matter. First, in this test Rails and Django are level: the difference between them is smaller than the difference between two database choices for the same framework. Second, the fastest specialised frameworks are about 40 times faster than either, which is real and is the reason those frameworks exist. Third, and most important for Freewheel: even if a real booking page does 50 times the work of a Fortunes request, a Rails or Django process on that hardware would still answer hundreds of them a second. Freewheel needs 10.

The limits are just as clear. TechEmpower itself marks each entry as a realistic or a stripped implementation, and the Rails and Django entries above are the realistic kind, with the full ORM. A benchmark measures one tiny page under a load almost nobody has, written by people who tuned it carefully. It says nothing about your queries, your templates, your third party calls or the habits of your team. So I use it for one purpose only: to confirm that neither framework is slow in a way that matters at business scale. On that point the evidence is clear.

Where the time in a request really goes

If the framework is not the bottleneck, what is? Here is an illustrative breakdown of a page in Freewheel's application, the booking confirmation that a customer sees after choosing a slot. These numbers are invented to show the typical shape. They are not measurements, and your own application's profile is the only breakdown that counts.

An invented but typical breakdown of a 300 millisecond request: database queries 110 ms, calls to outside services such as payment and SMS 90 ms, template rendering 45 ms, application and framework code 35 ms, network and proxy 20 ms. Only the rendering and application code, 80 ms in total, depend on the speed of Ruby or Python. Tap or click to enlarge

Only two of those bars depend on how fast Ruby or Python runs: template rendering and the application code, 80 milliseconds of the 300. The database time depends on how many queries the page makes and whether they use indexes. The outside services depend on someone else's servers. The network depends on where things are hosted.

The most common way to waste database time has a name: the N + 1 query problem. The Rails Guides describe it with books and authors: load 10 books, then touch each book's author, and the application makes 1 query for the books plus 10 more, one per author, 11 in all5. The Django documentation gives the same advice in its own words and names the tools to fix it6.

Example: the workshop board that makes 121 queries

Freewheel's live workshop board shows every open job card in a workshop: waiting, in repair or ready. Each card shows the mechanic's name, the customer's name and the bike. On a busy Saturday a workshop has 40 open cards. Written naively, the board loads the 40 cards (1 query), then for each card loads its mechanic, its booking's customer and its bike (3 queries each, 120 in total). That is 121 queries for one page.

In Rails, the fix is to tell Active Record up front which associations the page will use. includes loads them in a handful of queries instead of one per card:

# app/controllers/boards_controller.rb
class BoardsController < ApplicationController
  def show
    @workshop = Workshop.find(params[:workshop_id])

    # One query for the cards, then one per association:
    # four or five queries in total, however many cards there are.
    @job_cards = @workshop.job_cards
                          .where(status: %w[waiting in_repair ready])
                          .includes(:mechanic, booking: [:customer, :bike])
  end
end

Rails also offers strict_loading, which makes a lazy load raise an error instead of quietly firing a query, so the problem shows up in development rather than on a Saturday5.

In Django the same fix uses select_related, which follows foreign keys with a SQL join in the same query:

# repairs/views.py
from django.shortcuts import get_object_or_404, render

from .models import JobCard, Workshop


def board(request, workshop_id):
    workshop = get_object_or_404(Workshop, pk=workshop_id)

    # One query with joins: mechanic, booking, customer and bike
    # arrive together with each card.
    job_cards = (
        JobCard.objects.filter(
            workshop=workshop,
            status__in=["waiting", "in_repair", "ready"],
        )
        .select_related("mechanic", "booking__customer", "booking__bike")
    )
    return render(request, "repairs/board.html", {"job_cards": job_cards})

For relations that point the other way, such as all the photos of a job card, Django uses prefetch_related and Rails uses the same includes. Both frameworks solve the problem completely and both make it easy to forget. The difference between 121 queries and four is far larger than any difference between the two languages.

Is it really the framework? A flow to find out

When an application feels slow, the framework is the last suspect, not the first. This is the order in which I look, and it applies to Rails and Django equally.

Tap or click to enlarge

Example: Niamh's slow Saturday

Niamh tells Aisling and Cian that the board "drags" on Saturday mornings. They walk the flow. They measure first: both frameworks log how long each request took, and a development tool (the Django Debug Toolbar, or the query log in the Rails development console) shows the queries per page. The board makes 121 queries, so they fix the N + 1 problem as above. They then notice that moving a card to "ready" sends the "your bike is ready" SMS inside the request, waiting on the SMS provider every time. That call moves into a background job, which the Rails series covers in its chapter on background jobs, email and files, and the Django series in its chapter on background tasks. The parts summary at the top of the board is recalculated on every request, so they cache it for a few minutes. After that the processors at peak are mostly idle, so the last two steps do not apply. The page is fast, and nobody touched the framework.

The languages got faster, and why it helps less than you think

Both languages have been getting markedly faster, and it is worth knowing how.

Ruby 3.3 was released on 25 December 2023. Its just in time compiler, YJIT (a compiler that turns frequently run Ruby code into machine code while the application runs), brings what the release notes call "major performance improvements over Ruby 3.2", uses less memory, and can now be switched on from inside the application with RubyVM::YJIT.enable7. Shopify's Ruby team, writing about their own benchmarks a few weeks before the release, report that railsbench, a benchmark built on a small Rails application, runs about 65% faster with YJIT, on a chart they normalise to the Ruby 3.2 interpreter8.

Python has had its own programme to speed up CPython, the standard Python interpreter. According to its release notes, Python 3.11 runs between 10 and 60% faster than Python 3.10 depending on the workload, and 25% faster on average on the standard benchmark suite9. Python 3.12, released on 2 October 2023, is the current version10.

In Rails 7.1, YJIT is not switched on for you. With Ruby 3.3 you can do it in one small initializer:

# config/initializers/enable_yjit.rb
# Ruby 3.3 can switch YJIT on at run time.
# The guard skips this on a Ruby that was built without YJIT.
if defined?(RubyVM::YJIT.enable)
  Rails.application.config.after_initialize do
    RubyVM::YJIT.enable
  end
end

On Python there is nothing to switch on: upgrading the interpreter is the whole step.

Example: what a faster interpreter does to Freewheel's page

The speed of the language only touches the part of the request that runs Ruby or Python code. This is Amdahl's law, named after Gene Amdahl's 1967 paper on the limits of speeding up only part of a job11. It is a weighted ratio of times (Foundations: ratios and rates):

S=1(1−p)+psS = \frac{1}{(1 - p) + \frac{p}{s}}

where SS is the speedup of the whole request, pp is the share of the request's time spent running language code, and ss is how much faster that part becomes.

On the illustrative confirmation page, language code is 80 of 300 milliseconds, so p=80/300=0.267p = 80 / 300 = 0.267. Take Python's average gain of 25%, so s=1.25s = 1.25:

S=10.733+0.2671.25=10.733+0.213=1.06S = \frac{1}{0.733 + \frac{0.267}{1.25}} = \frac{1}{0.733 + 0.213} = 1.06

The page goes from 300 to about 284 milliseconds. Take the larger railsbench figure, s=1.65s = 1.65: S=1/(0.733+0.162)=1.12S = 1 / (0.733 + 0.162) = 1.12, and the page drops to about 269 milliseconds. Now compare the fixes from the flow: cutting 121 queries to four might take the 110 milliseconds of database time down to 20, and moving the SMS out of the request saves most of the 90 milliseconds of waiting. That is more than 150 milliseconds saved by changing how the application is written, against 15 to 30 by changing the interpreter.

My view: take the free speed. Upgrade Ruby or Python when your framework supports the new version, switch YJIT on, and enjoy a lower server bill. But do not choose a framework for its language's interpreter, because the work you do in your own code moves the needle five times further.

The lock in both languages: the GVL and the GIL

Ruby and Python share a design decision that comes up in every performance discussion, often with more heat than light.

In standard Ruby (often called MRI or CRuby), a lock called the Global VM Lock (GVL) lets only one thread run Ruby code at a time inside a process. The Puma web server's own documentation explains the consequence plainly: threads still help, because while one thread waits for input or output, such as a database query or a call to an outside service, another thread can run12. In standard Python, the Global Interpreter Lock (GIL) does the same job. The Python documentation defines it as the mechanism that assures "only one thread executes Python bytecode at a time", and notes that the lock is always released during input and output13.

In plain words: within one process, Ruby and Python can wait for many things at once but calculate only one thing at a time. To use several processor cores for calculation, both run several processes side by side. That is exactly what their web servers do.

The Python Steering Council accepted PEP 703 in October 2023, a plan to make the GIL optional in a future version of CPython, with an explicitly gradual rollout14. For an application being built today, it changes nothing yet.

Example: why Freewheel's board waits rather than calculates

Back to the illustrative page. Of its 300 milliseconds, 220 are spent waiting: on the database, on outside services, on the network. During those 220 milliseconds the lock is released and another thread or process can work. Only 80 milliseconds need the processor. A web application like Freewheel's is mostly waiting, which is the situation in which both locks hurt least.

How each framework serves requests: Puma, Gunicorn and ASGI

A web framework does not talk to the internet by itself. An application server sits in front of it, takes requests and hands them to the framework, and a reverse proxy (usually Nginx) usually sits in front of that. Here the two ecosystems make different default choices.

Rails ships with Puma. A new Rails 7.1 application has a config/puma.rb that runs five threads per process by default, matching the default size of the Active Record database connection pool, and in production starts one worker process per physical processor unless you set WEB_CONCURRENCY15. Each worker process is a copy of the application with its own threads, so you get several processes (for the processor cores) each with several threads (for the waiting).

Django supports two interfaces to application servers. WSGI is the long established synchronous interface, and Gunicorn is a common server for it. Gunicorn's default worker handles one request at a time per process. Its documentation recommends starting with two workers per processor core plus one, and requires a buffering proxy such as Nginx in front of the default configuration, because slow clients could otherwise tie up its workers16. ASGI is the newer asynchronous interface. Django has supported async views and a fully asynchronous request stack under ASGI for several versions, with two caveats from its own documentation: any synchronous middleware brings back a thread per request, and database transactions do not yet work in async mode17. Django documents running under ASGI with Uvicorn, either alone or as a Gunicorn worker class18.

Example: the two servers for Freewheel's first production box

Say Freewheel runs one server with two virtual processors. For Rails, setting the two numbers explicitly is clearer than relying on detection:

# Rails: two Puma worker processes with five threads each,
# so up to ten requests in progress at once.
RAILS_ENV=production WEB_CONCURRENCY=2 RAILS_MAX_THREADS=5 bin/rails server

For Django under WSGI, the Gunicorn rule of thumb gives five workers:

# Django: five sync workers, (2 x 2 cores) + 1, listening only locally
# because Nginx in front of it buffers the slow clients.
gunicorn freewheel.wsgi:application --workers 5 --bind 127.0.0.1:8000

Compare both with Little's law from the sizing example: at the design load, about three requests are in progress at once. Puma offers ten slots, Gunicorn five. Both have room to spare, and on processor time the sums work too: 10 requests a second times 80 milliseconds of language code is 0.8 seconds of processor work per second, less than half of two processors.

One requirement differs, and it is worth seeing early: the live workshop board. Pushing updates to open browsers needs WebSockets, a connection that stays open so the server can send changes. Rails includes Action Cable for this, and a new Rails 7.1 application is configured to use Redis for it in production19. Django's core does not include WebSockets. The usual route is the Django Channels project, which needs Django to run under ASGI, and whose only officially maintained channel layer for production uses Redis as well20. A simpler alternative in Django is to poll the board every few seconds, which costs requests rather than infrastructure. Either way, the live board, not the framework's speed, is what adds a moving part to Freewheel's hosting.

Caching: the least expensive speed in both frameworks

Caching means keeping the result of expensive work so the next request can reuse it. Both frameworks have mature caching built in, at similar levels.

Rails offers fragment caching (wrapping part of a view in a cache block), Russian doll caching (fragments nested inside fragments, where updating one record only rebuilds its own piece), and low level caching with Rails.cache.fetch. It supports memory, file, Memcached and Redis stores, and also caches identical SQL queries within one request21. Django offers a per site cache, a per view cache with cache_page, template fragment caching with the {% cache %} tag and a low level API with cache.get_or_set, with backends for Memcached, Redis, the database, the file system and local memory22.

Example: caching the parts warning on the day overview

The managers' day overview shows how many spare parts in a workshop have fallen below their reorder level. The number changes slowly and counting 2,400 parts on every page view is waste. In Rails:

# app/models/workshop.rb
class Workshop < ApplicationRecord
  has_many :parts

  def parts_below_reorder_count
    # Reuse the answer for ten minutes, keyed by workshop.
    Rails.cache.fetch("workshop/#{id}/parts_below_reorder", expires_in: 10.minutes) do
      parts.where("stock_quantity < reorder_level").count
    end
  end
end

In Django:

# parts/services.py
from django.core.cache import cache
from django.db.models import F

from .models import Part


def parts_below_reorder_count(workshop):
    # Reuse the answer for ten minutes (600 seconds), keyed by workshop.
    return cache.get_or_set(
        f"workshop:{workshop.pk}:parts_below_reorder",
        lambda: Part.objects.filter(
            workshop=workshop, stock_quantity__lt=F("reorder_level")
        ).count(),
        600,
    )

And each job card on the board can be cached as a fragment that changes only when the card does. In a Rails view, cache card builds the key from the record and its last update time:

<%# app/views/boards/show.html.erb %>
<% @job_cards.each do |card| %>
  <% cache card do %>
    <%= render card %>
  <% end %>
<% end %>

In a Django template, you include the update time in the key yourself:

{# repairs/templates/repairs/board.html #}
{% load cache %}
{% for card in job_cards %}
  {% cache 600 job_card card.pk card.updated_at %}
    {% include "repairs/_job_card.html" %}
  {% endcache %}
{% endfor %}

The two versions are almost line for line equivalent. Rails derives more of the key by convention, Django asks you to state it. That is the difference between the two frameworks in miniature, and neither is faster.

Hosting: the same options for both

Both frameworks run on a plain Linux server, in containers, on platforms as a service and on the large clouds. What differs is how much each gives you out of the box.

Rails 7.1 generates Docker files for every new application23. The generated Dockerfile builds in stages, precompiles assets, runs the application as a user without root rights and starts Puma by default. For deployment, 37signals publishes Kamal, a tool that deploys containerised web applications to your own servers with zero downtime, using the Traefik proxy to hold requests while the new container starts. It was renamed from MRSK in 2023, reached version 1.0 in September 2023 and is at version 1.3 at the time of writing. It was built for Rails but works with any application in a container, Django included24.

Django does not generate a Dockerfile or a deployment configuration. Its documentation provides a deployment checklist and the manage.py check --deploy command, which flags unsafe production settings, plus guides for running under Gunicorn, Uvicorn and other servers25 26. The well trodden path is Gunicorn behind Nginx on a Linux server, or a container built from a short Dockerfile you write yourself.

Hosting optionRails 7.1Django 5.0Good for
A plain Linux server (virtual or dedicated)Puma behind NginxGunicorn behind NginxFull control, lowest running cost, needs someone who looks after servers
Your own servers with containersGenerated Dockerfile, Kamal 1 to deployYour own Dockerfile, Kamal or similar toolsRepeatable deployments without a platform's markup
Platform as a service (Heroku, Render, Fly.io)Documented and supportedDocumented and supportedSmall teams who would rather not run servers
Large clouds (AWS, Azure, Google Cloud)Containers or virtual machinesContainers or virtual machinesOrganisations already on that cloud, or with strict compliance needs

Heroku, Render and Fly.io all document both frameworks27. One piece of history is worth knowing when you compare prices: Heroku stopped offering free plans on 28 November 2022, so older tutorials that assume a free tier are out of date28.

Example: Freewheel's first production setup

For Freewheel's load, either framework fits the same shape:

  • one application server with two virtual processors and enough memory for the worker processes, running Puma or Gunicorn behind Nginx (or the container proxy)
  • a managed PostgreSQL database from the same provider, so backups and patching are someone else's job
  • Redis, for the live board's WebSockets and for background jobs
  • a second, smaller copy of the setup for staging

In Rails, Cian would deploy with the generated Dockerfile and a short Kamal configuration:

# config/deploy.yml (Kamal 1)
service: freewheel
image: freewheel/web

servers:
  - 192.0.2.10

registry:
  username: freewheel
  password:
    - KAMAL_REGISTRY_PASSWORD

env:
  secret:
    - RAILS_MASTER_KEY
    - DATABASE_URL
    - REDIS_URL

In Django, Aisling would write a Dockerfile of similar length, point Gunicorn at freewheel.wsgi (or Uvicorn at freewheel.asgi if the board uses Channels) and could deploy it with the same tool or with a platform. Rails saves an afternoon of setup here, fair play to it. Over the life of the application, the server bill and the maintenance work look much the same. The next chapter puts numbers on that over five years.

Hiring: the pool you actually fish in

This is the question with the most myths, and the one where honest numbers help most. The common view is that Python developers are everywhere and Ruby developers are rare, so Django is easier to hire for. The first half is true. The conclusion does not follow, because you are not hiring a Python developer or a Ruby developer. You are hiring someone who builds web applications in one particular framework.

I call this the denominator problem. Python is used for web development, data analysis, machine learning, scripting and teaching, so the Python headcount is enormous, and most of it does not build web applications. Ruby is used mainly for web applications, and most Ruby developers use Rails. When you divide by the right denominator, the gap shrinks dramatically.

Example: the developers in four countries

For Ireland I could not find a public, dated series that counts job adverts by framework, and the same goes for Germany and Austria. The best open source of the right shape is the Stack Overflow Developer Survey 2023, run in May 2023, whose full anonymised results are published under an open licence29 30. Worldwide, 45.3% of professional developers in it had worked with Python in the past year and 6.9% with Ruby. For web frameworks, it was 10.9% Django and 6.2% Ruby on Rails29.

I counted the professional developers per country in the public data set myself. These are survey respondents who chose to answer, not a census, and the Irish sample is small (352 professional developers), so treat the ratios as indications rather than facts (Foundations: sample size):

CountryProfessional respondentsPython : RubyDjango : RailsMedian years as a professional, Django usersMedian years as a professional, Rails users
Ireland352165 : 3229 : 269.512
United Kingdom4,3131,937 : 302293 : 216910
Germany5,5482,557 : 287354 : 202811
Austria782356 : 3266 : 23810
All countries67,23730,388 : 4,6556,175 : 3,488610
Ratios among professional developers in the Stack Overflow Developer Survey 2023, by country. Python to Ruby: Ireland 5.2, United Kingdom 6.4, Germany 8.9, Austria 11.1. Django to Rails: Ireland 1.1, United Kingdom 1.4, Germany 1.8, Austria 2.9. The framework gap is a fraction of the language gap in every country. Tap or click to enlarge

Two patterns hold in every country. The language gap of 5 to 11 Python developers per Ruby developer shrinks to between one and three Django developers per Rails developer. And the Rails developers in the survey are more experienced: worldwide, the median Rails user has 10 years as a professional against 6 for Django users, and 54% of Rails users have ten years or more against 36% of Django users. My reading of that, as opinion rather than fact: Rails has fewer newcomers and a deeper bench of people who have shipped and maintained products for years, while Django's pool is larger and younger, fed partly by people arriving from data work. Ireland is where the two frameworks are closest of the four, nearly one to one in the survey. Austria is where the Django advantage is clearest.

Example: the job adverts next door in the UK, autumn 2023

The nearest open, dated series of job adverts by framework is British. ITJobsWatch tracks permanent IT job adverts in the UK, and its figures for the six months to the end of November and the start of December 2023, as archived at the time, read as follows31 32 33 34. The salaries are UK figures in sterling.

Skill named in UK permanent job adverts, six months to late 2023AdvertsMedian advertised salary (UK, sterling)
Python6,426£70,576
Ruby596£69,500
Django219£65,000
Ruby on Rails242£62,500

Python adverts outnumber Ruby adverts by about 11 to one. Django and Rails adverts are about level, with Rails slightly ahead. Django adverts amount to about 3% of the Python figure, while Rails adverts amount to about 41% of the Ruby figure. Both frameworks also show the cooler market of 2023: in the same period of 2022, ITJobsWatch counted 1,008 Django adverts and 1,152 Rails adverts. These are snapshots of adverts in another market, not of people in Ireland, but the pattern matches the survey: the denominator decides.

Example: what this means for Freewheel's third developer

Suppose Freewheel later hires a third developer in Limerick. If they chose Django, the Python headline number would tempt Niamh to think the search is easy. But most of those Python developers are like Aisling was at the start: strong in Python, new to web frameworks. If they chose Rails, the pool is smaller, but the people in it are more likely to be experienced Rails developers, and in Ireland the survey puts the two frameworks nearly level. In both cases the realistic search is for one person with a few years of the framework itself, and that pool is of a similar order of size in both. Developers who can work remotely may well be weighing a Dublin offer too, so a Limerick business should expect that competition with either framework. The learning curve for someone who knows the language but not the framework is the subject of the honest learning curve.

Contractors and agencies

For short term help, both frameworks have contractors and agencies in all four countries. Two practical points apply to both. First, ask for maintenance experience, not just new builds: upgrading an application across framework versions is a different skill from starting one. Second, insist that you own the code, the hosting accounts and the data from the first day, so that changing supplier is a handover, not a rescue. That second point is how I work, whatever the framework.

For the person paying for this

If you commission a web application, you do not need to settle the framework debate yourself. Ask your developers these questions and judge the answers:

AskA good answer sounds like
What peak load have you designed for?A number in requests per second, worked out from your business figures, with a safety margin
How will you know a page is slow, and why?Request timing and query logging from the first release, not after a complaint
How do you prevent N + 1 queries?Eager loading as a habit, plus a check in development (such as strict_loading in Rails)
What runs outside the request?Email, SMS, reports and calls to slow services in background jobs
Where will it be hosted, and who patches it?A named provider, a managed database, and a named person responsible for updates
Who could take this over if you left?The size of the pool for this framework where you are, and documentation that makes the handover realistic

None of these answers depends on whether the application is written in Rails or Django. All of them decide whether it will be fast and maintainable.

My view

On performance, the frameworks are equal for any business of Freewheel's size and many times larger. The evidence from benchmarks says they are level with each other, and the arithmetic of your own load says both have room to spare. What makes an application fast is query discipline, background jobs and caching, and both frameworks give you excellent tools for all three. Choosing either one for speed is choosing on the wrong variable.

On hosting, Rails 7.1 gives you more on day one: a production Dockerfile, a deployment tool from the same people, and WebSockets in the box. Django gives you a clear checklist and leaves the packaging to you, which experienced Django teams handle without fuss. The difference is a day or two of setup, not a different running cost.

On hiring, look past the language headline. Python's size is real but includes many people who will never build a web application. The pool that matters, framework developers with years of production experience, is of similar size for both in Ireland and the UK, somewhat larger for Django in Germany and clearly larger for Django in Austria. If your team will be mostly people who arrive from Python data work, Django has a genuine advantage. If you want a small team of product generalists, Rails' smaller but more experienced pool fits. The decision method in chapter 6 turns this into a weight you can put on paper.

If you want a second opinion on the load, the hosting or the team behind your application, that is what the free workshop is for, and the web application development page explains how I build on Rails.

Conclusion

Is one faster? Not in a way your business will notice: Rails and Django finish level in the most realistic public benchmark, and an application like Freewheel's needs around 10 requests per second at its busiest, far below what either can serve on a modest server. The time in a request goes to the database, outside services and the way the code is written, so N + 1 queries, background jobs and caching matter far more than Ruby's YJIT or Python's faster interpreter, welcome as both are.

Is one easier to host? Both run on the same servers and platforms. Rails 7.1 ships more of the production setup, Django asks you to assemble it, and live features like Freewheel's board add Redis to either.

Is one easier to hire for? Python developers vastly outnumber Ruby developers, but Django and Rails developers are far closer in number, in Ireland the survey puts them nearly level, and in the UK the job adverts are about level too. Rails developers in the survey are more experienced on average, Django's pool is larger and younger, and Austria and Germany lean further towards Django than Ireland and the UK. Hire for the framework, not the language, and count the right denominator.

If you want your expected load, hosting and team worked out for your own application before you commit to a framework, book the free workshop. The first two weeks of work are on me.

Sources

  1. 1.

    John D. C. Little, A Proof for the Queuing Formula: L = λW, Operations Research 9 (3), 383 to 387, INFORMS, 1961, https://doi.org/10.1287/opre.9.3.383

  2. 2.

    TechEmpower, Web Framework Benchmarks, Round 22 results, published 2023, https://www.techempower.com/benchmarks/#section=data-r22&test=fortune and raw results file https://www.techempower.com/benchmarks/results/round22/ph.json and release R22 on GitHub, 15 November 2023, https://github.com/TechEmpower/FrameworkBenchmarks/releases/tag/R22

  3. 3.

    TechEmpower, Framework Benchmarks wiki, Project Information: Framework Tests Overview (Fortunes), https://github.com/TechEmpower/FrameworkBenchmarks/wiki/Project-Information-Framework-Tests-Overview

  4. 4.

    TechEmpower, Framework Benchmarks wiki, Project Information: Environment (Citrine), https://github.com/TechEmpower/FrameworkBenchmarks/wiki/Project-Information-Environment

  5. 5.

    Ruby on Rails Guides (v7.1), Active Record Query Interface, section Eager Loading Associations (N + 1 queries problem, includes, strict_loading), https://guides.rubyonrails.org/v7.1/active_record_querying.html#eager-loading-associations

  6. 6.

    Django documentation (5.0), Database access, part of the performance guide, https://docs.djangoproject.com/en/5.0/topics/db/optimization/

  7. 7.

    Ruby core team, Ruby 3.3.0 Released, ruby-lang.org, 25 December 2023, https://www.ruby-lang.org/en/news/2023/12/25/ruby-3-3-0-released/

  8. 8.

    Rails at Scale, Shopify's Ruby and Rails engineering blog, Ruby 3.3's YJIT: Faster While Using Less Memory, 4 December 2023, https://railsatscale.com/2023-12-04-ruby-3-3-s-yjit-faster-while-using-less-memory/

  9. 9.

    Python documentation, What's New In Python 3.11, Faster CPython, https://docs.python.org/3.11/whatsnew/3.11.html#faster-cpython

  10. 10.

    Python Software Foundation, Python 3.12.0, released 2 October 2023, https://www.python.org/downloads/release/python-3120/

  11. 11.

    Gene M. Amdahl, Validity of the single processor approach to achieving large scale computing capabilities, AFIPS Spring Joint Computer Conference, 1967, https://doi.org/10.1145/1465482.1465560

  12. 12.

    Puma, README (version 6.4.0), sections on threads, the Global VM Lock and clustered mode, https://github.com/puma/puma/blob/v6.4.0/README.md

  13. 13.

    Python documentation (3.12), Glossary, global interpreter lock, https://docs.python.org/3.12/glossary.html#term-global-interpreter-lock

  14. 14.

    Sam Gross, PEP 703: Making the Global Interpreter Lock Optional in CPython, accepted 24 October 2023, https://peps.python.org/pep-0703/

  15. 15.
  16. 16.

    Gunicorn documentation (21.2.0), Design: sync workers and How Many Workers, https://github.com/benoitc/gunicorn/blob/21.2.0/docs/source/design.rst

  17. 17.

    Django documentation (5.0), Asynchronous support, https://docs.djangoproject.com/en/5.0/topics/async/

  18. 18.

    Django documentation (5.0), How to use Django with Uvicorn, https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/uvicorn/

  19. 19.
  20. 20.

    Django Channels documentation, Channel Layers, https://channels.readthedocs.io/en/stable/topics/channel_layers.html

  21. 21.

    Ruby on Rails Guides (v7.1), Caching with Rails: An Overview, https://guides.rubyonrails.org/v7.1/caching_with_rails.html

  22. 22.

    Django documentation (5.0), Django's cache framework, https://docs.djangoproject.com/en/5.0/topics/cache/

  23. 23.

    Ruby on Rails Guides, Ruby on Rails 7.1 Release Notes, https://guides.rubyonrails.org/v7.1/7_1_release_notes.html and generated Dockerfile template, Rails 7.1.0 source, https://github.com/rails/rails/blob/v7.1.0/railties/lib/rails/generators/rails/app/templates/Dockerfile.tt

  24. 24.

    37signals, Kamal README (version 1.3.0), https://github.com/basecamp/kamal/blob/v1.3.0/README.md and releases (v1.0.0, 19 September 2023; v1.3.0, 28 November 2023), https://github.com/basecamp/kamal/releases

  25. 25.

    Django documentation (5.0), Deployment checklist, https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/

  26. 26.

    Django documentation (5.0), How to use Django with Gunicorn, https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/gunicorn/

  27. 27.

    Heroku Dev Center, Getting Started on Heroku with Python, https://devcenter.heroku.com/articles/getting-started-with-python and Getting Started on Heroku with Rails 7.x, https://devcenter.heroku.com/articles/getting-started-with-rails7 and Render, Deploy a Django app, https://docs.render.com/deploy-django and Render, Deploy Rails, https://docs.render.com/deploy-rails and Fly.io, Django on Fly.io, https://fly.io/docs/django/ and Fly.io, Rails on Fly.io, https://fly.io/docs/rails/

  28. 28.

    Bob Wise, Heroku's Next Chapter, Heroku blog, 25 August 2022, https://blog.heroku.com/next-chapter

  29. 29.

    Stack Overflow, 2023 Developer Survey, Technology: most popular technologies, 2023, https://survey.stackoverflow.co/2023/#technology-most-popular-technologies

  30. 30.

    Stack Overflow, 2023 Developer Survey public results data set (Open Database License), https://github.com/StackExchange/Survey/tree/main/packages/archive/2023 and country counts, median years of professional coding and ratios in this article are my own calculation from that file, professional developers only

  31. 31.

    ITJobsWatch, Django jobs, UK permanent vacancies, six months to 4 December 2023, archived 5 December 2023, http://web.archive.org/web/20231205000335/https://www.itjobswatch.co.uk/jobs/uk/django.do

  32. 32.

    ITJobsWatch, Ruby on Rails jobs, UK permanent vacancies, six months to 30 November 2023, archived 1 December 2023, http://web.archive.org/web/20231201023528/https://www.itjobswatch.co.uk/jobs/uk/ruby%20on%20rails.do

  33. 33.

    ITJobsWatch, Python jobs, UK permanent vacancies, six months to 1 December 2023, archived 2 December 2023, http://web.archive.org/web/20231202022255/https://www.itjobswatch.co.uk/jobs/uk/python.do

  34. 34.

    ITJobsWatch, Ruby jobs, UK permanent vacancies, six months to 10 December 2023, archived 10 December 2023, http://web.archive.org/web/20231210135414/https://www.itjobswatch.co.uk/jobs/uk/ruby.do

Shelter

I’m running the London Marathon for Shelter. Sunday 25 April 2027

My personal fundraiser. Shelter, the National Campaign for Homeless People Limited, registered charity 263710 (England and Wales) and SC002327 (Scotland), registered with the Fundraising Regulator.

Donate to Shelter