by Jeremy H
• October 8, 2020
Building a microservices-based application requires a wide range of tools and technologies. Since these tools/technologies work together like a multi-faceted puzzle, it’s difficult for a beginner to understand what they are and why they’re necessary. The goal of this guide is to provide an accessible introduction to each of these essential concepts – all in one place.
Below, you’ll find a description of the most essential tools/technologies for building large-scale, microservices-based applications. After finishing this guide, you should have an excellent foundation for understanding the most important concepts in modern, scalable app development.
Did you know you can generate a full-featured, documented, and secure REST API in minutes using DreamFactory? Sign up for our free 14 day hosted trial to learn how! Our guided tour will show you how to create an API using an example MySQL database provided to you as part of the trial!
Create a REST API Now
Please use these links to navigate:
The monolithic application architecture was the standard app design strategy for decades – and it continues to have its uses today. In a monolithic application, developers write all of an app’s features and services into the same piece of programming – no matter how large and complicated the app needs to be. While this can make the initial coding process easier in some cases, it has dire implications for the future of the app.
As a monolithic application evolves over time, developers bolt new features and services on top of the existing code or edit the code to change existing features. With each new app iteration, the code becomes more complicated and difficult to untangle – until it is virtually impossible to change one piece of the system without negatively impacting other parts of the application. At this point, it becomes necessary to refactor the entire architecture from scratch.
This is where the microservice architectural style can help. In a microservices-based application, developers break the monolith into its component features and services. Then they run each feature or service as an independent “mini-application” or microservice and loosely connect (usually with REST APIs) to form the larger application. In this respect, developers rebuild the monolith as a cluster of modular, independently-running services.
Microservices thought leaders James Lewis and Martin Fowler describe the process like this: “The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies.”
Due to the relatively autonomous nature of microservices, adding, upgrading, or removing features and services within the architecture is relatively easy. Scaling is also easier because – rather than scaling the entire application – you only need to replicate or give more resources to the individual processes that need it. In addition to scalable design, the modularity of this architectural style works well for enterprise IT infrastructures because it allows you to add/remove new technologies with greater flexibility.
Let’s review the general features and characteristics of a microservices-based architecture:
Many firms develop their own microservices to satisfy specific use-cases. However, one of the advantages of microservices is that they allow developers to focus on quickly building a minim viable product (MVP). Then they can connect the MVP to other prebuilt microservices to rapidly create a complete application. This allows developers to focus more on innovation than re-coding already-existing solutions.
The microservice architectural style has empowered developers to re-think the way applications are built. By adhering to a service-oriented, microservices design philosophy, developers can build more future-proof systems that they are freer to quickly and more economically update and expand as dictated by changing business circumstances and needs. In this respect, microservices offer businesses tremendous competitive advantages in terms of agility, scalability, and cost-effectiveness.
Central to the success of microservices-based application development is the idea that microservice run as autonomously as possible. Not only does this preserve the relative pluggability of this component-based architecture, but it also contributes to high availability and resilience. If one microservice shuts down or if the OS instance hosting the microservice shuts down, it will not take out other microservices or other parts of the system. Furthermore, replicated instances of different app components can take over where others fail.
Preserving the autonomy of different microservices means that you cannot simply run them as simultaneous processes on the same server without isolating them from each other within their own runtime environments or virtualized servers. The traditional (but less than ideal) way to do this is through virtual machines (VMs).
A virtual machine replicates a separate “virtual server within a server.” While this allows the systems running on it to function without knowledge/dependency on other processes, the problem with virtual machines is that they need a unique OS image to operate. This is problematic because hosting a full OS replica hogs system resources. It also takes a lot of time to boot up the OS – which slows down the scaling, deployment, and replication of different systems. Even worse, you have to pay licensing fees for each of the VMs’ OS instances. While VMs work for a small architecture, they are not economically feasible for systems consisting of thousands (or hundreds of thousands) of microservices.
To overcome the inefficiencies of VMs, modern developers generally use containerization strategies for building microservices-based systems. Containers offer a lightweight virtual runtime environment for microservices that does not require its own OS kernel. Instead of holding a complete OS image, a container only “contains” the minimum-required code, libraries, tools, and dependencies that the containerized app needs to operate. This lightweight design allows you to spin up containers in milliseconds and save tremendous amounts of money on OS licensing fees and system resources. Moreover, you can run countless containerized microservices on the same server instance.
By far, the most popular tool for building, deploying, and managing containers is Docker (see description below).
Let’s review the general features and benefits of containers:
Here are the most popular tools for building and deploying containers:
Docker: Synonymous with the terms container and container images, Docker is the leading container platform that allows you to quickly create, share, and deploy containers that run virtually anywhere. Docker also includes tools that allow you to orchestrate container-based systems.
rkt: rkt or “Rocket” is a command-line interface (CLI) that allows you to run containerized apps. Rocket’s primary mission is to help developers achieve speed, security, and composability.
LXC: LXC is an interface that allows you to use Linux kernel containment features. The LXC API offers the ability to create and manage containers.
Containerization strategies offer tremendous efficiency, speed, and portability when designing a service-oriented architecture. Through a component-based architecture that consists of autonomous containerized microservices, you are free to scale, replicate, add, and remove components as required by business demands or as required by request traffic variances. This offers a flexible and scalable application capable of managing Amazon and Facebook scale workloads. Without containerization and microservices-based strategies, these large global firms would never have been able to service their massive user bases.
Although Docker is the most popular tool for building and managing container-based architectures, when it comes to managing resources and scheduling container deployment, Docker faces a serious limitation: A single Docker node can only manage the containers running on the same server instance.
If you’re managing a large architecture that consists of containerized microservices running on multiple servers (under multiple Docker nodes), you will need a more sophisticated container orchestration solution such as Kubernetes. These more sophisticated solutions allow you to code a series of container deployment instructions to automate the management of containers and resources across a large-scale system. With Kubernetes develoers code these instructoins in the human-readable language YAML.
The features/benefits of of container orchestratoin are best undrestood by looking at the tasks a solution like Kubernetes can perform. By adhering to the rules and limits encoded in its YAML-based instructions, Kubernetes automates the following tasks to keep your container-based architecture running as efficiently as possible:
Through Kubernetes, developers can create a highly scalable, highly available system. If one part of the application is overtaxed with requests, Kubernetes can duplicate the process across new servers and load balance requests to the new processes.
Also, when developers want to test the deployment of a newly-upgraded component (microservice), they can set rules that go into effect should the untested service fail. In the event of a failure, Kubernetes can divert requests to older, stable versions of the service. In this way, a well-designed Kubernetes cluster allows you to deploy, test, and upgrade new application features while reducing the risk of downtime.
Here are the most popular tools for container orchestration:
Kubernetes: A feature-rich container orchestration tool that is ideal for building large-scale container-based systems requiring sophisticated configurations. Kubernetes schedules the deployment of Docker nodes, containers, and pods for an entire “Kubernetes cluster” of containerized processes. It also manages workloads and resource allocation to maintain system health. Although Kubernetes is the most popular container orchestration tool, it comes with a steep learning curve and takes a long time to set up.
Docker Swarm: As a simpler container orchestration solution than Kubernetes, Docker Swarm has fewer features than Kubernetes, and it tends to be a good match for less complex use-cases. Swarm’s advantages are that it can still manage large-scale container-based architectures, and it is faster to set up and has less of a learning curve than Kubernetes. Still, Swarm has fewer custom configuration abilities. Due to their different use-cases, Kubernetes and Swarm are not exactly in competition with each other.
Docker Compose: An excellent container orchestration tool for small-scale architectures where all of the containers are running on the same server under the same Docker node.
Other orchestration tools: Other container orchestration tools include Apache Mesos, Nomad, DC/OS, Apache YARN Hadoop, and Mesosphere.
It’s not humanly possible to manage load balancing, system resource distribution, container scheduling, and scaling for a large container-based architecture. By allowing you to code a system of limits/rules that the container orchestration solution follows, you can automate these “humanly-impossible” aspects of managing a container-based system consisting of hundreds of thousands of container instances.
So far we’ve learned how developers create microservices, deploy them in containerized environments, and orchestrate resources and requests across a microservices-based infrastructure. However, we haven’t covered a key component to this equation: API management (or API gateway) tools.
The individual microservices and other components that comprise an IT infrastructure or app architecture need to communicate and interact with each other. This interaction is typically achieved through REST APIs. An API management tool (or API gateway) can facilitate the establishment and management of these REST API interactions.
For example, an API manager like DreamFactory offers a catalog of prebuilt REST APIs. This catalog empowers developers to rapidly integrate prebuilt services and databases into their systems. As a “gateway,” API request traffic goes to DreamFactory instead of directly to the services that sit behind it. DreamFactory authenticates the requests, sends them to the appropriate service, and relays the response to the client.
Additionally, an advanced API manager like DreamFactory can automate the process of generating and exposing custom REST APIs for different services, so you can develop a REST API in minutes (versus the weeks it takes to hand-code an API).
We can understand the features and benefits of API management by looking at the following three components of API management:
(1) Developer Portal and API Catalog: This is a dashboard that developers can use to browse, discover, adopt, and subscribe to prebuilt APIs for different applications, databases, microservices, and web services. Like a Swiss army knife of features, the developer portal puts a host of tools/services like authentication, map services, databases, web services, translation services, etc. at your fingertips for rapid integration into your projects. These can serve as the “components” that help you build a microservices architecture.
(2) API Gateway: The API gateway serves is an intermediary between all connections and requests between the API manager’s catalog of APIs and the external systems that connect with them. To access APIs, your system sends a request to the gateway, which forwards the request to the appropriate service and manager receives and returns to your system the confirmation/results of the request.
(3) API Lifecycle Management: Lifecycle management tools help you create, deploy, publish, version, monitor, discover, and consume APIs. DreamFactory’s automatic API generation tool fits into the API lifecycle management category. This adds the unique advantage of allowing developers to create and expose custom APIs in minutes.
Here are two examples of API management tools:
DreamFactory: DreamFactory serves as an integration-platform-as-a-service (iPaaS), developer portal, API manager, and API gateway. With native connections to the most popular authentication solutions, databases, web services, and microservices, DreamFactory empowers developers to rapidly integrate new solutions into their apps and IT infrastructures. Best of all, DreamFactory’s automatic REST API generation feature allows you to create and share custom REST APIs to integrate services in minutes.
Dell Boomi and Mulesoft Anypoint Platform: Boomi and Mulesoft offer a wide range of app and data integration (ETL) services. In this respect, Boomi and Mulesoft can satisfy additional integration use-cases beyond app and microservices integrations – such as ETL data integration – and MuleSoft also includes ESB services. These extra features make Boomi and Mulesoft a lot more expensive and a lot more complicated to use than DreamFactory. Unless you have an enterprise-size budget, these solutions might be unnecessarily expensive and too complex to use.
API management is essential in modern, microservices-based application design because it eliminates the time it takes to develop and manage API connections for the countless services that comprising you system. API Management also handles authentication to provide the easiest and fastest avenue to a highly secure architecture. Through API management, API gateway, and API lifecycle management tools, developers eliminate months worth of costly, hand-coded app integration tasks.
At this point, we have broken the monolith into its component parts, refactored those parts as containerized microservices, and used an API manager and API gateway for handle the API interactions between the microservices that comprise the system. We have also used a container orchestration tool to manage deployment/scaling/resource distribution for this large cluster of services.
However, we need another piece of technology – called “application performance monitoring (APM)” – to complete this multi-faceted puzzle. APM helps you monitor and finetune the performance of the system you have built. It provides developers with the data they need to ensure:
We like how TechTarget summarizes APM: “An effective application performance monitoring solution should focus on infrastructure monitoring, as well as tracking the user experience, application dependencies, and business transactions. APM tools provide administrators with the data they need to quickly discover, isolate, and solve problems that can negatively affect an application’s performance.”
As an example of APM in action, an APM solution monitors memory usage by tracking short-term CPU data storage. When the APM shows that CPU memory usage exceeds a specific threshold, it indicates a probable cause of performance issues that you can resolve before things get worse.
Generally speaking, you can divide APM into two separate types: (1) application front-end performance monitoring, and (2) application back-end performance monitoring, i.e., infrastructure monitoring. While the topic of performance monitoring can get pretty advanced, we’ll give you a brief overview of what’s involved for each of these APM types without getting too technical.
Application front-end performance monitoring relates to tracking the metrics and data points related to the user experience and what the user sees. This includes information on service availability, memory bloat, and overall app performance. Developers use front-end APM information to maximize app performance, improve the overall user experience, and boost user retention numbers.
Here is what front-end performance monitoring tracks:
Application back-end performance monitoring (infrastructure monitoring) relates to tracking information pertaining to the infrastructure and server resources that suppor the app or architecture. This gives you key metrics and data related to an application’s vital signs – allowing you to optimize performance and more efficiently use the resources that support the system.
Here is what back-end performance monitoring tracks:
Here are some examples of application performance monitoring tools:
DataDog and SolarWinds: DataDog and SolarWinds are well-known, proprietary APM solutions for back-end and front-end monitoring. These fully-hosted solutions are fast and easy to set up, and they have beautiful dashboarding options. However, they are priced for large enterprises and usually too expensive for small-to-medium-sized firms. Plus, these propietary solutions subject you to vendor lock-in.
Prometheus and Graphite: These are two of the most popular APM solutions, which you can configure for both back-end and front-end monitoring. Prometheus and Graphite are free and open-source, but setting them up requires advanced skills and takes time (all of which cost money). Also, these solutions need to be paired with an open-source dashboarding tool like Grafana or Kibana for viewing metrics. The benefits of using Prometheus and Graphite are the flexible configuration options and no vendor lock-in.
MetricFire: MetricFire is more geared toward back-end APM. As a fully-hosted platform that offers Prometheus and Graphite “as-a-service,” MetricFire presents Prometheus or Graphite as if they were easy-to-set-up, proprietary monitoring solutions (without the vendor lock-in and lack of flexibility of DataDog or SolarWinds). While MetricFire offers front-end monitoring too, it really excels in the back-end APM space – especially when tracking time-series metrics for various systems that support an application. MetricFire also uses Grafana dashboards for beautiful metrics displays.
Scout APM is more geared toward application front-end performance monitoring. Scout APM uses tracing logic to match performance bottlenecks with the source code that causes them – making it easier to pinpoint and resolve problems, so you can provide a better user experience and boost user retention.
Application performance monitiing is essential because – after designing, testing, and deploying your system – it’s necessary to monitor its performance from every angle, both the front-end and back-end. This helps improve the user experience, boost user retention, and identify/resolve performance bottlenecks. APM will also improve your mean time to repair (MTTR) because you catch source of problems faster. Ultimately, an effective APM strategy connects the dots between front-end/back-end application performance and business profitability.
After reading through the sections of this guide, we hope you now have a general understanding of the most essential tools involved in microservices-based app development and why they are essential. Also, if you’re involved in developing IT infrastructures or applications that require API connections, we hope you’ll consider how an iPaaS and API management tool like DreamFactory can radically benefit your development workflow.
At DreamFactory, we’re committed to helping organizations overcome their API-related development roadblocks with solutions can help you eliminate labor costs, secure your systems, and dramatically reduce your time to market. If you’d like to experience the benefits of DreamFactory first-hand, contact our team for a free hosted trial now!
Join the DreamFactory newsletter list.