Introducing
@mcolomer
marcelo.colomer@gft.com
In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralised management of these services, which may be written in different programming languages and use different data storage technologies."
A new marketing name for SOA?
WAIT!!!
Microservices & SOA
In microservices, services can operate and be deployed independently of other services, unlike SOA.
In SOA, an ESB could become a single point of failure which impacts the entire application
In SOA, services share the data storage while each service can have an independent data storage in microservices
We could think of the Microservices Architectural Style as a specialisation of SOA
A SOA can be either a monolith or it can be comprised of multiple microservices.
In Microservices the individually deployable services made it easier to apply Continuous Integration / Continuous Deployment
Structure the application as a set of loosely coupled, collaborating services
Services communicate using either synchronous protocols such as HTTP/REST or asynchronous protocols such as AMQP
Services can be developed and deployed independently of one another
Each service has its own database in order to be decoupled from other services
The Scale Cube
Decompose by business capability and define services corresponding to business capabilities.
Decompose by domain-driven design subdomain.
Decompose by verb or use case and define services that are responsible for particular actions. e.g. a Shipping Service that’s responsible for shipping complete orders.
Decompose by nouns or resources by defining a service that is responsible for all operations on entities/resources of a given type. e.g. an Account Service that is responsible for managing user accounts.
let's do microservices!!!
let's do microservices!!!
http://microservices.io
API Gateway
Service Discovery
Client-side Discovery
Server-side Discovery
Database per Service
Messaging and Remote Procedure Invocation
Cross-cutting concerns
Microservice chassis pattern Externalized configuration
Circuit Breaker
Testing patterns
Service Component TestService Integration Contract Test
Domain-driven design
Decomposition
Decompose by business capability
Decompose by subdomain
Observability
Log aggregation
Application metrics
Audit logging
Distributed tracing
Exception tracking
Health check API
Deployment
Single Service per Host
Multiple Services per Host
Access Token
Transaction log tailing
Event-driven
Event sourcing
CQRS
Shared Database
Server Side Discovery
Client side discovery
https://netflix.github.io/
Spring Boot
&
https://cloud.spring.io/spring-cloud-netflix
@SpringBootApplication
@EnableEurekaClient
@EnableFeignClients
public class Application {
...
@SpringBootApplication
@EnableEurekaServer
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
@FeignClient("bookmark-service")
interface BookmarkClient {
@RequestMapping(method = RequestMethod.GET, value = "/{userId}/bookmarks")
List<Bookmark> getBookmarks(@PathVariable("userId") String userId);
}
Eureka service registry
Eureka client
Client-Side Load Balancing with Ribbon
Docker is excellent for microservices, as it isolates containers to one process or service.
DevOps is the evolution of collaboration where the operations, development, and quality assurance teams collaborate and communicate throughout the software development process
It’s not separate role held by a single person or group of individuals.
Microservices are changing how teams are structured, allowing organizations to create teams centered on specific services and giving them autonomy and responsibility in a constrained area
Developers are responsible for creating a system to deliver the final product successfully.
To the man who only has a hammer,
everything he encounters begins to look like a nail "
Abraham Maslow
Are you really ready for microservices?