When 1904labs was founded two years ago, we launched with a vision of helping enterprise customers transition their applications and data to the cloud. A move to the cloud can save a lot of money on infrastructure, but it does require a shift in engineering to take full advantage of what the cloud can provide.
Often times, cloud services are deployed to computer systems around the world not owned by the companies that deploy them. Other times companies choose to build a private cloud environment that they own. In either case, they are expected to thrive in a turbulent, hostile environment and must react gracefully to service outages, unexpected shutdowns of live instances, spikes in demand, and other surprises that are common in a distributed system. While this might sound imposing, it actually forces developers to write better programs. Today, services written for the cloud often follow similar patterns that help ensure their availability and reliability.
When it comes to best practices of developing cloud services, one can’t do better than to read and understand The Twelve-Factor App. This methodology is useful for designing, building, and deploying a cloud service and we’ll highlight a few key points.
Run Until You Die (Then Die Gracefully)
Computers and networks are finicky things. No matter how resilient you’ve made them, they’ll randomly go down at inconvenient times. What makes matters worse is the services you connect to are under the same stresses and you’ll occasionally lose connections to them as well. A cloud service has to be designed with resilience in mind, attempting to retry when it can, and dying gracefully when it cannot continue.
Keep It Stateless
Because cloud services have an uncertain lifecycle, they need to be stateless. When your service comes back online after an outage, there are no guarantees they’ll be on the same system with the same local storage. Everything of value must be stored outside of the application context, usually in a database. This allows services to spin up and die with no loss of committed data and discourages the use of sessions that are tied to a specific application instance.
Rise With The Tide
As demand on your service increases, your service must scale to handle the load. A well-designed cloud service can be scaled horizontally (that is, adding more workers) when demand increases and then scaled back down to keep costs reasonable during times of low demand. A service that can only be scaled vertically (adding more memory, CPU, etc) will always be limited in some critical way. If the service was designed following the twelve-factor methodology, the right decisions will have been made that enable horizontal scaling.
1904labs is eager to work with companies to build new offerings in the cloud or transition legacy systems via a hybrid solution. We’re continually researching, adapting, and developing best practices in the cloud. Our teams collectively have decades of experience designing and building cloud services to meet any need.