Stateless, stateless, and stateless! That is the order for developers who want to create a cloud-aware application. Cloud computing, which allows users to access their applications hosted on servers over the Internet, brings both new benefits and responsibilities for developers.
For developers who host their code in a public PaaS, some providers expose APIs that allow the application to request more resources than the application needs. These can automatically scale when necessary, and that is a great asset for capacity planning and quality of services. Now, more than ever, developers need to take care of redundancy -- not only because cloud providers use commodity machines but because dynamically scaling-out requires that application and user sessions be treated in the application code. And that means stateless.
Even a simple application needs to store some kind of state. This is one of the reasons why we still need databases or objects to store some user’s information state. It’s the reason why most web applications do not store any information on front end servers – it’s the part that usually needs scale.
Dealing with databases is not the same either. The concept of relational database is almost dead in a cloud environment. Actually, most PaaS bring the notion of “storage engine”, where the denormalization model is encouraged. Since tables are split across multiple machines for scalability, many “old school” concepts are not valuable in the cloud (such as Store Procedures, use of JOINS in the query, etc.). On the other hand, performance can increase as a result of the capability to retrieve database information on multiples servers at same time.
For developers, this is new in the computing world. Some of these ideas can be scary, but it is just a matter of understanding the new rules, and applying them to your application. A new development concept came from this model, which is called “eventual consistency”. Eventual consistency is when a change in the database/application may not be registered for a few milliseconds. As developer, it is very important that you are aware of this.
Developing an application hosted in the cloud differs from day one of an on-premise deployment. You can abstract many layers and consume different resources available on the Internet. For example, you can host your presentation layer on Facebook, store data on Amazon’s S3, deliver static content using Akamai’s CDN and utilize application logic that runs in an entirely separate place. The biggest enemy in this environment is the latency due to the nature of the Internet. Not only are there issues with interconnecting application components but also delivering the service to the end-user.
Lower latency is not something that you can’t obtain. You can buy bandwidth but it will not solve latency issues of requests crossing dispersed geographic resources. Adopting a strategy to use geo-located servers can minimize this effect. For example, Microsoft offers Microsoft Azure. However, from an architecture standpoint, the service reliability works best on stateless application designs.
Aside from the nature of a cloud-aware application, there are several devices ranging from smartphones, tablets, notebooks, desktop computers, car entertainment systems, home automation, etc. that move towards specialization. The capability available in these devices varies as well, for example, the size of the screen, audio, camera, battery, GPS, Internet connectivity bandwidth, keyboard, etc. Finally, so many possible combinations, such as different operating systems or browsers, can make this process miserable. In order to abstract these differences, many applications adopt the principle to run entirely on cloud, delivering the service via browser. However, for user experience reasons, some applications need to execute locally. Therefore, the creation of a scalable, stateless, web service interface in the cloud and use of the best framework available for device specific applications both become very important.
We can’t deny the increase in web developers that use rich media content and graphic intensive applications in order to attract users and present the best possible user experience. Yet, the less capable device limits service offering. Using Web APIs to access a user’s device can help developers deliver the best user experience based on capability available, as presented in the following web portal:
In this scenario, the cloud application can decide to stream HD video quality instead of low-quality video due to connection type. There is no concern over whether the battery will be enough to ensure the user sees the whole video because it is connected to an external source.
In order to explore these capabilities, I suggest that you read the Cloud Builder Reference Architecture from gproxy.com and NetSuite.