Java Microservices

Java microservices are a set of software applications written in the Java programming language (and typically leverage the vast ecosystem of Java tools and frameworks), designed for limited scope that work with each other to form a bigger solution. Each microservice, as the name implies, has minimal capabilities for the sake of creating a very modularized overall architecture. A microservices architecture is analogous to a manufacturing assembly line, where each microservice is like a station in the assembly line. Just as each station is responsible for one specific task, the same holds true for microservices. Each station and microservice are “experts” in their given responsibilities, thus promoting efficiency, consistency, and quality in the workflow and the outputs. Contrast that to a manufacturing environment in which each station is responsible for building the entire product itself. This is analogous to a monolithic software application that performs all tasks within the same process.

How Do Java Microservices Work?

Before discussing Java microservices, it is important to first explain microservices in general. Microservices represent a design pattern in which each microservice is just one small piece of a bigger overall system. Each microsystem performs a specific and limited scope task that contributes to the end result. Each task could be as simple as “calculate the standard deviation of the input data set” or “count the number of words in the text.” The key behind building microservices is planning the system to identify the distinct subtask, then writing applications that address each subtask. As each microservice needs to deliver output data to the next microservice, a microservices architecture often uses a lightweight messaging system for that data handoff.

Several Java-based frameworks exist that are great for building Java microservices. Some examples include:

  • Spring Boot. This is a popular framework for building Java applications, especially microservices, because it simplifies much of the setup and configuration process for getting your applications running. Get started with Spring Boot microservices.
  • Jersey. This is a Java framework for simplifying the development of REST web services. This can help with the communications layer between microservices.
  • Swagger. This is a Java framework for building APIs. This also can help with the communications layer between microservices.

In addition to the above, technologies like publish/subscribe systems are useful as the lightweight messaging system. Systems like Apache Kafka simplify the messaging component by merely requiring microservices to “send” and “receive” data in any format. In conjunction with technologies like Hazelcast Jet and Hazelcast IMDG, you can build high-performance systems that run extremely fast due to in-memory processing, while also dealing with huge volumes of data.

Example Use Cases

Many use cases are applicable for Java microservices, especially those that involve an extensive data pipeline. For example, a microservices-based system would be ideal for a reporting system on a company’s retail store sales. Each step in the data preparation process would be handled by a microservice: data collection, cleansing, normalization, enrichment, aggregation, reporting, etc. The microservices workflow naturally creates a trackable lineage so if any problems are encountered in the data, it is relatively easy to trace back which microservice might need to be updated.

Another use case entails machine learning (ML). An microservices-based ML environment collects, aggregates, and analyzes a data flow so that the ML framework can determine an outcome. In such an environment, the data runs through a workflow that has many steps, and each step is handled by a microservice. Several great ML frameworks can be used with Java, including TensorFlow, Apache Mahout, and Apache Singa. One advantage of using a microservices architecture for machine learning is that multiple machine learning frameworks can be included in the workflow so that multiple models can be created on the same data flow. This is useful when the machine learning frameworks are targeting a predicted outcome, and having multiple frameworks running simultaneously provides a comparison around which model is providing the best results.

Additional Reading

Webinar: Operationalizing Machine Learning with Java Microservices and Stream Processing

Six Advantages of Microservices

Where Is My Cache? Architectural Patterns for Caching Microservices

Getting Started with Microservices Using Hazelcast IMDG and Spring Boot

Microservices with Vert.x – a match made in heaven

Related Terms


Microservices Architecture


Relevant Resources

| Video
| 60 minutes

Time to Make the Move to In-Memory Data Grids

DRAM is dirt cheap. That’s why in-memory databases, analytics, and data grids are surging in popularity among firms that have an insatiable need for performance and scalability. But, databases, analytics platforms, and data grids target very different use cases. In-memory data grids, in particular, are often misunderstood because they support an extensive set of use cases that often overlap other technologies. Join guest speaker Mike Gualtieri, Principal Analyst at Forrester Research, Greg Luck, CEO of Hazelcast®, and Ken Kolda, Software Architect of Ellie Mae on this radio-show style webinar to boost your in-memory IQ.

View All Resources