0% found this document useful (0 votes)
0 views6 pages

Java Microservices

Java microservices are small, independent applications that work together to form a larger system, utilizing frameworks like Spring Boot for development. They offer advantages such as scalability, resilience, and flexibility, allowing for independent updates and easier debugging. Key concepts include service discovery, API gateways, load balancing, and event-driven architecture, which enhance communication and resource management within microservices architecture.

Uploaded by

hmcrazy121
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views6 pages

Java Microservices

Java microservices are small, independent applications that work together to form a larger system, utilizing frameworks like Spring Boot for development. They offer advantages such as scalability, resilience, and flexibility, allowing for independent updates and easier debugging. Key concepts include service discovery, API gateways, load balancing, and event-driven architecture, which enhance communication and resource management within microservices architecture.

Uploaded by

hmcrazy121
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Microservices in Java

Java microservices ⟶ are a set of small, independent applications written in Java that
work together to form a larger system. Each microservice has a specific, limited scope
and runs in its own process, communicating with other services using lightweight
protocols like HTTP or messaging. Spring Boot, Jersey, and Swagger are some Popular
Java frameworks used for building microservices.

Language agnostic ⟶Services can be written in different programming


languages
Scalability ⟶ Individual services can be scaled independently based on demand
Resilience ⟶ Failure of one service does not impact others
Flexibility ⟶ Services can be modified, updated or replaced independently

Microservice architecture helps you to break large components into sub-


components ( Services ) thus making debugging easier and also helps in the
functioning.

1. Any changes in the code lead you to test the entire application.
2. Developers may not have knowledge of all the modules and that's making it
harder to get started with any module and also fix any issues.

Different services have an different database and servers so it won’t affect others...

Endpoint help us to moniter our services and independently.

Why Spring Boot For Microservices Development ?

1. Embedded Server
2. Support Load Balancer ⟶ Auto scaling
3. Auto Configuration ⟶ session, connection etc..
4. Minimal Code using Annotations
5. Loose Coupling
6. Dependency Management
7. Open Source

Auto-scaling means that there are lots and lots of loads coming to one particular
service like some more customers coming in and logging into the application

Inversion Of Control ( IOC ) :

It is responsible for managing the lifecycle of beans( Objects ) and their


dependencies.

1.Service Discovery:

IP and port number of Service-B. All detailed information will be there with
Discovery Service.

Providing a database of available service instances so that services can be


discovered, registered, and de-registered based on usage.

Service Registry :

All the services whenever they are starting off they are registering themselves with
the discovery service and now the discovery service is maintaining all their
information inside a particular map or a list or a database.

Client sending ( Http Request ) ⟶ Load Balancer ⟶ Check Service discovery ( IP


address, Instance list.. )

Client-Side Service Discovery Example: Netflix Eureka, Zookeeper, Consul


Server-Side Service Discovery Example: NGNIX, AWS ELB

Key Terminologies:

Eureka: It is the service registry and discovery server and it can provided by
Netflix. It can allow the microservices to register themselves and discover the
other services dynamically. It can enable easy communication between the
services in the distributed environment.
Service Registry: The service registry is the database containing the network
locations of the service instances. It can allows the services to the register
themselves when they become the available and deregister when they are no
longer available.
Service Discovery: It is the process of the dynamically finding and locating the
available service instances within the distributed system. It can allowing the
services to the communicate with the each other without the hardcoding their
network locations.
Eureka Server: It is the service registry server can provided by the Netflix
Eureka. It can hosts the registry of the available microservices and it can
provides the interface for the service registration, discovery and health
monitoring.
Eureka Client: It is the library that can enables the microservices to the registry
itself with the Eureka server and discovery the other services registered with
the server. It can provides the integration with the Spring boot applications to
the enable the service registration and discovery.
Instance Registration: It is the process by the which the microservices registers
itself with the Eureka server upon the startup. It can includes the providing the
metadata such as the service name, host, port, health status etc.
Instance Deregistration: It is the process by the which a microservices removes
itself from Eureka sever registry when it shuts down or becomes the
unavailable.
Service Name: It is the unique identifier assigned to the microservice. It can be
used by the other services to the discover and communicate with the
microservice.
Load Balancing: It is the process of the distributing incoming requests across
the multiple service instances to the ensure optimal resource utilization and
high availability. Eureka can provide the client side load balancing by the
providing the list of the available service instances to the client.

2.API Gateway : It is basically the entry gate for taking entry into any application by
an external source.

It provides a flexible way of routing requests based on a number of criteria, like


security, resiliency, and monitoring.

Below are some feature/purpose of API Gateway..

Authentication and Authorization


Rate Limiting and Throttling
API Gateway Security Headers
Input Validation and Sanitization
Logging and Monitoring
Encryption
Microservice Communication Security:

3.Load Balancing :

Distribution of network traffic or incoming requests among different instances of an


application, deployed on different servers or even different geographical areas

The goal is to optimize response time, and avoid overload per unit.

Client-Side Load Balancing ⟶ Decision about which instance of the service to


route the request to is made by the client itself.
Server-Side Load Balancing ⟶ Receives requests from clients and routes them
to available service instances.

Below are some feature/purpose of API Gateway..

High Availability and Fault Tolerance


Dynamic Scaling of the microservices
Performance Efficiency
Traffic Management
Simplified Service Discovery
Multi-Region Deployment

4.Circuit Breaker

The Circuit Breaker is the mechanism that prevents the application from repeatedly
trying to execute the operation that is likely to fail the application.

It monitors the number of recent failures and when the threshold is reached, breaks
the circuit and stops the operations for the predetermined period.

Tools for implementing the Circuit Breakers are Hystrix and Resilience4j.
5.Messaging and Event-Driven Architecture

Microservices often need to communicate with each other to perform various


tasks such as exchanging data, triggering actions, or notifying events.
Message queues provide an asynchronous communication system where tasks
can create and execute messages independently.
This approach can increase the scalability, fault tolerance, and efficiency of
microservices by allowing them to run independently without immediately
waiting for responses from other services

Some Messaging Queue Providers :

1. Apache Kafka

2. RabbitMQ

6.Deployment:

AWS Elastic Beanstalk is a fully managed service that simplifies the deployment,
operation, and scaling of web applications and services in the AWS Cloud.

AWS Elastic Beanstalk is an ideal solution for deploying Spring Boot applications
because it provides a straightforward and cost-effective approach to execute and
grow Java web apps without worrying about the underlying infrastructure.

Advantages of Java Microservices

Here are some advantages of java microservices:

Scalability: Services can be independently scaled to meet demand.


Flexibility: Allows the use of different technologies and languages best suited for
each servic e.
Resilience: Failure in one service does not impact the entire system, improving
fault tolerance.
Faster Development: Independent teams can develop, test, and deploy services
simultaneously, speeding up the overall development process.
Continuous Deployment: Facilitates continuous integration and continuous
deployment (CI/CD) for rapid and reliable updates.
Improved Resource Utilization: Efficiently uses resources by allocating them
based on service needs.
Simplified Maintenance: Smaller, manageable codebases make it easier to
maintain and update individual services.
Autonomous Teams: Teams can work independently on different services,
improving productivity and focus.
Enhanced Security: Fine-grained security controls allow for tailored security
policies for each service.
Cloud-Native Capabilities: Designed to leverage cloud services and infrastructure,
optimizing for cloud environments.
Ease of Deployment: Services can be deployed independently, reducing downtime
and simplifying updates.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy