30 ms·
Sharing code or reinventing the wheel repeatedly is inevitable once you have more than one concern by which you can divide services. For example: let's say you
by barrkel 7y ago
Sharing code or reinventing the wheel repeatedly is inevitable once you have more than one concern by which you can divide services.
For example: let's say you have lots of integrations, and you need to scale compute, and parse and generate common data sent to and from the integrations.
You can either have a monolithic integration service which you scale out on load; or you can have integration-specific services that scale out on load and share your data parsing & generation library. Due to multiple concerns, there's no "best slice".
FWIW, scaling out compute is a stronger argument to me for a service boundary than responsibility segregation. Scaling out requires distribution; scaling up complexity doesn't, though it can help for other reasons, like CI/CD. I prefer FaaS architectural patterns with the freedom to share libraries in different functions (images) to services, especially if long-running state is not needed.
- kkapelon 7y agoSorry for not being clear. Having a shared library is not a bad thing on its own. Making the library a bottleneck is the anti-pattern. If you wish to have a shared-library of microservices you should be prepared to have multiple versions of it running at the same time without any pressure to update everything at once. If your shared library is the bottleneck, it means that your microservices are tighly coupled (hence the distributed monolith)