Closed oberien closed 8 years ago
In a microservice environment ... Service A ... Service B ... Both share the same database
Is it really a case of microservices?
Implementing something like that would be time-consuming, and I don't really have the cycles to do something like that. I'm inclined to agree with @vlsi; a company that is operating at a scale that it uses microservices and is worried about the performance impact of two database queries would probably
a) have multiple databases and in-memory caching infrastructure for it b) have a large development team with specialized infrastructure people for developing their own middleware for merging queries
As such, I don't think it makes sense for me to add such a feature to Jinq.
Is it possible to serialize / deserialize Jinq expressions/streams e.g. to send them over network?
Reasoning behind question: In a microservice environment, a nice way to provide data, which needs to be aggregated by several services would be to send over the abstract Jinq stream instead of the loaded objects. Let's take the following example: Service A handles users and Service B handles some data related to users. Both share the same database. When I want to fetch the data object with it's creator, Service B fetches the data and gets the creator-id. It sends the creator ID to Service A, which then returns the user to Service B. Service B aggregates this information and returns the full data set to Me. This results in 2 DB queries, which must be executed after each other.
My question is, whether the following scenario could also be done this way: Service B creates a JinqStream, which will fetch the data object. It serializes the stream, sends it over to Service A, which, after deserialization, adds it's aggregate to the JinqStream based on the user's id. It serializes it again, sending it back to Service A, which after deserialization executes it. This results in only one DB-Query and the procedure is far more abstract on a higher level.
Kind Regards, BH16