NetflixOSS is a popular platform for building highly available and scalable applications using a “microservice architecture”. In this post I’m going to introduce a new sample open-source Liberty feature that makes it easy to get started with microservices using NetflixOSS.

In contrast to having a single monolithic application, using a microservice architecture results in lots of small reusable business services. Each of those microservices can be scaled independently in response to demand. Each microservice should isolate itself from failures and latency in services that it depends upon. This prevents issues cascading through the application infrastructure.

The version of the Liberty feature available today packages three of the NetflixOSS projects: Archaius, Eureka client, and Hystrix. Archaius is used by other NetflixOSS projects to dynamically obtain configuration properties from a hierarchy of different sources e.g. a properties file and/or database. This has been enhanced to enable properties to be defined in Liberty’s server.xml.


NetflixOSS on Liberty

Locating and isolating microservices with NetflixOSS on Liberty

The NetflixOSS Eureka project provides a highly available runtime registry of services. Service instances register with a cluster of Eureka servers. Each service must respond to heartbeat requests to indicate continued availability. A service client can then query the Eureka servers to locate an available service instance. The Liberty feature packages the Eureka client libraries.

Lastly, the NetflixOSS Hystrix project is an implementation of the circuit breaker pattern. This enables a caller to easily isolate themselves from latency or failures in the invocation of downstream services. In the most basic scenario, this is achieved by spinning off the invocation on to another thread. The application can then specify what should happen if the work on that thread either fails or times out. The version in the Liberty feature has been enhanced to use application server managed threads. This means that JavaEE context is available to the thread that has been spun off.

For more technical details and some simple usage examples, see the documentation in the sample.netflixoss.wlp GitHub project. Note that, as with NetflixOSS, the project is built with Gradle. The new Liberty Gradle plugin is also available on GitHub.

2 Comments on "Microservices with Liberty and NetflixOSS"

  1. Good examples-BTW.
    Just a typo: The example has “Timeout” instead of “Error” in Hystrix.java.checkCopmmandError(..).

    HystrixCommand hystrixCommand = new HystrixCommand(
    HystrixCommandGroupKey.Factory.asKey(“Timeout”)) {

Join The Discussion

Your email address will not be published. Required fields are marked *