/complete-microservices-env

This is a whole environment of a Microservices Architecture using Spring Cloud, Splunk, Zipkin, Grafana, Prometheus, Postgres with Replication Strategy, Redis and RabbitMQ.

Primary LanguageCSS

What are Microservices?

There are thousands of definitions out there about what are microservices, but the one I like best is that of the great master Martin Fowler

In short, 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.

James Lewis and Martin Fowler

What is this?

This is a whole environment of a Microservices Architecture. Here you can find the implementation of a lot of "fancy" patterns that we can find like CQRS, Distributed Lock, Domain Events, etc.

Bounded Context

ContextMap.png

Architecture Diagram

HotelBookingSystemArchitecture.png

Getting Started

Start

  • Clone the repository
    • git clone git@github.com:juliofalbo/complete-microservices-env.git
  • Build the services
    • ./build.sh
  • Start the whole environment
    • ./start.sh

Note: If you want build and run just call ./start true

Stop

  • Stop all services removing all volumes
    • ./stop.sh

Note: Doing this you will loose all your data

Stack

  • RabbitMQ as a Message Broker
  • Feign to create REST Clients
  • Ribbon to Client Side Load Balance
  • Eureka to a Service Discovery
  • Sleuth and Zipkin to a Distributed Tracing
  • Hystrix to a Fault Tolerance
  • Prometheus as a Metrics Collector
  • Grafana as Metrics Analytics and UI
  • Postgres as Database
  • Flyway as Database Migration Tool
  • Splunk as Log Analysis Platform
  • Redis to handle Distributed Lock
  • Swagger to create an OpenAPI documentation

Ports

Application Port
Booking Microservice 8100, 8101, 8102
Searching Microservice 8200, 8201
Financial Microservice 8300
Frontend Microservice 8400
RabbitMQ 5672, 5673
RabbitMQ Admin UI 15672, 15673
Booking Postgres Master 5432
Booking Postgres ReadOnly Replica 5433
Financial Postgres 5434
Grafana 3000
Prometheus 9090
Splunk 8000
Netflix Eureka 8761
Zipkin 9411

Distributed Lock Test

In the root folder we have a file called CreateBookingConcurrencyTest.jmx. So, this is a JMeter that can be easily imported and the only thing that you should do is change the room id for the tests. With this test it is possible to see that the booking service is queuing the requests based on the distributed lock on Redis and treating the concurrency issue.

Links

TODO List

References