Maximal Performance with HAProxy

Posted by Chandra Krintz on 2/20/17 8:00 AM

Find me on:

AppScale is a portable cloud platform that deploys and runs anywhere, including over Azure, Google Cloud Platform, Amazon Web Services, and your own private laptop or cluster, among others. To enable this portability, AppScale integrates a number of amazing open source software technologies behind the scenes and exposes them through Google App Engine’s “PaaS” APIs. In this series, we overview these constituent technologies and describe how AppScale turns them into an open source cloud platform for scalable and elastic execution of Google App Engine apps.

To provide the best service and online experience for their own customers, App Engine users trust and rely on the quality of service, high-performance, and automatic scaling of hidden services provided by Google. AppScale provides this same service functionality portably using mature and high-quality open source components.  A key component of AppScale that helps enable these portable-but-transparent cloud capabilities is HAProxy.

AppScale runs Google App Engine apps at scale in many different environments (clouds, clusters, laptops) around the world. As such, it must adapt to resource constraints imposed by the underlying server resources and cost constraints specified by our customers.  To hide the differences among infrastructures, AppScale provides a layer of abstraction and isolation between the infrastructure and the app.  Within this layer, AppScale extracts maximal performance for its apps by spreading their load across the services and servers of the system.

Enter HAProxy.  AppScale relies on HAProxy to distribute the work done at each server in the system. Clients (end-users or remote services) access App Engine apps via HTTP/S requests.  When requests come into the system, AppScale separates access of static content (which is best served by a cache) from dynamic content (which is constructed and served by App Engine apps). AppScale uses HAProxy to assign requests for dynamic content to copies of application servers (instances) across the system. In addition, AppScale uses HAProxy statistics to inform its autoscaling. HAProxy provides an easy to use interface that AppScale uses to configure and update the system quickly, on the fly.

Following app (and/or platform) deployment, AppScale continuously monitors the health of each of the services it composes, and detects and handles problems and outages.  For app servers, AppScale starts additional instances when it detects that one or more are unreachable.  AppScale does so by coordinating with HAProxy, which transparently handles such situations to "mask" internal failures so that users receive uninterrupted service.  Similarly, AppScale automatically adds and removes application servers as required to absorb the request load on App Engine apps effectively. AppScale interfaces with HAProxy to predict load changes and to adapt the number of application server instances dynamically, e.g. to increase the number of app servers as load increases.

In summary, AppScale leverages HAProxy (a robust, production-quality, well supported, open-source technology) to provide AppScale users with high levels of quality assurance, fault tolerance, and automatic scaling, which developers of today's cloud apps now demand. By doing so, AppScale is able to address and avoid the risks associated with providing cloud apps (e.g. performance degradation and poor end-user experiences that result from web traffic congestion, bursts in activity, service outage, and security attacks).  As a result, AppScale makes developers more productive and improves end-user experiences automatically, while also lowering the cost of cloud use and reducing “network distance,” i.e. the latency between client and server.


Founded in 2013, AppScale is open source Google App Engine which automatically deploys and scales any Google App Engine application on any cloud without modification. AppScale provides portability to App Engine apps allowing easy migration from cloud to cloud.  The brilliance of the Google App Engine / AppScale development model is that developers can focus on the business logic of their app rather than the labor intensive backend programming.

Subscribe to Email Updates