Spring Boot actuator "system.cpu.usage" vs "process.cpu.usage" - spring-boot

I am using spring boot 2.3.2. With help of actuator, publishing the application metrics to metrics console. I would like to know what is the difference between system.cpu.usage and process.cpu.usage metrics polished by the actuator.

Based on source code
system.cpu.usage -- The recent cpu usage for the whole system
process.cpu.usage -- The recent cpu usage for the Java Virtual Machine process
For more info about these metrics you can look at java doc of this bean OperatingSystemMXBean

Related

How can I show the build and application version in quarkus application?

Like Spring Boot Actuator Info endpoint, is it possible to show the application version and build info in quarkus application?
I don't think there's anything like that in Quarkus at the moment. You'll probably have to create the properties in your application.properties and add them in the responses, for example.
Configuring Your Application - Quarkus guide
Try using Micrometer Metrics library. Might not have all the metrics and info you are looking for, but you will get plenty of information.
Micrometer - https://quarkus.io/guides/micrometer
SmallRye Health - https://quarkus.io/guides/smallrye-health - Health Check
Build Info(Maven Goal) - https://quarkus.io/guides/maven-tooling#project-info
I guess these all should help.

Opentelemetry agent vs spring cloud sleuth

I’m looking for some distributed tracing technologies for our spring boot services, in the internet, I see we have 2 popular choices I.e opentelemetry agent and spring cloud sleuth.
I see both of the them have good integration support, I’m confused to which one to go for, please give me some suggestions
As of today, you can find the following announcement on the Sleuth's Spring page:
Spring Cloud Sleuth’s last minor version is 3.1. You can check the 3.1.x branch for the latest commits. The core of this project got moved to Micrometer Tracing project and the instrumentations will be moved to Micrometer and all respective projects (no longer all instrumentations will be done in a single repository).
Additionally, sleuth is not playing nicely when trying to integrate tracing with other java-but-not-spring-exclusive libraries. To afford any such implementation you would need to configure Sleuth to use the open-telemetry tracer.
Thus, my advice would be to go for open-telemetry, unless you have an exclusive reason not to do that.
As for my current approach, I was introducing otel into an established project that is due for a Spring Boot 3 migration next year. I thus opted to use non-sleuth Spring otel libraries to avoid coupling with Sleuth in this short period.
I am not sure if that's a good approach, but with a lack of proper Spring 2 -> 3 migration, this way will not be a blocker until you can migrate other deps over

Spring boot 2.0 onwards taking a lot of time to bind configuration properties given size of properties is approx ~7000

We have customized Spring cloud config as a centralized solution for enterprise as a result of which there are around 700 repos onboarded to our config server. It adds up to approx 7000 spring configuration properties and it will keep increasing. This used to work pretty fast in spring boot 1.5 but post-spring boot 2.0 Its taking a lot of time to map the configuration properties.
I am trying to upgrade it to Spring boot 2.1.8 along with spring cloud config 2.1.4 but application startup time and context refresh time has drastically increased when compared to spring boot 1.5.x.
Is there a way we can switch off relax binding or other mapping features and use it similar to spring boot 1.5?
I don't have an experience of managing such a big amount of properties, however I have some ideas that can be useful and point to the solution:
Why do you think its property resolution/relaxed binding rules? Maybe there are some more beans that get loaded and some of them are slow, all the can "contribute" to the slow startup time.
For modern machines 7000 properties is not such a big amount. So the chances are that even there was some performance degradation between spring boot 1.x and 2.x (in which I hardly believe) - it still won't be a "considerable" amount of time.
Since you've mentioned spring cloud config - it has a rest API that can by itself be checked for performance. If you have an actuator on the cloud config server, there is an endpoint that returns 50 last requests along with their execution times. So please check the execution times and compare between spring boot 1.5.x and 2.0.x
Last but not least - try to profile the application and see which beans are the real time consumers.

BPMN for spring boot 2

We have started new project on spring stack and using latest versions. But we have workflow requirement and I used activiti in past. But as I see there is no spring boot 2 support for activiti and camunda. Can anybody suggest which BPM is best that can be integrated with spring boot 2.
You will find a bunch of Spring Boot 2 starters in the Flowable github repo.
The documentation explains step-by-step how to create a BPM enabled Spring Boot application. There is also the blog post The road to Spring Boot 2.0 that the improved support for Flowable within Spring Boot as part of the Flowable 6.3.0 release.
You ask for suggestions on which BPM is best. Well, I cannot be objective since I am part of the Flowable Team, but I can say that our Spring Boot implementation is pretty neat:
All engines are supported (BPMN, CMMN, DMN), both embedded and exposing their respective REST APIs.
There is an automatic configuration of Spring Security to use the Flowable IDM engine (in case no other custom security is configured).
There is no "EE" version of the starter. Flowable provides Spring Boot 2 support 100% Open Source.
The Spring Actuator integration is quite powerful.
Did I mention Open Source? ;-)
In order to get the all engines you would need to use the flowable-spring-boot-starter(-rest) dependency. The (-rest) needs to be used if you want the Flowable REST APIs to be automatically configured.
There is also the option to run the BPMN, CMMN or DMN engines in standalone mode. For that you would need one of the following dependencies:
flowable-spring-boot-starter-process(-rest)
flowable-spring-boot-starter-cmmn(-rest)
flowable-spring-boot-starter-dmn(-rest)
So, compare for yourself, but for me, it's pretty clear and of course I am open to discussion.
The Activiti is working on Activiti Cloud fully based on Spring Boot 2 and Spring Cloud Finchley (targeting kubernetes deployments, but it can be used outside kubernetes if that is not your thing) if you are looking for a BPMN runtime for Cloud Native applications. We are working hard on releasing the first Beta1 release at the moment, and we will very welcome feedback about it. Hope this helps.
If you use the camunda-bpm-spring-boot-starter you can write self contained services running camunda process engine with spring boot 2.

Spring Boot 2.x Metrics classes

I have started using spring boot 2.0.0-Snapshot and I see that all Metric related classes and interfaces does not exists ?
Example:
The jar spring-boot-actuator-2.0.0.BUILD-SNAPSHOT.jar does not have package
org.springframework.boot.actuate.metrics.writer at all
Are they moved to somewhere else?
In Spring Boot 2 the previous metrics implementation has been replaced by integration with Micrometer. From the release notes:
Spring Boot’s own metrics have been replaced with support, including auto-configuration, for Micrometer and dimensional metrics. You can learn more about Micrometer in its user manual and Spring Boot’s reference guide
I can't find any guide for migrating from 1.x Spring Boot Metrics to 2.x Spring Boot Metrics but this change is quite recent so I suspect any such docs are a TODO. In the meantime, you could perhaps dig into the Pull Request or follow the Spring Boot 2 docs ...
Micrometer provides a separate module for each supported monitoring system. Depending on one (or more) of these modules is sufficient to get started with Micrometer in your Spring Boot application. To learn more about Micrometer’s capabilities, please refer to its reference documentation.

Resources