PiggyMetrics is a popular open source end-to-end sample which demonstrates the use of Spring Boot and Spring Cloud features in a microservices-style application. Spring Boot and MicroProfile are popular competing frameworks for building apps in the cloud-native microservices style. Functionally, architecturally, and historically they have many things in common. From a business, economic and governance perspective they have significant differences. This session from Java Champions Ed Burns and Emily Jiang, respectively of Microsoft and IBM, briefly surveys the history and non-technical aspects in comparing the Spring Boot and MicroProfile stacks and then will take you through a real world case study based on PiggyMetrics. We will share our experience of porting it from Spring to MicroProfile.
PiggyMetrics models a personal finance application and uses cloud native microservices features such as externalized configuration, aggregate logs, service metrics, security propagation, and distributed tracing. The porting exercise utilizes MicroProfile features such as Config, Metrics, Health Check, Fault Tolerance, Open Tracing and JWT Propagation along with Jakarta CDI, REST and JSON Binding.
Join Ed and Emily for a fun and informative compare and contrast ride.
What We Learned from Porting PiggyMetrics from Spring Boot to MicroProfile
1. What We Learned from Porting
Piggymetrics from Spring Boot
to MicroProfile ?
Ed Burns
Principal Architect, Microsoft
Java EE on Azure
@edburns
Emily Jiang
Senior Technical Staff Member, IBM
Liberty Microservice Architect,
Advocate
MicroProfile Senior Lead @IBM
@emilyfhjiang
B
2. Our Plan for Your Time Investment
1. Introduction on PiggyMetrics
2. Demo of PiggyMetrics running on Spring boot
3. Convert PiggyMetrics from Spring Boot to MicroProfile
4. Demo of PiggyMetrics running on Open Liberty
5. Conclusion
B
3. Roles
B
Ed Burns
Corporate LOB App Developer
Inherited Spring Based LOB app
Need to convert it to MicroProfile to
reduce OpEx
Emily
MicroProfile Consultant
Microservices Expert
B
4. What is PiggyMetrics?
A tutorial project, initiated by Alexander Lukyanchikov, demonstrating Microservice Architecture Pattern using
Spring Boot, Spring Cloud and Docker.
https://github.com/sqshq/piggymetrics
J
7. Observations
● A way to boot yourself into Spring
● Pre-date microservices
● Works well with Spring-Cloud
● Follows Spring development governance model
● No separation of interface from implementation.
● Only one supplier: vendor-locking
B
20. API
MicroProfile Open API
All JAX-RS endpoints
have Open API doc
generated.
Open Liberty has Open
API UI for invocation.
J
https://openliberty.io/guides/microprofile-openapi.html
21. Distributed Tracing
Spring Cloud Sleuth
If the Spring cloud sleuth is configured on the class path, the
trace information will get generated automatically.
MicroProfile Open Tracing
If MicroProfile Open Tracing feature is enabled, the
trace information will get generated automatically.
J
https://openliberty.io/guides/microprofile-opentracing.html
23. One Sprint Later
Re-built with MicroProfile Open Liberty
B
•PoC only, support MVP user scenarios
•Spring/Spring Cloud features are replaced with
equivalent ones from Open Liberty
•Deployed and running on AKS
•Leverage service discovery from Kubernetes
•API Gateway is implemented with Rest Client
•Network traffic secured by JWT
Azure Kubernetes
Service
24. Demo of running PiggyMetrics on
Open Liberty with MicroProfile
B
25. Technologies used
Eclipse MicroProfile
• Config (gateway, auth-service,
account-service, statistics-service)
• Fault Tolerance (statistics-service)
• Health (gateway, auth-service, account-service,
statistics-service)
• Metrics (gateway, auth-service,
account-service, statistics-service)
• JWT (gateway, auth-service, account-service,
statistics-service)
• Rest Client (gateway, account-service,
statistics-service)
• Open Tracing (gateway, auth-service,
account-service, statistics-service)
• Open API (gateway)
• JAX-RS (gateway, auth-service,
account-service, statistics-service)
• JSON-B/JSON-P (gateway, auth-service,
account-service, statistics-service)
• CDI (gateway, auth-service, account-service,
statistics-service)
•Java EE 8
• Security (auth-service)
•Eclipse JNoSQL
• Artemis (auth-service, account-service,
statistics-service)
•Zipkin for distributed tracing
•Prometheus/Grafana for metric collection/visualization
•ELK for log aggregation & analysis
B
27. Takeaway
Developers should be free to choose what
works for them they prefer
Enterprise should provide developers with
platforms that enable innovation and
flexibility and are enterprise and production
ready
Liberty supports both MicroProfile/EE and
Spring
Fast, small, reliable runtime
Optimized for containers and cloud
True liberty for microservice developers
and administrators
Spring is popular
MicroProfile and Jakarta EE are evolving rapidly
(and gaining momentum) as community-driven
and standards-based efforts for developing
microservices and cloud-native applications in
enterprise Java
Both Spring and MicroProfile provide facilities
for developers to build next-generation
applications for cloud
Share similarities
There are differences too (and sometimes,
significant)
Lightweight runtimes for Java/Jakarta EE are
readily available nowadays
B
28. MicroProfile Impl
APIs
Open Source
Driven by Community
Open standards
Behaviors in accordance
specifications
Lines of Code
Customize server configuration
Less code
Libraries/Depe
ndencies
Runtime provides what is needed
per specification
Smaller image
Application
Packaging
Thin WAR
Spring Impl
Open Source
Driven by VMWare
Convention over configuration
Do what you want/need with code
(and configuration)
Find, mix and match what you like
Manage your own dependencies
Fat JARs, Small JARS (Jib for
containers)
B
29. References
● Jianguo’s Piggymetrics on MicroProfile https://github.com/majguo/piggymetrics
● Original PiggyMetrics on Azure Spring Cloud https://github.com/Azure-Samples/azure-spring-cloud
● Migration guide
https://www.ibm.com/blogs/bluemix/2018/09/migrate-java-microservices-from-spring-to-microprofile-p1/
● Comparison guide https://www.eclipse.org/community/eclipse_newsletter/2019/september/microprofile.php
● MicroProfile Starter https://start.microprofile.io/
● Spring Starter https://start.spring.io/
● OpenLiberty Home https://openliberty.io
B