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

pool support #64

Open
malexzx opened this issue Dec 2, 2016 · 4 comments
Open

pool support #64

malexzx opened this issue Dec 2, 2016 · 4 comments

Comments

@malexzx
Copy link

malexzx commented Dec 2, 2016

one nice feature - mongo pool as must have be in mongorover.
it might be a simple implemented for short lived lua sessions for example. (while gc on destroy - return
connection to back to pool). Does any known issues, that this idea won't work, or maybe hard to implemented on that way?
I'm may be try to implement this feature (since it may be needed me in production).

@ajdavis
Copy link
Contributor

ajdavis commented Dec 2, 2016

Can you tell me more about your idea? I think the C Driver's mongoc_client_pool_t is useful only for multithreaded applications. A single-threaded application can just use one mongoc_client_t for all operations. But I don't know much about Lua so perhaps your idea is useful.

@malexzx
Copy link
Author

malexzx commented Dec 3, 2016

Hello @ajdavis !
In my case short lived lua scripts is executed in multiple threads (web server with lua handle requests by lua for example). For this purpose first of all, we need init a pool by providing mongo url (may be outside lua code or by lazy technique). Then pool may be used per query execution, i.e. get client from pool for execute query then return back to pool. Another proposed use case is get pooled client and release it after gc (may be at lua state destroy).
Another use case may be use this approach in coroutines (but it is more complex to implement). It requires to overlap mongo-c driver with coroutine too. That method is would allow us to send and receive data (mongo query) in asynchronous manner.

@ajdavis
Copy link
Contributor

ajdavis commented Dec 3, 2016

Sounds interesting, and it resembles how the new PHP driver does connection pooling. Let me dig up some documentation about that....

@malexzx
Copy link
Author

malexzx commented Dec 4, 2016

Thank you for pointing me about PHP. http://php.net/manual/en/mongo.connecting.pools.php is said, that now pooling is not used. I'm try to investigate now why that needs.

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

No branches or pull requests

2 participants