Learn more >
CloudHybrid CloudOn premisesContainersMicroservices
by Sai Vennam Updated May 23, 2019 - Published May 17, 2018
Since 2014, microservices have expanded to become a widely adopted, powerful application architecture. The growth of cloud platforms has played a major role in microservices adoption, since applications that are built to run on those platforms follow a set of cloud-native guidelines. Although there’s no single set of rules that define cloud-native, a pattern is emerging, one that relies heavily on microservices.
However, this growth is not without its challenges. Although microservices have proven to be an effective way to develop and manage applications in production, they come with certain drawbacks. In this post, I’ll outline some modern application architectures, show the advantages and disadvantages of microservices, and describe some community-driven solutions that tackle those disadvantages.
Although modern apps encompass many different architectures, I see two ends of the spectrum: traditional on-prem apps and cloud-native apps.
In the past, when a company set out to develop an application, they would purchase hardware and then use a platform standard, like Java EE, to create the application to reside on that hardware. Java EE is quite powerful; it was used to create complex and efficient – but also clunky and monolithic – applications. To this day, these applications continue to chug along and power a large number of the back ends for applications we still use. However, this approach is rapidly losing traction in favor of cloud-native applications.
On the other end of the spectrum lies cloud-native applications, which are often built using a microservices architecture. This new era of app development enables developers to choose the right language for the problem at hand. For example, developers might want to use Node.js to handle intensive IO operations through APIs but continue to use Java to handle computations of large numbers. This approach separates requirements and enables cross-functional teams to build each part of the stack using the preferred technology. With separate microservices making up each part of an application, scaling now becomes much easier and efficient.
So why doesn’t everyone just use microservices to build new cloud-native applications? Because it’s incredibly difficult to refactor an existing traditional application to become microservice-based and truly cloud-native.
The solution comes in the form of hybrid architectures. Instead of following a lengthy process to rewrite the whole stack, you can continue to use the established traditional application while breaking off pieces to take advantage of cloud-native concepts.
Let’s imagine a scenario: a traditional application is running into delays whenever the UI is accessed because the service that handles database access is becoming a bottleneck. Instead of scaling out the entire application, the developers choose to migrate the database access code into a new app based on Node.js, which performs well at handling large numbers of API calls asynchronously. They host this application in a public cloud and open secure access to the on-prem database. Finally, they scale up this individual service whenever they anticipate a high load on the application, allowing them to save big on server expenses. These developers are now effectively working on a hybrid application stack.
Eventually, more and more pieces are broken out of the monolith into their own microservices. This makes it easier for the team to develop future projects in a truly cloud-native fashion. For example, if a new mobile application needs to be developed and all the required components have already been refactored into microservices, they can proceed using a cloud-native approach.
I love the microservices approach for a lot of reasons, a few of which I’ve just outlined. The major advantages that come with microservices include:
You can choose the right tool for the job:
Then you can implement a non-restrictive technology stack — application-to-application communication is universal when using APIs or message queues.
Complexity allows you to:
These are all sound reasons to love microservices, but these same categories are also the reason why I started to hate working with microservices, especially in production. Each of these advantages comes with an unfortunate set of corresponding issues. Let me explain:
These issues honestly made me start to re-think why I loved microservices in the first place. The approach was supposed to make things easier but my team and I were spending so much time on operations and fiddling with the various technology stacks that I was starting to think we should have stuck with a single language and platform.
I wasn’t the only one running into these issues; the community identified these same problems and started working towards solutions. Let’s talk about the solutions that are available today to tackle the issues in each category.
Although language choice seems like an obvious advantage, having to deal with the nuances of different languages can be a lot to manage. Luckily, there’s a really straight-forward solution to this: Docker.
Docker enables developers to neatly “box up” their applications into Docker containers. A Docker container comes with everything you need to run a microservice — not just the code and runtime but the system libraries as well. This enables you to put all the nuances and complexities of an application within the container. When it comes to execution, a Docker container behaves in a standardized way, no matter what language powers the actual source. Basically, a Docker container for a Java app can be dealt with a similar fashion as a Docker container for a Node.js app. No more issues with custom build processes; operations engineers can now work cross-functionally across the teams managing each microservice.
This is a big one: Docker was around for quite some time before a production-capable orchestration solution with first-class Docker support was adopted. But it finally happened with Kubernetes.
Kubernetes provides the tools for automating deployment, scaling, and managing Docker containers. It addresses various requirements that tie closely with the microservice downfalls I outlined earlier. Although there’s too many features to talk about in this post, a few key ones include:
Kubernetes is effectively tackling almost all the issues with microservices that were troubling me and my team. There’s just one problem left — and although Kubernetes provides the tools for automating deployment, it’s not always easy to do.
The final piece of the puzzle comes with Helm, a tool for managing preconfigured Kubernetes-based deployments. Although Helm calls itself the “Kubernetes Package Manager,” it shouldn’t be mistaken for something like NPM, the Node.js package manager.
Helm provides “charts” that tell Kubernetes how to deploy a set of containers, along with features to enable rollbacks, provide repeatable app installs, and simplify updates to a running Kubernetes cluster. What Helm doesn’t do is provide a registry for hosting your Docker containers, but just the charts themselves. There is a community repository, but it’s quite easy to set up a private repository for hosting your Helm charts as well. The charts are configured to tell a Kubernetes cluster which registry to pull images from.
With their powers combined, Kubenetes, Docker, and Helm have tackled all the issues that I ran into over the years with microservices, without sacrificing the advantages. Although it seems like we’re adding even more technology to the stack, once you’ve configured these tools they’ll greatly streamline your team’s development and management workflow.
Once you’ve deployed a microservices web application to Kubernetes, you can expect it to look something like this:
A user accesses the web application through an Ingress load-balancer provided by Kubernetes. It gets routed to the web application served by Node.js, which uses two other microservices on the back end, a Java Microprofile.io service and a Python service.
This is just one example of how a microservice-based web application might look within a Kubernetes cluster. To get get started with deploying an application to Kubernetes, check out these resources:
In the next part of this blog series, I’ll tackle how Istio helps developers manage their microservices in production. I hope you’ve enjoyed reading about my experience with microservices. I’d love to hear about your own experiences — feel free to reach out to me directly on Twitter at @Sai_Vennam if you have any questions or comments.
Istio is a joint project launched by IBM, Google, and Lyft to connect, secure, control, and observe services, particularly in…
Back to top