The Registry service for the Adaptable TeaStore
549
The Adaptable TeaStore Registry service is a crucial component that acts as a service registry for the Adaptable TeaStore application. It enables other services to register themselves and be discoverable by load balancers, facilitating seamless communication and scalability across the microservices architecture.
The Registry service operates as a microservice within the Adaptable TeaStore ecosystem. It allows different services to make themselves visible to load balancers, ensuring that requests are directed to the appropriate service instances. This architecture supports dynamic scaling and efficient service discovery.
To start the Adaptable TeaStore Registry service, you can use the following command:
docker run -e "HOST_NAME=10.1.2.3" -e "SERVICE_PORT=10000" -p 10000:8080 -d cerberus237/adaptable-teastore-registry
docker run: Command to create and run a new container.-e "HOST_NAME=10.1.2.3": Sets the environment variable for the host name.-e "SERVICE_PORT=10000": Sets the port number for the service.-p 10000:8080: Maps port 10000 of the host to port 8080 of the container.-d: Runs the container in detached mode.cerberus237/adaptable-teastore-registry: The name of the Docker image.Here’s a sample docker-compose.yml file to run the Adaptable TeaStore Registry service using Docker Compose:
version: '3'
services:
registry:
image: cerberus237/adaptable-teastore-registry
expose:
- "8080"
version: '3': Specifies the Docker Compose file format version.services: Defines the services to be run.
registry: The name of the service.
image: Specifies the Docker image to use for the service.expose: Makes the specified port accessible to linked services (not to the host).The Dockerfile for the Adaptable TeaStore Registry service is designed to set up the environment for running the service. Below is an overview of its structure and components:
FROM cerberus237/adaptable-teastore-base:latest
LABEL org.opencontainers.image.authors="Inria R&D engineer <[email protected]>"
COPY target/*.war /usr/local/tomcat/webapps/
FROM cerberus237/adaptable-teastore-base:latest: Specifies the base image to use, which is the latest version of the Adaptable TeaStore base image.LABEL: Provides metadata about the image, including the author's contact information.COPY target/*.war /usr/local/tomcat/webapps/: Copies the compiled WAR file of the Registry service to the Tomcat webapps directory for deployment.The Registry service provides a family of collectors to support various system metrics:
| Category | Collectors (Local & Remote) |
|---|---|
| CPU Usage | LocalCpuUsageCollector, RemoteRegistryCpuUsageCollector |
| Memory Usage | LocalMemoryUsageCollector, RemoteRegistryMemoryUsageCollector |
| Requests | LocalRequestMetricsCollector, RemoteRegistryRequestMetricsCollector |
| Response Time | RemoteRegistryResponseTimeCollector |
| Service State | RemoteRegistryStateCollector |
| Service Status | RemoteRegistryStatusCollector |
Each collector is designed to fetch remote metrics via REST API calls, providing insights into the registry's performance and health.
The RemoteRegistryCpuUsageCollector fetches CPU metrics from the registry service using a REST API call.
RemoteRegistryCpuUsageCollector cpuUsageCollector = new RemoteRegistryCpuUsageCollector("metrics/cpu");
double currentCpuUsage = cpuUsageCollector.get();
System.out.println("Current Remote Registry CPU Usage: " + currentCpuUsage + "%");
Note: Each service in the Adaptable TeaStore exposes a REST API endpoint to provide its metrics.
| Metric | Endpoint | HTTP Method |
|---|---|---|
| CPU Usage | /metrics/cpu | GET |
| Memory Usage | /metrics/memory | GET |
| Request Count | /metrics/requests | GET |
| Response Time | /metrics/status | GET |
| Service State | /metrics/state | GET |
| Service Status | /metrics/status | GET |
curl -X GET http://service-instance:8080/metrics/cpu
The Adaptable TeaStore Registry service does not currently implement any adaptation actions.
The Adaptable TeaStore Registry service is essential for service discovery and communication within the application. It can be easily deployed using Docker commands or Docker Compose and integrates seamlessly with other services in the Adaptable TeaStore architecture. The provided Dockerfile ensures a well-configured environment for running the service, while the instrumented metrics collectors enable effective monitoring capabilities. For further details, refer to the Getting Started documentation.
Content type
Image
Digest
sha256:23feaba83…
Size
269.7 MB
Last updated
about 1 year ago
docker pull cerberus237/adaptable-teastore-registry