sfackler/r2d2

[Question] Can I use it as proxy ?

b-barry opened this issue · 4 comments

Hello,

I have just found this library and I am wondering if you know a way to use it as a proxy.

I have a lambda function built-in node.js where I connect directly to my Postgres database. If my lambda scale, I reach the max connection to my DB.

So, I would like to know if I can host your library on a server, then connect my lambda to the pool to manage my connection.

Thanks for your answer

Hello @sfackler

Thanks for the quick answer. Yes, I would like to forward my request to your library that will manage all pool and then forward all request to my DB.

Do you have some docs or examples on how I could write this kind of stuff, I don't have any idea? Links are perfect for me, I don't want you lost your time

I found pgpool and pgbouncer are good but coupled to Postgres. I would like something agnostic like your library because I may have other kinds of database such as MongoDB or MySQL.

Thanks

You could potentially use this crate by defining a connection manager over a raw socket or something, and making a server that proxies to those, but you're almost certainly going to need to bake in a lot of knowledge about the underlying protocol (e.g. Postgres, MongoDB, MySQL).

Hello,

Thanks for the answer. I will try to implement that