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

Entity/table for connection pooling? #13

Open
KnowZero opened this issue Jul 4, 2022 · 2 comments
Open

Entity/table for connection pooling? #13

KnowZero opened this issue Jul 4, 2022 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@KnowZero
Copy link

KnowZero commented Jul 4, 2022

I see for the normal async there is a way to get the entity you wish to connect to. But for the async pool, there isn't.

I could run a switch on every connection, but since it seems to send something to server, I am guessing there is a penalty? It would be nice if we can have the connections in the pool be able to be set with whichever entity/table we wish to use.

Or maybe better assign a certain amount of connections per entity/table? This way it would avoid the penalty for lookup when switching? (unless the penalty isn't per connection/session?)


Also, a little side comment. Not sure if you prefer it as a separate issue or here is fine. But the docker "latest" and "next" are the same thing (v0.8) where as latest should be v0.7.5. It also may make more sense to have smaller builds debian-slim / almalinux-minimum / almalinux-micro / alpine linux(if there is no issue with musl) instead of just the full stable build.

@ohsayan
Copy link
Member

ohsayan commented Jul 7, 2022

Thanks for bringing this up.

  1. The connection pool (sync/async) is simply a collection of connections to the Skytable server. Since the entity is local to every connection, the only way to do it currently is by getting a connection from the pool and switching the entity, like you have noted

  2. And you are correct: there is a lookup penalty. This was actually discussed sometime back on our chat channel. The best way to do this is by redefining what the Connection structure looks like to include an entity field (possibly a boxed slice):

       pub struct Connection {
           entity: (Ks, Tbl),
           ...
       } 

    So, whenever you attempt to switch, it'll check whether you're already using that entity. This is far better than sending a request to the server only to find out that you're already using the same entity

  3. Assigning a number of connections to a given entity actually seems like a very good idea. I think we can discuss this further. Although, you can always create multiple pools for every entity that you plan to access, but I agree, having library-level support would be very convenient

  4. Regarding the Docker image, can you please open an issue here? If you check this post on planned changes to Docker images it can explain some things, and what we plan to do ahead

@ohsayan ohsayan added enhancement New feature or request good first issue Good for newcomers labels Jul 7, 2022
@MuhtasimTanmoy
Copy link
Contributor

What would be the high-level design for this issue?

@MuhtasimTanmoy MuhtasimTanmoy mentioned this issue Nov 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants