Book Image

Mastering Microservices with Java 9 - Second Edition

Book Image

Mastering Microservices with Java 9 - Second Edition

Overview of this book

Microservices are the next big thing in designing scalable, easy-to-maintain applications. They not only make app development easier, but also offer great flexibility to utilize various resources optimally. If you want to build an enterprise-ready implementation of the microservices architecture, then this is the book for you! Starting off by understanding the core concepts and framework, you will then focus on the high-level design of large software projects. You will gradually move on to setting up the development environment and configuring it before implementing continuous integration to deploy your microservice architecture. Using Spring security, you will secure microservices and test them effectively using REST Java clients and other tools like RxJava 2.0. We'll show you the best patterns, practices and common principles of microservice design and you'll learn to troubleshoot and debug the issues faced during development. We'll show you how to design and implement reactive microservices. Finally, we’ll show you how to migrate a monolithic application to microservices based application. By the end of the book, you will know how to build smaller, lighter, and faster services that can be implemented easily in a production environment.
Table of Contents (12 chapters)

Evolution of microservices

Martin Fowler explains:

The term microservice was discussed at a workshop of software architects near Venice in May 2011 to describe what the participants saw as a common architectural style that many of them had been recently exploring. In May 2012, the same group decided on µServices as the most appropriate name.

Let's get some background on the way it has evolved over the years. Enterprise architecture evolved more from historic mainframe computing, through client-server architecture (two-tier to n-tier) to Service-Oriented Architecture (SOA).

The transformation from SOA to microservices is not a standard defined by an industry organization, but a practical approach practiced by many organizations. SOA eventually evolved to become microservices.

Adrian Cockcroft, a former Netflix Architect, describes it as:

Fine grain SOA. So microservice is SOA with emphasis on small ephemeral components.

Similarly, the following quote from Mike Gancarz, a member that designed the X Windows system, which defines one of the paramount precepts of Unix philosophy, suits the microservice paradigm as well:

Small is beautiful.

Microservices shares many common characteristics with SOA, such as the focus on services and how one service decouples from another. SOA evolved around monolithic application integration by exposing API that was mostly Simple Object Access Protocol (SOAP) based. Therefore, middleware such as Enterprise Service Bus (ESB) is very important for SOA. Microservices are less complex, and even though they may use the message bus it is only used for message transport and it does not contain any logic. It is simply based on smart endpoints.

Tony Pujals defined microservices beautifully:

In my mental model, I think of self-contained (as in containers) lightweight processes communicating over HTTP, created and deployed with relatively small effort and ceremony, providing narrowly-focused APIs to their consumers.

Though Tony only talks about the HTTP, event-driven microservices may use the different protocol for communication. You can make use of Kafka for implementing the event-driven microservices. Kafka uses the wire protocol, a binary protocol over TCP.