I understand that generally shared libraries are a microservice antipattern, and the disadvantages of shared libraries in a microservice world are well documented.

However, I have not been able to find much information on extracting something like core library code into a shared service. What are the advantages and disadvantages of maintaining a common service as opposed to a shared library?

1 Answer 1


The disadvantage is performance. Rather than call a method that lives in your address space you're hitting a resource at a URL. That takes more time.

The advantage is that everything that needs this method doesn't have n different copies of it from however many different versions on however many systems. The method lives at one URL only. That gives you a single authority.

The real secret to microservices is they found an address space that doesn't just live in one box. It lives in the whole world.

  • Specifically the time here is call latency. If you make a lot these calls it will add up quick. If this is a infrequent and resource intensive call, being able to scale horizontally might be beneficial.
    – JimmyJames
    May 9, 2019 at 19:22
  • 1
    What are the advantages and disadvantages of **maintaining** a common service as opposed to a shared library? There is a pattern that makes maintaining a lot easier : If you define a java-interface that is implemented by the microservice and by your shared-library (that implements the service) (asssuming you are using java) than the code that consumes the microservice or shared-library will only be programmed against the interface. It is very easy then to replace shared-lib against mircroservice and vice versa. only minor setup changes are neccesary.
    – k3b
    May 10, 2019 at 11:44

Your Answer

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

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