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
How to share Database connection pool between shiny apps under ShinyProxy #237
Comments
If Shinyproxy would support database connection pool (ex. postgresql,mysql etc) in shiny apps, it will much more convenient for developers. Is it possible? |
I don’t think there’s native way of doing this. But workarounds are many. One possible easy workaround is to deploy an API using plumber. |
thanks to @shrektan , I'll try it latter. |
I install pgbouncer, and set shiny connect to pgbouncer service, it solve the problem. Thanks a lot |
Hi @chienyuchuan happy to hear you found a solution! |
@chienyuchuan Hi! May you tell me what R package do you use for connection with pgbouncer ? And my you please share an example of a string connection? |
Dear @kuzmenkov111 , I still use shiny pool package, but connect to pgbouncer. Here's some reference site for you, hope you can learn from it... PgBouncer + Ubuntu 18.04 PostgreSQL Connection Pooling with PgBouncer Using the pool package (basics) |
Just add my two cents. I actually deployed somewhat similar services but using the Plumber API, as I commented above. It's a little bit more complicated and you have to write a wrapper function to use it. But it allows to connect multiple different databases and not limited to PostgreSQL. The way I'm doing it:
I personally prefer this method as I almost always use a wrapper to get SQL data (because I need to connect to multiple different databases and correctly handling the encoding / timezone / date-datatype is not that easy). I hope this is helpful for anyone faces a simliar cases like me. |
In my practice, many shiny apps needs to access Postgresql DB which installed on host. I use pool package to get connection pool of Postgresql, and set it to global variable shared for other apps. But every new user trigger app, it would get new connection of Postgresql. I'm afraid Postgresql would crash down when too much concurrent users use shiny apps. Is any solution for this secenario?
pool package introduction as bellowing url. https://shiny.rstudio.com/articles/pool-basics.html
One expert advise me to use pqbouncer, but I don't know how to implement in ShinyProxy, any advice or solution?
Thanks a lot.
The text was updated successfully, but these errors were encountered: