What we see with microservices is an isolated component, communicating over a protocol over the wire to a parent consumer of that component.
We see a very similar pattern with EJB 1.0.
My question is: Is the Microservices architectural Pattern similar to EJB 1.0?
The API Gateway pattern defines how clients access the services in a microservice architecture. The Client-side Discovery and Server-side Discovery patterns are used to route requests for a client to an available service instance in a microservice architecture.
A microservices architecture consists of a collection of small, autonomous services. Each service is self-contained and should implement a single business capability within a bounded context. A bounded context is a natural division within a business and provides an explicit boundary within which a domain model exists.
The EJB stands for Enterprise Java beans that is a server-based architecture that follows the specifications and requirements of the enterprise environment. EJB is conceptually based on the Java RMI(Remote Method Invocation) specification. In EJB, the beans are run in a container having four-tier architecture.
Characteristics of MicroservicesEach component service in a microservices architecture can be developed, deployed, operated, and scaled without affecting the functioning of other services. Services do not need to share any of their code or implementation with other services.
While there are some similarities to the ideas behind the original EJB spec and what is being done with Microservices, there are many differences.
EJB provided a standardized way of building component-based architectures, with contracts to ensure the products of a bean can be consumed by other architectures, while abstracting away transaction, state, and thread management. The idea of building components is very similar; the biggest change is we are now calling them "services." The idea of contract-based development is also similar.
Some of the high level differences are provided below:
The specification for EJB states: "Enterprise beans are intended to be relatively coarse-grained business objects." This is in contrast to a good Microservice implementation, where the best design is a bounded contexts with a single concern.
In an EJB 1.x architecture, the container is the persistence provider; while in a Microservice architecture, each service manages its own data and persistence.
With the Microservice pattern, transaction management is simplified by minimizing your the scope and never having transactions cross Microservice boundaries.
With Microservices, thread pools are per service or instance of the service. If the thread pool is exhausted, ideally you spawn another instance of the service. In an EJB 1.x environment, the thread management is the responsibility of the container.
There are many other differences between the Microservice architecture and the EJB 1.x architecture, but these are some highlights. I have worked with implementations of both architectures, and the maintenance costs of a Microservice architecture appear to be lower so far. Especially when considering the mess EJBs have become within monolithic architectures.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With