Blog Logo
TAGS

Should You Reuse Ids Among Microservices?

In a microservices architecture, managing ids can be a tricky question to answer. Should you use the same Id for multiple microservices or have a separate set of Ids for each? According to Vladimir Khorikov, its best to use the same Id across your system, as long as it is generated by one of your microservices. The Id represents the identity of the customer, controlled by the microservice that creates Customer instances. If the Id comes from an external system, such as Facebook, its important to create your own customer Id and save the Facebook Id as a separate (optional) field. The contract between your microservices is much stronger than that between your system and Facebook, so maintain backward compatibility among the microservices in your system. Follow these principles to ensure a well-managed, scalable architecture for your microservices.