6 ms·
I think there is also a category of shared library like a color library. It could be a micro service but also could be a library. Since it is easy to have servi
by pylua 1y ago
I think there is also a category of shared library like a color library. It could be a micro service but also could be a library. Since it is easy to have services upgrade to the newest version of it without having cross dependencies that may make more sense as a library.
I see what you are getting at though.
- drewcoo 1y agoI think the parent was saying that services should own their own mutable data. Libraries should not be used to "share" mutable data. At least that's what I believe, so that's how I read it.
- cogman10 1y agoDefinitely what I'm saying. But the point about libraries which don't own data is also valid and those can be useful as services in some cases. Particularly when we are talking about something like a set of business rules to follow. At a bare minimum, if there's some sort of mutable data involved then I think there should be a single service that owns it. But I could also see reasons to create services which don't involve mutable data. It does somewhat come down to complexity though. Like, for example, I think a "matrix multiplier" service would be silly. Or even just a general "do-math" service. But a service that, for example, takes in raw video and spits out compressed video? Now we are talking about something that probably is better as a service and not a library as you likely want to do things like control encoding values and standards system wide. Just a little about my background. The systems I worked on, for example, shared user information using the `user-lib` library which contained all the details of how to fetch (and insert, and update) a user from the users table. Many services used that library to pull user information which has been a mess to untangle.
- cogman10 1y agoI think we are definitely in agreement. It can be hard to determine when something should be a service or library and I don't know if I have a clear answer either. We also have, for example, libraries that purely compute data. However, they have to be consistent across the system and it would actually be pretty helpful if they were a microservice instead as the computations often need to be changed or updated. Perhaps when it's business logic it should be a service? I definitely see the need for libraries like compression, IO help, or even just pure math like doing matrix multiplication where older ways to compute aren't necessarily incorrect.