4 ms·
Service A calls to Service B and interacts with state, then Service B has a background process to do some post-processing on its state, then Service C calls to
by jmchuster 5y ago
Service A calls to Service B and interacts with state, then Service B has a background process to do some post-processing on its state, then Service C calls to service B and interacts with state, then you interact with Service B's web interface to interact with state. How is the shared library managing and persisting the state between all these interactions?
- anyfoo 5y agoThe suggestion was to not split up the application into (many) services in the first place. Modularity and modular interfaces can exist without that.
- jmchuster 5y agoGenerally when I think about a shared library, i think about a interface that manipulates state in memory to return some result. I think i'd be quite surprised if it had some built-in persistence, if it launched its own background processes, and had a web interface included. I would expect libraries to almost intentionally not cross these types of boundaries.
- anyfoo 5y agoSigh. We can continue playing that game, or acknowledge that the question was between microservices vs. more monolithic approaches, obviously in situations where both is equally viable. If your boundaries between services (or whatever) are only what you just mentioned, then either it is a small application, or the services are not very “micro”. Again, my, and likely OPs point, was that distinct, modular development (and for example the mentioned low compile times) is not contingent on separate services and IPC or even RPC, which come with a whole other can of worms. (BTW your scope of shared library is also pretty narrow. For persistence for example, SQLite is essentially a persistence layer that is a shared library. And some libraries do certainly spawn threads for their work. But that’s not really the point.)
- jmchuster 5y agoSo my question is how do you do modular development that spreads across multiple portions of the stack? Because just saying "put in a library" doesn't seem a sensible answer. SQLite is a great library, but that's more of a business-agnostic tool. How do you encapsulate a dedicated portion of business logic, let's say, managing image datasets for building machine learning models. e.g. I want some apis for basic CRUD on datasets, i want to automatically create new versions of existing datasets as images get published, i want to generate stats in the background for these datasets, i want a ui to review and manage datasets for model building, and then i want all this packaged in a single library? Also, to clarify, I'm not playing a game here. I don't care about theoreticals, I want to hear about how people have actually solved their problems, so I can then evaluate and use those approaches. So I'm trying to get at something a little bit more specific and less handwavy.
- Tabular-Iceberg 5y agoYou write all the same code as you would your microservice, you just don't bother exposing the public methods over a network protocol, you just import them where you want to use them.
- jmchuster 5y agoI don't expose the public method of my HTML file over a network protocol? Again, are we talking about the same thing?
- Tabular-Iceberg 5y agoMicroservices are typically thought to be standalone applications that only cover part of the business domain, and then communicate with other services over things like JSON HTTP APIs, message queues, RPC calls, etc. In a monolithic architecture these would run in the same address space, be separated into modules by the language's own means of abstraction, and the communication between them would be done by function or method calls. I don't see what HTML files have to do with it, what do you think microservices are?