Microservices – short reference

Microservices

In contrast to the monolithic applications, microservices approach split business functionality to independent external parts, implemented with individual services (from few to hundreds).

Following aspects are essential for implementation of microservices:

  • API Gateway
  • API Management
  • Monitoring
  • Logging
  • Service registry and discovery
  • Database separation and synchronisation (MDM – Master Data Management)
  • Service balancing
  • Messaging
  • Data transfer format
  • Protocols
  • Versionning
  • Automatisation of deployment
  • Caching

API Gateway

Routes and filters requests from external consumer to services.

API gateway can create multiple APIs – to support multiple platforms.

API Management

The process of publishing, documenting and overseeing APIs in a secure, scalable environment.

Monitoring

Trace service availability.

Logging

Collect, process and present logs from services and infrastructure. Provide efficient access to service activity.

E.g. solution known as “ELK”:

Service registry and discovery

Access of consumer to services and service instances when endpoints can be dynamic, recoverable or balanced.

https://www.nginx.com/blog/service-discovery-in-a-microservices-architecture

Database separation and synchronisation (MDM – Master Data Management)

Services should not have dependencies or coupling over common database. instead – service need its database with specific scope. Common or root data need to be managed/synced/replicated with MDM – to keep consistency and constraints.

Service balancing

Multiple instances of one service can/should be automatically started when performance drops and shut down when resources not used.

Messaging

Requests for operations and data transferring with asynchronous messages. Messages can use pools of queues. Message IDs can be used to specify the request-respond relation.

Data transfer format

Data and objects can be transferred between consumer and services with different formats:

XML
pros: human-readable, specific data/fragment can be extracted by path
cons: large size

SOAP
pros: human-readable, supported by web-services, WCF and many other web-technologies
cons: large size, limited types

JSON
pros: human-readable, supported by JavaScript
cons: large size, typeless

Thrift (Apache), Protobuf (Google), Avro (Microsoft)
pros: small size (build-in binary serialization), have types, support of many languages, supports versioning
cons: required resources for compression, not human-readable

Protocols

REST

Versionning

Interface if a service should not be changed if it breaks consumer application.

E.g.: methods should not be removed, its signatures should remain the same, fields of DTO objects should not be removed or changed. But new methods can be added as well as fields in DTO objects.

When breaking changes are introduced to the service – a new version of it is published with another endpoint, the old version remain available while all consumers do not adopt the new version (then this obsolete version is removed).

Automatisation of deployment

Microservices supposed to be as fractional as reasonable possible. Amount of services with different versions can grow rapidly. Deployment and management of such infrastructure is expensive without proper automatisation.

Products

RabbitMQ

Robust messaging for applications

Eureka

Eureka is a REST based service that is primarily used in the AWS cloud for locating services for the purpose of load balancing and failover of middle-tier servers.

Consul

Service discovery, health check, key-value store

ZooKeeper

ZooKeeper is an Apache project and provides a distributed, eventually consistent hierarchical configuration store. Service register.

Microsoft Service Fabric

Service Fabric is a distributed systems platform to package, deploy, and manage scalable and reliable microservices – in many environments, including Azure or on premises, on Windows Server or on Linux.

Spring boot

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications.

Criticism, lesson learned, anti-patterns, drawbacks

  • Service should be as independent and complete as possible – no logical layers outside, common components or common database.
  • No or minimum of manual configuration or deployment.
  • Service should not be developed by horizontal teams – one team is responsible for all layers of the service (to avoid dependencies and impediments).
  • System, where application(s) depend on an external infrastructure, has many places to break: service registry and discovery, consistency of caches, maintenance of multiple databases and synchronisation MDM to keep consistency, complex deployment procedure, messaging performance and availability, service-balancer.

https://www.infoq.com/articles/seven-uservices-antipatterns

Caching

Caching improves performance reducing amount or requests to databases and other services. Keeping cache consistent and up-to-date is critical and challenging task.

Resources

https://thrift.apache.org
http://www.spinnaker.io/docs
https://github.com/Netflix/Priam
https://github.com/Netflix/eureka/wiki/Eureka-at-a-glance
https://developers.google.com/protocol-buffers/docs/overview
RabbitMQ QOS vs. Competing Consumers
https://visualstudiomagazine.com/articles/2015/10/02/microservices-csharp-part-2.aspx
https://visualstudiomagazine.com/articles/2015/09/30/microservices-csharp.aspx
Microservices with C# and RabbitMQ
https://azure.microsoft.com/en-gb/documentation/articles/service-fabric-overview
http://www.cakesolutions.net/teamblogs/microservice-architecture-framework
https://www.nginx.com/blog/microservices-at-netflix-architectural-best-practices
https://www.nginx.com/blog/time-to-move-to-a-four-tier-application-architecture
https://channel9.msdn.com/Events/Ignite/Australia-2015/ARC334
http://www.developer.com/design/how-to-partition-your-data-between-microservices.html
http://massivetechinterview.blogspot.no/2015/09/avro-vs-protocol-buffers-vs-thrift.html

API Gateways to Direct Microservices Architecture


https://smartbear.com/learn/api-design/api-gateways-in-microservices
https://azure.microsoft.com/en-us/documentation/articles/service-fabric-add-a-web-frontend/
http://microservices.io/patterns/microservice-chassis.html
https://www.nginx.com/blog/service-discovery-in-a-microservices-architecture/
https://auth0.com/blog/an-introduction-to-microservices-part-1  (part 2 and 3)
https://spring.io/blog/2015/07/14/microservices-with-spring
http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-documentation

ProtoBuf

releases, nuget dll, nuget compiler

Supports C# within version 3.0

 

Facebooktwittergoogle_plusredditpinterestlinkedintumblrmail

Leave a Reply

Your email address will not be published. Required fields are marked *