What are Microservices?
Microservices or Microservice Architecture is a style of architecture that organizes an application in the form of a collection of minor autonomous services that are modelled around a business domain. Every service in Microservice Architecture is self-sufficient and can implement a business capability.
What are the advantages of Microservices Architecture?
The advantages of using microservice architecture are-
- Microservice architecture can be developed and deployed in any application independently with the help of their individual functionality and services.
- The system continues to function even when one of the services of the application fails to work.
- Diverse languages and technologies may be employed to build the various services of the same application
- Individual components can be scaled according to the needs instead of scaling all the components at once.
What are some important characteristics of Microservices?
The important characteristics of Microservices are-
- The services in the system can be decoupled such that the entire application can be built, scaled, and altered as a whole.
- The components of Microservices are treated independently and thus may be swapped and upgraded easily.
- Microservices are extremely simple as they emphasis on a single business capability.
- Microservices give autonomy to teams of developers to work independent of each other, which helps to increase the speed.
- It enables repeated software releases using systematic automation that allows software creation, testing, and approval.
- Instead of focusing on applications as projects, Microservices treat applications as products to be responsible for.
- Microservices uses the right tools to carry out a job without relying on standardizations.
- Microservices allows swift development and discarding of features.
What is spring microservices?
Spring microservices are a Java microservices framework, which works with languages for Inversion of Control, Aspect Oriented Programming, and other operations.
Mention some important challenges while using Microservices?
The challenges of using Microservices are-
- It is difficult to automate all components due to a large number of smaller components.
- The huge number of small components that have to be deployed and maintained makes it difficult to supervise and identify issues.
- Management of the configurations across the various environments is difficult.
- Debugging becomes problematic as one has to review every service for an error.
- A large number of tools used to solve a problem creates issues of governance around the languages, technology, and platforms utilised for implementing, deploying, and monitoring Microservices.
Which db is preferred by Microservices based Architecture?
The type of microservice data to be stored influences the choice of database. The major types of data are ephemeral, transactional, transitional and operational. While choosing a type of database, consider the volume and duration of storage of the data. Also, consider the performance and latency needs of the microservices.
What is azure microservices?
Azure microservices are a platform to simplify building and deploying microservices-based applications. It allows developers to concentrate on building features that enhance the business value of applications using the available infrastructure and the resources. It also has features like rolling upgrades, automatic scale, and self-healing from faults.
How to create microservices in Java?
To create Microservices in Java, follow the following steps:
- Create Eureka Discovery Server using the annotation @EnableEurekaServer.
- Create Producer Microservice and register it with Discovery Service. @EnableDiscoveryClient will activate the Netflix Eureka DiscoveryClient implementation.
- Create Consumer Microservice that will find the producer service registered with Discovery Service. To do this, register it with Discovery Service and use the @EnableDiscoveryClient annotation to activate the Netflix Eureka DiscoveryClient implementation. Then request DiscoveryClient instance of Producer Microservice with the help of smart RestTemplate.
- Finally, test end-to-end result by initiating the Eureka service first and starting the discovery clients one by one.
What are some top microservice frameworks?
Top microservices frameworks are-
- Spring Boot
- Apache Camel
How to deploy docker in microservices?
To deploy Docker in microservices use the following annotation after installing a new Docker.
docker stack deploy --compose-file=docker-compose.yml webapp
How to secure microservices?
To ways to secure microservices are-
- Enabling authentication of inter-service communication on the HTTP API or using more advanced configurations.
- Encrypting sensitive data instead of sending data by plain text.
- Using a third-party tool like HashiCorp’s Vault to securely store and access data.
- Introducing authorization
What is Spring Cloud and Advantages of using Spring Cloud?
Spring Cloud is a set of tools developed by Pivotal. It builds frequently encountered patterns in building distributed systems like configuration management, circuit breakers, micro-proxy, service discovery, intelligent routing, control bus, etc. Its advantages include-
- Developers can easily adapt their design to the recognised patterns of distributed systems like service discovery, configuration management, circuit breakers etc.
- It is very simple to operate Spring Cloud.
- Developing JVM applications for the cloud is easier.
- Connecting to services and learning information on cloud environment becomes simpler.
- Redundancy is reduced.
- Load balancing is improved across multiple computing resources.
- Supports development complexities.
List some commonly used Tools for Building Microservices on All Levels?
Some commonly used tools for building Microservices on all levels are-
- API Fortress
- Amazon Simple Queue Service (SQS)
- Spring Boot
- Google Cloud Functions
- Apache Openwhisk
How Microservice is different from Webservice?
The differences between Microservices and Webservices are-
Microservices is a software architecture that is based on web services.
Web service allows the creation of application service that can be retrieved using web protocols.
Microservices are mostly employed in REST over HTTP protocol.
Webservices may be employed in REST, SOAP etc.
How to deploy microservices in AWS ?
The steps to deploy Microservices in AWS are-
- For a particular service, write a program to define the task.
- In the Load Balancer section of the EC2 Console, select the checkbox of the Load Balancer named demo
- Keep a note of the VPC attribute value on the details page.
- In the Target Group section, choose to Create a target
- Configure the Target Group using the following-
Name = [service-name] Protocol = HTTP Port = 80 VPC = select the VPC that matches your Load Balancer from the previous step.
Advanced health check settings: Healthy threshold = 2 Unhealthy threshold = 2 Timeout = 5 Interval = 6
- Select Create.
- Create another dummy Target Group to stop traffic from getting to the monolith.
- In the Listeners tab, choose View/edit rules and select + and insert a rule.
- Use the given rule criteria:
IF Path = /api/[service-name]* THEN Forward to [service-name]
- Four other rules are created to one to maintain traffic to the monolith, and others for forwards to users, posts, and threads.
api: /api* forwards to api
users: /api/users* forwards to users
threads: /api/threads* forwards to threads
posts: /api/posts* forwards to posts
- Return to the load balancer console.
- Go to the 'Clusters' menu and choose the cluster: BreakTheMonolith-Demo-ECSCluster.
- Select Create in the services tab.
- Configure the service using
Task definition = select the highest value for X: [service-name]:X (X should = 1 for most cases) Service name = [service-name] Number of tasks = 1
- In Configure ELB ensure add Load Balancer demo to ELB
- Add the services to target groups using the following configuration:
Listener port = 80:HTTP
Target group name = select your group: [service-name]
- Click on Save and then on Create Service.
- Finally, click on View Service.
How do microservices communicate with each other?
Microservices communicate with each other synchronously by creating temporary coupling or asynchronously with the help of a message bus.
What is scaling in microservices?
Scaling in Microservices refer to allowing the application to expand and reduce to meet demands of the business model. It is related to how a task is divided and processed.