Spring Distributed Cache with Hazelcast
Why caching is so important?
When building microservices applications, it’s very important to pay attention to I/O operations, to avoid overhead. By definition, microservices are applications that exchange continuously information via HTTP or other protocols, and this can cause delays. Use a cache may reduce the service’s load making operations faster, avoiding useless HTTP requests.
What is Hazelcast?
Hazelcast is a great In-Memory Data Grid, for storing data across services and nodes, easily scalable with great auto-discovery functions. It’s written in Java and it could be run side by side your application or deploying a purpose service for it.
Hazelcast is very similar to Reddit, but the company says that its performances are much better
Caching with Spring webflux
Spring Webflux is the recent non-blocking version of Spring built upon project-reactor, it’s not fully compatible with many frameworks that still have a blocking approach, thread-based. If you are not familiar with this version I suggest to read this article.