What is the difference between Web Servers, App Servers and Ruby's Rack, and a Template Engine?
Web Server, App Server, Rack

What is the difference between Web Servers, App Servers and Ruby's Rack?

Web Server

A web server is a program that takes an HTTP request from a client user. The web server processes the HTTP requst and does one of two things. It might send the request to your Ruby, PHP, Python, etc. application. In this case the Ruby, PHP or Python application would generate a response. Alternatively, the web server processing might reveal that it only needs an HTML or CSS file. In that case the Web Server can handle the HTTP request by itself. It will simply render up the relevant HTML or CSS file. 

App Server

The app server handles the requests going to the application, e.g. your Rails application. Examples of app servers for Rails are Unicorn, Thin and Puma.

Node.js is ALSO an application server. Using Node.js you can write an HTTP Web Server. (Or more quickly, add the HTTP server NPM module). 

In development, you often run an App Server without a Web Server. Web servers are generally used for production. Hence in many Gem lists you see Thin, Unicorn and Puma - or gems like Rails12factor - in the Production Section.


Rack in short enables HTTP and Ruby to talk to one another. It enables for example a Web Server to speak to a an App Server which then uses Rack to speak to a Rails app. (Which in turn then routes it to the appropriate Controller/ Action Pack). Rack is called a "Web Server Interface". 

Template Engine


| Back