Rails Deployment | 317
One drawback of this architecture is that once the database becomes the bottleneck,
things can get difficult. Database scalability is a hard problem, and we examine this
issue in Chapter 4.
Front End Web Server
The front end web server has several purposes. Depending on the application, these
may be mission-critical or not even needed. Consequently, the concrete systems
architecture will look very different from application to application. The most com-
mon functions of the front end server are the following:
Reverse proxying and load balancing
The front end server balances and distributes requests between the application
servers. It also acts as a reverse proxy so that the requests to the application serv-
ers appear to be coming from the client, rather than the balancer.
Static file serving
The front end web server (which may or may not be the same software as the
load balancer) serves static files much faster than the application servers.
Compression
If HTT Pcompression is to be used, the front end web server can handle this to
reduce CPU load on the application servers.
SSL wrapping
The front end server can handle SSL encryption so that the application server
does not have to do it (SSL encryption and decryption are CPU hogs). The front
end server usually adds a header such asX-Forwarded_Proto: httpsto indicate
that SSL was used.
Common choices for a front end web server and proxy balancer are as follows.
Figure 10-7. Shared-nothing deployment with redundancy for load balancing or high availability
Web server/
load balancer
Application
server
Application
server
Application
server
More application
servers as
needed
Internet DB
Web server/
load balancer
Optional
failover