Spring BOOT autoscaling with actuator metrics - spring

I want to automatically scale my Backend Spring Boot application using actuator metrics such as: jvm.threads.live, jvm.memory.used, process.cpu.usage. My application is deployed in a kubernetes cluster, for this I use the HPA controller in my cluster. How do I get these metrics and configure my HPA yaml file to monitor and observe these parameters and add a threshold for each metric.

You can use prometheus adapter for k8s API to be able to use actuator's metrics in HPA. Here's an example of usage.
You need such an intermediate agent as Prometheus, as it does many necessary things for you, such as collecting these metrics from all pods within the autoscaling group, storing metrics, and providing query language to define an autoscaling policy.

Related

Spring Actuator Prometheus: visualize available metrics

I have an endpoint /api/actuator/prometheus that returns registered metrics in Prometheus format.
Is it possible to format this document prettily and host it on GitLab Pages?
I want to do something similar as Open API does but for available Prometheus metrics.

How to deploy Spring Cloud Data Flow on AWS EKS

Are there any document for deploying Spring Cloud Data Flow on AWS EKS? I am looking for example or guide video about this problem.
There are no special instructions for running SCDF on EKS or any other K8s distribution. As far as you have a K8s cluster and the necessary service accounts, you will be able to provision SCDF on a given namespace.
You can either use the release-tagged deployment YAMLs directly or the SCDF's Bitnami Helm chart. Depending on your customization needs, you'll find the deployment YAMLs more flexible, though.

adding end points in prometheus integration

How to add/integrate rest api end points in prometheus. For eg in splunk we are monitoring micro services transactions and logs.
Lets say below spring boot:-
/abc/v1/something
/abce/v1/something2
In one line :-how can we add above micro services end points to prometheus for motioning
When using Spring Boot 2, you can easily expose your application metrics for Prometheus. See here. You'd add spring-boot-starter-actuator and the Prometheus support with micrometer-registry-prometheus to your dependencies.
This will expose the metrics under /actuator/prometheus in the Prometheus exposition format to be scraped by your Prometheus instance.
Assumung you are using Spring WebMvc, then you'll get out-of-the-box metrics for your HTTP endpoints. (Jersey support is also provided with an extra module/dependency.)

Spring netflix eureka, zuul vs Spring cloud data flow

I am new to the microservice world. Would like to know when to use Spring eureka, zuul vs spring data flow.
I am building a service which in turns will consume multiple granular services(aka micro service), aggregate all the data and returns aggregated data to the consumer. All the services will run in local intranet within company infrastructure. Also, I would like to load balance individual microservices.
What should be the choice of technology for microservices deployment?
I am using Spring 4.3, Spring boot, Rest, Spring data.
I suggest this architecture:
Netflix Eureka : for Service discovery
Consul or Config Server : for saving configurations in environment base on 12 factors
Zuul : for Intelligent and programmable routing
Netflix Ribbon : for Client-Side Load Balancing
Zipkin : for tracing
Turbine : for metrics aggregation
Netflix Feign : for Declarative REST API implementation
Hysterix : for circuit breaker (one of the EIP patterns)
RabbitMQ (Spring-AMQP) or Kafka (Spring-Kafka and Kafka Stream) for having asynchronous communication style
Grafana + Prometheus + Prometheus-jmx-exporter for monitoring system
Docker : for virtualization and container base architecure
Docker Swarm or Kubernetes : for scalability, automation and Container Management
note : Prometheus is a time-series database (including monitoring features) you can also use InfluxDb or Graphite instead of it.
I think the best place to start with is to read through the overview of all these projects here to get a better understanding of the objectives each of these projects achieve.

Spring Actuator - metrics aggregation from docker containers

I have a Spring Boot REST service application. This application uses Spring Actuator to display metrics and health information. How can I aggregate this information from two or more containers running the same application?
You need to export the metrics to a central system.
Spring Boot provides a couple of implementations of a marker interface
called Exporter which can be used to copy metric readings from the
in-memory buffers to a place where they can be analyzed and displayed.
More specifically personally I like exporting metrics to statsD
To export metrics to Statsd, make sure first that you have added
com.timgroup:java-statsd-client as a dependency of your project
(Spring Boot provides a dependency management for it). Then add a
spring.metrics.export.statsd.host value to your application.properties
file. Connections will be opened to port 8125 unless a
spring.metrics.export.statsd.port override is provided. You can use
spring.metrics.export.statsd.prefix if you want a custom prefix.
The information above is all from the Spring Boot documentation on metrics: https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-metrics.html

Resources