Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Microservices
• Micro services is a service-oriented architecture pattern wherein
applications are built as a collection of various smallest
independent service units.
• Microservice Architecture is an architectural development style
that allows building an application as a collection of small
autonomous services developed for a business domain.
• Monolithic architecture is like a big container in which all the
software components of an application are clubbed into a single
package .
• In a Microservice, every unit of the entire application should be the
smallest, and it should be able to deliver one specific business goal
In Monolithic architecture, large code base can slow down the
entire development process. New releases can take months. Code
maintenance is difficult.
• Microservice architecture is a form of service-
oriented architecture (SOA) whereby software
applications are built as a collection of loosely
coupled services, as opposed to one monolithic
software application. Each microservice can be
created independently from the other, or even
in a completely different programming language
and run on their own.
• At the core of it all, each microservice tries to
satisfy the specific user story or business
requirement that you‘re working on.
• A popular way to implement microservices is to
use protocols such as HTTP/REST alongside
JSON, as an architectural design pattern
Microservice Architecture
Benefits of Microservice Architecture
API gateway
API Gateway. The API gateway is the entry point for clients.
Instead of calling services directly, clients call the API
gateway, which forwards the call to the appropriate
services on the back end.
Advantages of using an API gateway include:
• It decouples clients from services. Services can be
versioned or refactored without needing to update all of
the clients.
• Services can use messaging protocols that are not web
friendly, such as AMQP.
• The API Gateway can perform other cross-cutting functions
such as authentication, logging, SSL termination, and load
balancing.
Deployment patterns
Multiple service instances per host - deploy multiple service
instances on a host
Service instance per host - deploy a single service instance on
each host
Service instance per VM - a specialization of the Service
Instance per Host pattern where the host is a VM
Service instance per Container - a specialization of the Service
Instance per Host pattern where the host is a container
• It is a fairly traditional approach where you have a machine
which could be physical or virtual and you run multiple
service instances on this host. Each service instance could
be a process like JVM or Tomcat instance, or each process
may be comprised of multiple service instances. For
example, each service instance could be a var file and you
run multiple var files on one tomcat Some of the benefits of
using this pattern are
• Efficient resource utilization: You have one machine with
multiple services and the whole resource is shared
between these different services
• Fast deployment: In order to deploy a new version of your
service you simply have to copy that to the machine and
restart the process
• Some of the drawbacks of using this pattern
are :
• You get little to no isolation between various
service instances
• Poor visibility on how the services are
behaving like memory and CPU utilization
• Difficult to constrain the resources a particular
service can use
• Risk of dependency version conflicts
• To have a greater isolation and manageability
we can host a single service instance in a
single host at the cost of resource utilization.
This pattern can be achieved by two different
ways: Service Instance per Virtual Machine
and Service Instance per Container
Service Instance per Virtual Machine
Some of the benefits of packaging services as virtual machines are :
You get great isolation as the virtual machines are highly isolated with
each other
You get greater manageability as virtual machine environment has
great tools for management
Virtual machine encapsulates the implementation technology for the
microservice. Once you package the service, the API for starting and
stopping the service is your virtual machine interface. The
deployment team need not to be knowledgeable about the
implementation technology
With this pattern you can leverage cloud infrastructure for auto-scaling
and load balancing
Some of the drawbacks of using this pattern are :
With virtual machines, we get less efficient resource utilization and
thus increases the cost
The process of building a virtual machine image is relatively slow
because of the volume of the data needed to be moved around the
network and thus slows the deployment process
Service Instance per Container