AIS is proud to announce the release of our Chief Technology Officer Vishwas Lele’s Pluralsight course on Cloud Oriented Programming. This course demonstrates coding techniques to optimize your applications that are targeted to run in the public cloud.
The public cloud is tomorrow’s IT backbone. As cloud vendors introduce new capabilities, the application-building process is undergoing a profound transformation. The cloud is based on key tenets such as global scale, commodity hardware, usage-based billing, scale-out, and automation. But how does the cloud impact what we do as programmers every day? What do we need to do at a program level that aligns us with the aforementioned tenets? This course discusses 9 techniques / tips (organized in three modules) designed to help developers make more effective use of the cloud.
This module will outline key principles that make up cloud computing and motivates the discussion on cloud oriented programming
Module #1: Exception handling and instrumentation
Be very careful about “tight loops” in your logic. The consequences may be more than just an unresponsive UI. You are likely to run up a hefty cloud usage bill. So whether you are checking for a message in the queue or reading a table, build in logic that multiplicatively decreases (aka exponentially) the rate on invocation.
Reimagine the Exception Handler
It has been a best practice to only handle exceptions from which our program can recover. For all other exceptions, the guidance is to “rethrow” the exception, up the call stack. But with cloud (and DevOps), we now have the ability to provision new resources, or alternatively redirect the request to another data center in a different geographical location.
Logging Takes a New Meaning
We know the importance of logging in a complex distributed application. In the cloud, it becomes critical to have rich logging. But don’t create a hotspot by logging into a single repository. Instead, use diagnostics frameworks that allow you to log locally but transfer the logs to a centralized repository asynchronously.
Module #2: Container, Microservices and Reuse
Try to encapsulate as much as logic as possible into a “container” that is the unit of scale and availability on the cloud platform – whether it is a Windows VM instance or a Linux cgroup. Doing so will allow the platform to scale and be more resilient.
Decomposition is a well understood software design principle. The idea of breaking a business problem down into smaller parts that promotes not only “separation of concerns” but also the notion of reuse is indeed very worthy. Microservices are being seen as a way to decompose your cloud based applications.
Reuse is often cited as the Holy Grail of software development. In the cloud it takes on a whole new meaning. For example, consider this one line of code – [W,s,v] = svd((repmat(sum(x.*x,1),size(x,1),1).*x)*x’) It takes a spectrum of values and groups them. Prebuilt algorithms like these are increasingly available out of the box on the cloud platforms and are very easy to use.
Module #3: Cost, Scale and Automation
Cost Aware Computing
Architects, PMs or IT folks are not the only ones that need to worry about the overall total cost of ownership (TCO). Programmers have an important role to play to keep the costs down – whether it is adequate “poison message” handling, exponential back off or tight memory management can all go a long way in keeping the TCO low.
Partitioning is the key to scalability
“Sharding” is not just for databases. In the cloud, consider the use of horizontal partitioning logic for something as low-level as a singleton (i.e. if possible, use a partitioned set vs. a singleton set). The best way to scale in the cloud is to embrace “scale-out” at the lowest levels of your code.
Infrastructure as Code
A new category of programs that developers are likely to write, when working in the cloud, is automating the provisioning of infrastructure that is needed to host the applications they build.
Cloud has ushered an era of “software defined everything -network, storage, compute etc.” making every aspect of a modern data center API accessible thus bridging the chasm between developer and operations that is commonly referred to as DevOps.