Microservice Workshop
Hands on
Ram G Suri / Rajat
Agenda
● Different Styles of maintaining code repositories
● Around API’s
● Spring Boot Overview
● Deployment of Microservices
● Hands On - Let’s spin up services
Different Styles Of Maintaining Code Repository(s)
Mono Repository / Multiple Repositories
What we are trying to achieve
We are working on an ECommerce application using microservice architecture.
We used technologies like Java / Go for our microservices.
We created DevOps pipeline for those services independently.
The main problem was whether to keep all the services in the same repository in separate
folders (Mono repository) or to keep separate repositories for each of the services
(Multiple repositories).
MonoRepo Multiple
Repo
Pros / Cons
Multiple Repo Mono Repo
● Clear ownership Better development and debugging
● Smaller codebase Easy sharing of common codes
● Narrow clones Easy
reactoring and reviews
● Small artifact size Huge artifact size
● Difficult development and debugging Large code base
● Sharing of common codes Greater Clone time
Around API’s
“Bootiful” Applications With Spring Boot
Convention Over Configuration
Be opinionated out of the box, but get out of the way quickly as requirements
start to diverge from the defaults.
No code generation / No XML configuration.
Standalone-Spring applications.
Automatic configuration.
Non functional features
Provide a range of non-functional features that are common to large classes of
projects
( e.g. embedded servers, security, metrics, externalized configuration
{spring profiles}
)
….no need to deploy war files
Spring boot actuator ~ Production Ready features
You can choose to manage and monitor your application by using HTTP endpoints or with JMX.
Auditing, health, and metrics gathering can also be automatically applied to your application.
Monitoring endpoints
● /health
● /info
● /metrics
● /mappings
Starter Pom
Packaging For Production
$ java -jar yourapp.jar
No unpacking or start scripts required
Typical REST app ~10Mb
Cloud Foundry friendly (works & fast to upload)
How it helps ?
● Dramatically reduces boilerplate code
● Simplifies integration testing
● Simplifies environment maintenance
● Simplifies configuration
Pain Areas ?
When number of microservices increases ?
Communication between microservices / Integrating Microservices
Distributed tracing a request among microservices.
Deployment of Microservices
● Ability to deploy/undeploy independently of other microservices.
● Must be able to scale at each microservices level (a given service may get more
traffic than other services).
● Building and deploying microservices quickly.
● Failure in one microservice must not affect any of the other services.
Docker :
● Package the microservice as a (Docker) container image.
● Deploy each service instance as a container.
● Scaling is done based on changing the number
of container instances.
● Building, deploying, and starting microservice will be much faster
as we are using Docker containers.
Some Other Stuff
https://12factor.net/
Hands On
Agenda :
1. Create Standalone app
2. Create RESTful Controller
● GET
● POST
3.
Team 1
Catalogue
- save a new item
- get all items from catalogue
Team 2
Shipping
- save shipping address
- get shipping address
Team 3
Proceed to checkout
- Create an order
- Cancel an order
Thank You

Microservice Workshop Hands On

  • 1.
  • 2.
    Agenda ● Different Stylesof maintaining code repositories ● Around API’s ● Spring Boot Overview ● Deployment of Microservices ● Hands On - Let’s spin up services
  • 3.
    Different Styles OfMaintaining Code Repository(s) Mono Repository / Multiple Repositories
  • 4.
    What we aretrying to achieve We are working on an ECommerce application using microservice architecture. We used technologies like Java / Go for our microservices. We created DevOps pipeline for those services independently. The main problem was whether to keep all the services in the same repository in separate folders (Mono repository) or to keep separate repositories for each of the services (Multiple repositories).
  • 5.
  • 6.
    Pros / Cons MultipleRepo Mono Repo ● Clear ownership Better development and debugging ● Smaller codebase Easy sharing of common codes ● Narrow clones Easy reactoring and reviews ● Small artifact size Huge artifact size ● Difficult development and debugging Large code base ● Sharing of common codes Greater Clone time
  • 7.
  • 8.
  • 9.
    Convention Over Configuration Beopinionated out of the box, but get out of the way quickly as requirements start to diverge from the defaults. No code generation / No XML configuration. Standalone-Spring applications. Automatic configuration.
  • 10.
    Non functional features Providea range of non-functional features that are common to large classes of projects ( e.g. embedded servers, security, metrics, externalized configuration {spring profiles} ) ….no need to deploy war files
  • 11.
    Spring boot actuator~ Production Ready features You can choose to manage and monitor your application by using HTTP endpoints or with JMX. Auditing, health, and metrics gathering can also be automatically applied to your application. Monitoring endpoints ● /health ● /info ● /metrics ● /mappings
  • 12.
  • 13.
    Packaging For Production $java -jar yourapp.jar No unpacking or start scripts required Typical REST app ~10Mb Cloud Foundry friendly (works & fast to upload)
  • 14.
    How it helps? ● Dramatically reduces boilerplate code ● Simplifies integration testing ● Simplifies environment maintenance ● Simplifies configuration
  • 15.
    Pain Areas ? Whennumber of microservices increases ? Communication between microservices / Integrating Microservices Distributed tracing a request among microservices.
  • 16.
    Deployment of Microservices ●Ability to deploy/undeploy independently of other microservices. ● Must be able to scale at each microservices level (a given service may get more traffic than other services). ● Building and deploying microservices quickly. ● Failure in one microservice must not affect any of the other services.
  • 17.
    Docker : ● Packagethe microservice as a (Docker) container image. ● Deploy each service instance as a container. ● Scaling is done based on changing the number of container instances. ● Building, deploying, and starting microservice will be much faster as we are using Docker containers.
  • 18.
  • 19.
    Hands On Agenda : 1.Create Standalone app 2. Create RESTful Controller ● GET ● POST 3.
  • 20.
    Team 1 Catalogue - savea new item - get all items from catalogue
  • 21.
    Team 2 Shipping - saveshipping address - get shipping address
  • 22.
    Team 3 Proceed tocheckout - Create an order - Cancel an order
  • 23.

Editor's Notes

  • #10 Auto-configures the beans that are present in the classpath. This simplifies the developers work by guessing the required beans from the classpath and configure it to run the application.