Menu

Understanding Rack, Processes, Threads, Unicorn, Puma, and Action Cable Through a Restaurant
πŸ“°

Understanding Rack, Processes, Threads, Unicorn, Puma, and Action Cable Through a Restaurant

DEV Community: railsΒ·KaziuΒ·about 6 hours ago
#nfbA6xdK
#devtorails#devto#dev#staff#thread
Reading 0:00
15s threshold

When you're just writing Controllers and Models day to day, you don't really think about what's running underneath Rails.

But the moment you try to add an "always-connected" feature like real-time chat or notifications to a Rails app , suddenly people start saying things like "Unicorn doesn't play well with that" or "Action Cable handles it fine."

In this post, I'll lay out the machinery under Rails that you need to make sense of those conversations, using a restaurant as the analogy.

1. Rack: the standard order ticket format

Rack is the common agreement that connects Ruby web servers and web apps .

Any object that has call(env) and returns [status, headers, body] is a Rack app

class HelloApp def call ( env ) [ 200 , { 'content-type' => 'text/plain' } , [ 'Hello' ] ] end end

Enter fullscreen mode

Exit fullscreen mode

In restaurant terms, it's the order ticket format .…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.