Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State of Polystore components #14

Open
MarieSaphira opened this issue Apr 3, 2020 · 14 comments
Open

State of Polystore components #14

MarieSaphira opened this issue Apr 3, 2020 · 14 comments
Labels
question Further information is requested

Comments

@MarieSaphira
Copy link

Hi,
to create deployment scrips for Kubernetes I need to know if the polystore components are stateless (except for the databases).
WishedStates
Can you confirm this? @DavyLandman @tvdstorm @pinoval @OrfenCLMS @zolotas4 @kolovos @Danny2097 @malwash

@DavyLandman
Copy link
Contributor

Yup, looks about right.

Just for clarity, currently QL server is not stateless, but after fixing typhon-project/typhonql#68 we can be stateless.

@MarieSaphira
Copy link
Author

MarieSaphira commented Sep 21, 2020

Analytics and NLAE are not stateless.
How about the API @Stratidakos ?

@Stratidakos
Copy link
Contributor

The API is stateless.

@DavyLandman
Copy link
Contributor

DavyLandman commented Sep 22, 2020

Hi @Stratidakos last time we talked it was statefull, since it contains keeps around the current model in memory? (as in, it's not re-checking the Polystore DB for updated models)

This is primarily a thing for when you run the API behind a load balancer. Then the update model call will only reach one of the instances.

If this is solved, cool 👍

@Stratidakos
Copy link
Contributor

No, thank you for reminding me. The fact, that we keep the models in a MongoDB, makes the API stateful.
We will change a few things to make it stateless.

@theofilis
Copy link
Contributor

theofilis commented Sep 23, 2020

@DavyLandman I have a question just to clarify a thing on the @MarieSaphira's diagram?

The PolystoreDB is referring to storage where API stores its configurations or I misunderstood it?

@MarieSaphira
Copy link
Author

yes, it's polystore-mongo

@theofilis
Copy link
Contributor

Ok, this is great because. We found that the service is storing the model there. Give us some time to verify it.

If this is true, we can assume that the Polystore API is stateless because it stores its state to the polystore-mongo database.

Otherwise, we will modify it to store the model their.

How is it sound?

@theofilis theofilis added the question Further information is requested label Sep 23, 2020
@MarieSaphira
Copy link
Author

The DL and ML models are uploaded to the polystore-mongo at startup. If the API now only uses the models from the database and does not keep them in memory as it was before (see @DavyLandman post above) you are fine.

@DavyLandman
Copy link
Contributor

Does that mean that everytime someone sends a query to the polystore api, it retrieves the models fresh from the mongo db?

@theofilis
Copy link
Contributor

theofilis commented Sep 23, 2020

@DavyLandman good point, I'll check for this.

I supposed to make the API stateless, it should every time request the model from the Database [least effort], of course, this has a negative impact on query performance.

I am thinking, two possible solutions to minimize the impact, which are:

  1. To set-up the API to keep the model in memory and periodically request the version from the database.
  2. [most difficult] Or to set up a mechanism to update each instance of the Polystore API cached model.

@DavyLandman
Copy link
Contributor

A good thing to consider is that the evolution tool will send model updates and queries for the new model quickly afterwards, so any caching has to take that into consideration.

Is there maybe a kind of mongo event you can subscribe to?

@theofilis
Copy link
Contributor

@DavyLandman Ok I have never used MongoDB events. I have to study them a little.

@DavyLandman
Copy link
Contributor

There appears to be a change stream: https://docs.mongodb.com/manual/changeStreams/ I've never used it, but it might be nice for this purpose?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants