What Is Microservices – Introduction To Microservice Architecture
- Why Microservices?
- What Is Microservices?
- What is Eureka
- Features Of Microservice Architecture
- Advantages Of Microservice Architecture
Why MicroServices
Now, before I tell you about microservices, let’s see the architecture that prevailed before microservices i.e the Monolithic Architecture.
- Inflexible-We cannot use different technology in a monolithic application.
- Unreliable-If one part does not work that entire application will not work.
- Slow Development- It is slow as a comparison to microservices based application because of each and every feature built one after the other.
- Not suitable for complex application- Features of complex application have tightly coupled dependencies.
What is Microservices
The concept behind microservices is that some types of applications into small independent parts which are easier to build and maintain., every part work together. Each component is continuously developed and separately maintained and work, and the application is then simply the sum of its components. In another hand in a monolithic application every part work as one piece. Lets we create two microservice in spring boot.
What is Eureka
Eureka is a server where microservices can register themselves so others can discover them. For creating a Eureka naming server in spring boot we create a simple spring boot application and add some annotation and configuration.
1 |
SpringBootMicroserviceEurekaNamingServerApplication |
1 2 3 4 |
@SpringBootApplication @EnableEurekaServer public class SpringBootMicroserviceEurekaNamingServerApplication { |
Now we have to configure the application name and the port for the Eureka Server in application.properties.
1 2 3 4 |
spring.application.name=netflix-eureka-naming-server server.port=8761 eureka.client.register-with-eureka=false eureka.client.fetch-registry=false |
Now you can launch the Eureka at http://localhost:8761
Connect microservice with Eureka
Make these changes in microservice.
Add to pom.xml
1 2 3 4 5 |
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> |
Do some configuration in the application.properties
1 |
eureka.client.service-url.default-zone=http://localhost:8761/eureka |
Now run the microservices.
Restart all
Features of Microservice Architecture
- Componentization- Every microservice behave as an independent component which is very easy for modification.
- Autonomy- Every team member can work independently, thus increasing the speed.
- Flexibility- we can use more than one technology in a single application.
- Continuous Delivery- Help infrequent releases of an application.
- Agility- Microservice supports agile development we can develop any new feature very soon and add it.
Advantages of Microservice Architecture
- Independent Development- We can develop every component of the application independently.
- Independent Deployment – We can deploy every component of the application independently.
- Fault Isolation – If one service of the application does not work then remaining application work properly.
Recent Comments