1

I'm getting into microservices architecture and there are some issues which are badgering me. The main advantage of microservices is scalability. Let's say that I have service and I'm running 1-n instances of there services.

  1. In case of spring boot application, we have cool easy to implement cache mechanism, but our instances will be not aware of each other's data what is the common solutions, or simple alternative for such cache?

  2. Some of the services can use the same database with the second-level cache. How can services communicate with each other in such case?

Please provide any good materials for "easy switch" from monolith app to microservices approach.

4
  • If scalability is a serious issue (in most use cases, it's not), then a shared cache, used by all nodes, isn't feasible. It's a single-point of failure, and is not distributable. If your application's needs can be met by a single load balancer, and a single cache server, then Greg's comment applies
    – Alexander
    Commented Sep 18, 2017 at 20:31
  • 2
    see does each microservice really need its own database?
    – Erik Eidt
    Commented Sep 18, 2017 at 20:43
  • @ErikEidt separating microservices is not an issue for me. In my thinking, I'm more focused on the relationship between same service INSTANCES. Let's imagen one service eg. User service that instances will have different states of the same object.
    – kingkong
    Commented Sep 19, 2017 at 19:20
  • 1
    The concern you're talking is about scaling the underlying implementation of one microservice, rather than an architecture of separate microservices.
    – Erik Eidt
    Commented Sep 19, 2017 at 20:41

1 Answer 1

1

Could be as easy as putting your micro services behind load balancers, and then put a cache server in front of the load balancer. Cache by request URL. This is just basic horizontal scaling and caching. The rules are the same for a micro service and a monolith.

1
  • I do understand URL request caching and that is fine. But I'm trying to more concentrate on a single instance of microservices. If I'm using such technology as spring cache, in service it makes my service stateful isn't?
    – kingkong
    Commented Sep 19, 2017 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.