Building Scalable Java Microservices with Spring Boot and Spring Cloud

Introduction to Microservices Architecture

  • Microservices are becoming a new trend. They are a form of service-oriented architecture style wherein applications are built as a collection of different smaller services rather than one whole app.
  • Instead of a monolithic app, several independent applications run on their own and create using different coding or programming languages.

Monolithic Application Architecture

Monolithic Applications are heavyweight, slow to deploy, have testing issues, hard to scale up the individual parts of applications.

Microservices Rules Monolithic

  • Compostable
  • Independently scale up services
  • Focus on one or multiple Microservices
  • Deployment with Docker containers
  • Spring Framework for creating Microservices
  • Setup new service by using Spring Boot
  • Expose resources via a RestController
  • Consume remote services using RestTemplate

Spring Cloud Features

  • Building block for Cloud and Microservices.
  • Provides Microservices infrastructures like delivering use services such as service discovery, configuration server and monitoring.
  • Offering several other open source projects like Netflix OSS, PaaS like Cloud Foundry, AWS, and Heroku using Spring Boot style starters.

Business Challenge for Building Microservices

  • Work on the code to analyze the meaning of metrics.
  • Validate your measurement system regarding accuracy and precision. Collect histograms of Response Time.
  • Monitoring systems need to be more available and scalable.
  • Optimization for monitoring distributed, ephemeral, containerized microservices.

Solution Offered for Building Scalable Microservices

Monitoring Tool to get Time Series Database, metrics collector, visualize the data for each running container –

Monitoring with Prometheus

Prometheus is a service monitoring system that collects metrics from configured targets at given intervals, evaluates rule expressions, displays the results, triggers alerts if some condition is observed to be true.

Database Monitoring and Analysis with InfluxDB

InfluxDB is an open-source Time Series database for recording metrics, events, and analytics.

Monitoring Kubernetes with CAdvisor

CAdvisor is an open-source tool to monitor Kubernetes resource usage and performance. It discovers all the deployed containers in the Kubernetes nodes and collects the information like CPU, Memory, Network, file system. CAdvisor provides us with a visualize monitoring web dashboard.

Technology Stack

  • Prometheus
  • Elastic Search
  • Influxdb
  • Grafana
  • Kibana
  • CAdvisor
  • Spring
  • Spring Cloud
Read more