What are the Components of Microservices Architecture?
Microservices architecture is a distributed system with many supporting components in addition to the independent services. These supporting components enable the core services to function correctly, securely, and with scalability. They include the communication and entry point components, the discovery and orchestration components, and the operational and resilience components.
Core Components
The core components are the services you build to operate the functionality of your application. These components are the foundation of your application’s architecture. They are autonomous and independent units of business logic. Each small and loosely coupled service is dedicated to a single business capability, such as managing your inventory, your customers’ payments, and each customer’s user profile. Each service has its own code, configuration, and data store.
To maintain autonomy, each microservice will usually manage its own data. This results in polyglot persistence, which is where different services use different types of databases, based on their specific needs. Example databases include PostreSQL, MongoDB, SQL Server, Redis, Cassandra, HBase, and Elasticsearch.
Communication and Entry Point Components
These components manage how external clients communicate with the services and how the services communicate internally.
API gateway is a single-entry point for all your client requests, including from mobile apps and web browsers. The gateway handles cross-cutting concerns. For example, it routes the request to the correct internal microservice, and it aggregates and combines responses from multiple services into a single response for the client. The gateway also handles authentication, authorization, and rate limiting (or throttling) to secure your application. And it decouples the services by hiding the internal structure and complexity of the microservices from your client.
Inter-service communication protocols can be synchronous or asynchronous. Synchronous services send a request and expect to receive an immediate response (for example, REST over HTTP). Asynchronous services communicate through messages or events and don’t wait for an immediate response. This is done through a message broker or an event streaming platform (such as Kafka).
Discovery and Orchestration Components
Because services can scale up and down dynamically, they need to be able to find each other. That’s the concept of microservices discovery. First, the service registry is a central database that holds the location (the network IP address) of all the active service instances. Service discovery is where one microservice or the API gateway queries the service registry to find the network location of the service that it needs to call. The orchestration layer (such as Kubernetes) is the management platform that handles the automated deployment, scaling, healing, and scheduling of all the microservice containers across the cluster.
Operational and Resilience Components
These components are critical to debugging issues and running your distributed system reliably. First, the configuration server is a centralized component that manages your configuration settings for all your microservices. This includes your database credentials, external service endpoints, and feature flags. The configuration server ensures consistency across your environments, including your development environment, quality assurance testing, and when your application is in production.
The Circuit Breaker pattern is often implemented as a library and is used by one service when calling another service. If the downstream service repeatedly fails, then the circuit trips, which prevents further requests. This allows the failing service to have time to recover, and it presents cascading failures to occur across your application’s other services.
Your observability tools are for monitoring and logging. Centralized logging aggregates your logs from all your services into a single searchable location. Distributed tracing tracks a single user request as it travels across multiple services. It uses a correlation ID to identify any potential bottlenecks. You also should collect metrics, which are real-time performance data, from all your services. Data examples include your CPU resource usage, latency, and error rates.
Mapping the Benefits of Azul Prime to the Microservices Architecture Components
Azul Prime primarily improves the performance and resource efficiency of the core components (the services themselves), which then provides further downstream benefits to the orchestration components and the operational/resilience components. Next, let’s map the Azul Prime features to our microservices architecture components.
Core Components
Azul Prime’s impact is primarily on the runtime execution of the individual Java microservices that you build:
| Azul Prime feature | Description | Improvement |
|---|---|---|
| C4 (Pauseless) Garbage Collector | Eliminates the garbage collection pauses to ensure that the service is always available to process results. | Improves your service availability and predictability with consistent, low latency within the core service. This helps you meet any API response time SLAs. |
| ReadyNow! Technology | Records and loads the optimal JIT compilation profiles, which bypasses the slow, resource-heavy Java warmup phase. | You’ll reach a faster service-ready state immediately upon launching your application, which ensures new scaling instances contribute to your capacity. |
| Cloud Native Compiler (CNC) | Offloads CPU-intensive JIT compilation from the service container to a central server. | You achieve resource efficiency with less CPU and memory use for compiler overhead. You’ll be able to deploy your service in smaller, denser containers, which reduces your cloud compute cost. |
Communication and Entry Point Components
Azul Prime does not have a direct impact on these components (such as the API gateway, load balancers, and message brokers). However, by providing faster and more reliable service instances, Prime ensures that the API gateway is always forwarding requests to a pool of healthy, high-performing services. This improves the overall experience for your users.
Discovery and Orchestration Components
By optimizing the service’s runtime, Azul directly improves the efficiency and effectiveness of your orchestration layer (such as Kubernetes):
| Azul Prime feature | Description | Improvement |
|---|---|---|
| ReadyNow! Technology | The service instances become healthy and ready to accept traffic almost instantaneously. | You’ll achieve efficient auto-scaling, as your orchestrators react to load spikes faster. When new service replicas are created, they are simply added to the existing service mesh and load balancer pool without a lengthy Java warmup delay. |
| Reduced memory and CPU footprint | You’ll have smaller resource requirements per service instance. | The higher container density means that more Java microservices can be packed onto the same Kubernetes worker node, which leads to a better utilization of cloud resources and lower infrastructure costs. |
Operational and Resilience Components
Azul Prime helps you prevent GC pauses, which are a common source of instability in your Java application. It also can make performance analysis much cleaner:
| Azul Prime feature | Description | Improvement |
|---|---|---|
| C4 (Pauseless) Garbage Collector | Eliminates latency spikes that are caused by garbage collection (GC). | Increases your application’s resilience by preventing cascading failures. Services under high load can hit long GC pauses and violate their own timeout settings, which could trigger the upstream services’ circuit breakers. Prime solves this problem to build overall system stability. |
| Stable performance | Prime provides consistent, low latency, and predictable behavior for your application. | The stability provides simpler observability and debugging because you can rule out your JVM GC pauses and JIT warmup as the root causes of any performance issues. You can then focus on using distributed tracing and logging to debug your application code and network issues. |
To learn more about how Prime can provide you with a high-performance JVM, see Azul Prime: High Performance JVM.