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

Allow more than 1 connection in the connection pool #28

Open
espenhogbakk opened this issue May 23, 2024 · 4 comments
Open

Allow more than 1 connection in the connection pool #28

espenhogbakk opened this issue May 23, 2024 · 4 comments
Assignees
Labels
feature Product feature

Comments

@espenhogbakk
Copy link

It seems like this driver only supports 1 connection in a connection pool. I can see there are some tests and code related to multiple connections in a pool. but when initializing the driver, it uses a hardcoded value of 1 when it creates the pool.

Is there any particular reason we can't use a large pool size?

@kaklakariada kaklakariada self-assigned this May 24, 2024
@ckunki ckunki added the feature Product feature label May 24, 2024
@kaklakariada
Copy link
Collaborator

Hi @espenhogbakk,
thank you for your feature request. While it should be easy to implement we need to add documentation and integration tests to verify it really works.
Our product manager put it onto the roadmap but we don't know when it will be implemented.

@espenhogbakk
Copy link
Author

espenhogbakk commented May 27, 2024

Thanks for the response.

So am I correct in thinking the only way to reliably use this driver now is to do this for every query?

driver.connect()
driver.query()
driver.close()

Unless of course you in the same "context" are doing multiple queries in series (and don't want to do them in parallell). E.g in our Node.js application we might get a bunch of requests in at the same time, handled in different contexts/processes and then without a connection pool we need to establish a new connection to the cluster, query and close it down?

Seems like there is quite a bit overhead of doing so, see this log output

[2024-05-27T21:41:02.202Z] DEBUG: [SQLClient] Login
[2024-05-27T21:41:02.203Z] DEBUG: [Pool:1716846061955] Add connection
[2024-05-27T21:41:02.204Z] DEBUG: [Pool:1716846061955] Assign connection
[2024-05-27T21:41:02.267Z] DEBUG: [Connection:1716846061955] Received data
[2024-05-27T21:41:02.267Z] DEBUG: [Pool:1716846061955] Release connection
[2024-05-27T21:41:02.288Z] DEBUG: [Pool:1716846061955] Assign connection
[2024-05-27T21:41:02.977Z] DEBUG: [Connection:1716846061955] Received data
[2024-05-27T21:41:02.977Z] DEBUG: [Pool:1716846061955] Release connection
[2024-05-27T21:41:02.978Z] DEBUG: [Pool:1716846061955] Assign connection
[2024-05-27T21:41:03.104Z] DEBUG: [Connection:1716846061955] Received data
[2024-05-27T21:41:03.105Z] DEBUG: [WebSQL]: Fetch more data for:  1
[2024-05-27T21:41:03.106Z] DEBUG: [WebSQL]: fetchMoreData: 0 13146
[2024-05-27T21:41:03.154Z] DEBUG: [Connection:1716846061955] Received data
...
[2024-05-27T21:41:08.579Z] DEBUG: [WebSQL]: fetchMoreData: 13144 13146
[2024-05-27T21:41:08.646Z] DEBUG: [Connection:1716846061955] Received data
[2024-05-27T21:41:08.648Z] DEBUG: [WebSQL]: Closing ResultSet 1
[2024-05-27T21:41:08.652Z] DEBUG: [WebSQL]: Loaded all data
[2024-05-27T21:41:08.653Z] DEBUG: [Pool:1716846061955] Release connection
[2024-05-27T21:41:08.663Z] DEBUG: [SQLClient] Close all connections

That is 902ms before we receive any data. I must be missing something as this surely isn't how it's supposed to be?

@kaklakariada
Copy link
Collaborator

I am not very familiar with the code, but I don't think there is another way, unless you implement a connection pool in your application :-(
I will ask our product manager to prioritize this.

@pj-spoelders
Copy link
Collaborator

Investigated, found a couple of logical issues with the current implementation, had a chat with the PM yesterday. We should decide on a proper course of action today. Plan a meeting with chipi and tobe to discuss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Product feature
Projects
None yet
Development

No branches or pull requests

4 participants