apa512 / clj-rethinkdb

Eclipse Public License 1.0
204 stars 42 forks source link

Connection pool #169

Closed larshelgklp closed 8 years ago

larshelgklp commented 8 years ago

Is connection pooling supported?

danielytics commented 8 years ago

No. There was a lengthy discussion about that here #23 and the verdict was that RethinkDB Proxy Nodes give you almost everything that connection pools would.

Essentially, a proxy node is a RethinkDB server running on the same machine that your process is running, which does not itself store or query data, but IS connected to the RethinkDB cluster and will proxy your queries to other non-proxy nodes. This way, your process has a single localhost connection open and the proxy node maintains connections to the cluster (this way if one server in your cluster dies, you don't need to think about it -- the proxy node will make sure you can still talk to the remaining servers). IIRC proxy nodes solved almost all of the requirements I had for connection pooling except auto-reconnect if the (localhost) connection drops.

Maybe take a look at that discussion first and if your use case isn't covered, perhaps open a more specific ticket.

larshelgklp commented 8 years ago

Thanks for the quick reply. Was more of a question than issue. Will take a look at the discussion. Just close this ticket.

danielytics commented 8 years ago

In case you missed it, I edited my comment to add more info about how proxy nodes help with connection pooling.

(I don't have access rights to close the issue, so you or one of the admins will have to do it, if you feel the question is sufficiently answered)

danielytics commented 8 years ago

Note also that you can issue many queries asynchronously through the same connection (which is another use case of connection pools: multiple queries on blocking connections).

danielcompton commented 8 years ago

I can foresee needing some connection pools in our app, even when using proxy nodes, so this may come in the future, either in this project, or a sister project.