Speedyrails offers load balancers as a cloud service for your organization's web applications. Load balancers optimize resource use, maximize performance, and provide failover protection so that your web application is always available to your users.
To add load balancers to your organization's application, submit a ticket.
The frontend section of a load balancer accepts traffic through specific ports and routes traffic to backend servers based on Access Control List (ACL) rules.
Frontends can manipulate request headers sent to backend servers, set limits on the number of connections to a specific server, manage SSL termination, and more.
Speedyrails default setup uses SSL termination at the load balancer, which takes encrypted HTTPS traffic, decrypts it, and passes the unencrypted traffic to your application server through your private networks.
Speedyrails can also set up SSL termination on the backend servers if needed. Instead of decrypting the traffic at the load balancer, the balancer routes encrypted traffic to your application for decryption and processing. When using SSL termination in the backend servers, the load balancer is unable to alter the request in any way.
The backend sections list the servers that correspond to an application. The backend manages which load balancing algorithm to use, which servers to connect to, and manages your total load capacity.
Load Balancing Algorithms
Load balancing algorithms dictate the way traffic routes to your application server. Three commonly used algorithms are roundrobin, leastconn, and source.
roundrobin selects servers in turns and is the default algorithm.
leastconn selects which server to connect to based on the fewest number of connections and is recommended for applications that need longer sessions.
source selects which server to use based on the originating IP, and ensures the same users consistently connect to the same server when using your app.
All application backend servers must have a URL to run health checks. If a server fails a health check, the load balancer will stop sending traffic to that server. The load balancer will automatically send all traffic to an alternate server running your application until the server starts passing its health checks.
Speedyrails recommends using the
pulse gem in your Rails application to provide a URL for health checks.
To add the pulse gem to your Rails 3+ application:
gem 'pulse'to your
- Add a route to
/pulseby adding the following code to your
After installing the gem, notify Speedyrails support to confirm health checks are properly configured.
Single Server and High Availability
Speedyrails offers both Single Server and High Availability load balancers:
Single Server configuration uses one load balancer to manage traffic. This is a cost effective solution, but in the case of load balancer downtime, your applications will be unavailable.
High Availability load balancers provide two load balancers acting as a single load balancer with failover protection. If your primary load balancer becomes unavailable, the secondary load balancer automatically detects the failure and takes over routing traffic to your servers.