Java Magazine, Jan/Feb 2016
GET GET api routes UI Service POST api booking ORACLE COM JAVAMAGAZINE JANUARY FEBRUARY 2016 81 microservices Routes Service Booking Service Advantages Let us now explore the advantages of microservices compared with a monolithic approach The most obvious advantage is that microservices lead to a more flexible decoupled architecture Each microservice can be developed independently which simplifies lifecycle and change management For example if we need to upgrade the booking service we do not have to redeploy the whole application Every microservice is a separate project with a separate repository and deployment configuration We can roll out new features iteratively thus increasing agility If over time we would like to upgrade to newer versions of Java we can upgrade each microservice separately For complex applications this is a huge benefit because it is often difficult to upgrade complex Java EE applications to a new version of the app server or to new releases of Java EE and Java SE Even better microservices allow us to gradually incorporate new technologies Last but not least microservices allow for much better scalability For example the route calculation service might get higher traffic than the booking service because users might use the route calculation more frequently than they book a reservation With microservices we can scale the booking service independently of the rest of the application This approach is a perfect fit for cloud and PaaS platform as a service environments where elastic scalability can be configured easily Scaling a microservice application in a Docker environment becomes a breeze In other words a microservices architecture is a good match for cloud enabled applications To fully exploit these benefits microservices need to be stateless Every resource such as a database object storage and so on that a microservice uses should be configurable separately usually via a connection string or environment parameters Disadvantages Microservices do not come without drawbacks Setting up and configuring Java EE projects to accompany this kind of architecture is often not trivial Actually it can require a lot of manual configuration and tracking of dependencies and it can lead to significant operational complexity Deployment becomes more complex as does testing KumuluzEE KumuluzEE addresses some of these drawbacks It automates the tasks related to configuration and deployment of microservices in a seamless way At its most basic KumuluzEE collects each microservice together with the Java EE APIs runtime into a simple standalone package JAR file providing a minimal footprint by including only those APIs and their runtimes that are actually used This enables developers to build standalone stateless self contained microservices and package them in an eficient way without the overhead of including the entire Java EE application server in each microservice Microservices created this way can be executed directly from the JRE with a minimal footprint and quick startup and shutdown times Getting Started Well now create our microservices using KumuluzEE standard Java EE and Maven First we create three Maven Figure 1 Overview of the proposed microservice architecture
You must have JavaScript enabled to view digital editions.