What code runs when you request a page from a Ruby on Rails application?
Here is an annotated trace showing every method call within Rails and its dependencies. It is for an example application that loads a blog post from the database and renders a page containing the post's title.
Out of the box, Rails runs with the Puma web server. Puma is responsible for receiving HTTP requests through a web socket and parsing them into a format that Rails can understand.
The first methods we see are called from Puma's Server#run
. When Puma this method creates a pool of threads that wait for requests. The different threads allow Puma to respond to requests concurrently.
Created by Chris Zetter in a tribute to Rails and its many contributors.
Read out more about how the trace was made.
You can see the code that powers this page and suggest resources to link to on GitHub.