3 steps to building a cloud-ready application architecture
Cloud computing is no longer the exception but the rule. It isn’t difficult to see why. Running your applications from the cloud has numerous advantages including scalability, flexibility, cost-efficiency and skilled infrastructure support. Nevertheless, these benefits won’t mean much if the application isn’t built cloud-ready from the get-go.
Being cloud-ready means the application should be designed to fully leverage the capabilities that come with being hosted on a Platform-as-a-Service (PaaS). Here are some important rules for making sure your application is seamlessly compatible with a PaaS.
1. Assume the Local File System Isn’t Permanent
In the cloud, nodes can be duplicated, moved or taken away at any moment. Therefore, you cannot afford to assume that files written to the local file system will be available in perpetuity.
To put this in context, think about a cloud-based application that relies on the local file system as a cache memory for the most frequently accessed data. If the node is switched off, moved to a different VM and location, and then restarted, the information in the cache will be lost thus creating inconsistent response times in your application depending on which node users connect to.
Instead, temporary information should be stored in a more resilient location such as a remote SQL database.
2. Avoid Specific Infrastructure Dependency
There are many manifestations of this principle. For instance, you shouldn’t assume that any service your application will call is at a specific IP address or host name. In recent years, the service-oriented architecture model has been adopted widely. However, it isn’t uncommon nowadays to still find applications that insist on hardwiring the details of endpoints they refer to.
When the IP addresses and host names of these services or peers are regenerated or relocated within the PaaS, the code that calls them breaks. The most ideal approach is to reference an external service registry that resolves each service endpoint. Alternatively, you can delegate the routing function to a load balancer or service bus.
3. Don’t Depend on OS-Specific Features
It’s perhaps no surprise that applications that use APIs and standards-based services are more compatible with PaaS than the ones that depend on more specific OS features. A practical example is work scheduling. Many application servers embed services into their APIs directly. While open source alternatives are available, plenty of programmers still prefer to invoke Java applications from an OS-level scheduler.
Everything will seem to work perfectly as long as the application is running on the OS it was built on. That could drastically change for the worse if the application is moved to a different OS. You can minimize the risk of this happening by using compatibility libraries that mimic different operating systems. Nevertheless, best practice remains to avoid OS-specific dependency as much as possible.
Bonus Tip: Don’t Install the Application Manually
Cloud environments are more dynamic and subject to change compared to traditional environments. Your application must be installed on-demand and with frequency. Ergo, the installation procedure must be reliable and scripted, with configuration information fully externalized from scripts.
There will be some consequences of such automation. First, you have to bear in mind that there won’t be a user present to respond to conventional installation prompts such as accepting privacy policies and license agreements, or choosing one among several configuration alternatives.
At the minimum, you should craft the installation as a collection of OS-level scripts. If your middleware has a built-in scripting tool, make the most if it. Keep the installation process short and portable as this makes it easier to adapt it to a wide range of automation methods. Also, reduce the number of installation dependencies. Finally, make sure you have a monitoring tool such as AppOptics that will give you a heads up when a problem with the application or infrastructure is identified.
If you apply these rules during cloud application development and configuration, they will go a long way in ensuring your application is PaaS-ready from the start.