How to share Database connection pool between shiny apps under ShinyProxy - r

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
Thanks a lot.

Related

How do I track the # of users connected to my Streamlit app?

I am running a Streamlit app and need to know the number of connected users.
Note that the app is behind a proxy that handles authentication, so there is no "user" object as there is in Streamlit Cloud.
For my purposes I'd just need the IP addresses of the sessions currently looking at the app.
Or - failing that - a count of the open sessions.
Any ideas?

Security for R Shiny App secrets on shinyapps.io

I am using persistent data storage with a deployed app on shinyapps.io. I am reading and writing to an external SQL db. This app will be open to public, but data saved will be private.
What is the best/most secure way to store the private api keys for the db on the shinyapps.io server?
Config file?
.renviron?

How to connect a database server running on local machine as a service to web application hosted on pivotal cloud foundry?

I am trying to test run a basic .NET web application on pivotal cloud foundry. This web application uses as its database a MongoDB server hosted on my local machine. At the moment I am limited to use of the cloud infrastructure by using just the Apps Manager.
I have read the pivotal cloud foundry docs about user provided services, but cannot figure out as to how the connection is to be really made. I have already come across various other ways like using MongoDB as a service (beta version), but at the moment I am not allowed access to the Operations Manager. Looking for an explanation on user provided services or how to implement the service broker API, specifically.
I am new to Mongo as well, so any suggestion regarding making a connection through tweaking Mongo may help as well. Thanks
The use case you describe (web app in PCF connecting to a resource in your local machine) is not recommended.
You can create a MongoDB instance for development purposes in PCF.
$ cf marketplace
...
mlab sandbox Fully managed MongoDB-as-a-Service
...
You can create a mlab service and bind it to your application. You will then have a MongoDB instance in PCF that you can use for development purposes.
Edit:
In that case a user provided service might help you, where you pass in your remote MongoDB instance configuration that you can read in your application. e.g.:
cf.exe cups my-mongodb -p '{"key1":"value1","key2":"value2"}'
You can add your local mongo-db as a CUPS service to your PCF Dev.
Check out the following post.
How to create a CUPS service for mongoDB?

How to start ASP.Net State Service in Azure

While deploying my application in azure i got this error when a session variable is used
I know this error is due to ASP.Net state server mode. I started the service in my local PC but how to start this service in Azure environment?
You can use a start up task to spin up the State Service (or really any service for that matter). However, I would highly recommend that you do not use the session state service. I'd recommend looking at the In Role Windows Azure Cache or the Windows Azure Cache Service (Preview) for session state.
By using the session service you separate your session concerns from your web servers. It is still in preview, so if that concerns you, look at the In Role cache, which won't cost any more to run and can be distributed across multiple machines. Also, if you think the latency to pull from the cache service will be too high then the InRole cache may turn out to be better for you (you'd have to test to be sure).

confused about local data storage for occasionally connected application in .NET

Can I use a SQL Server Express database as my local database for an occasionally connected application (OCA) written using Visual Studio? Would that require SQL Server to be installed on the client machine? It looks like the default architecture for OCAs in .NET is to use SQL Server Compact. However, SQL Server Compact doesn't permit the use of stored procedures. I use stored procedures for all the data access in my application so, I am confused about the best way to create an occasionally connected client to extend the functionality.
I currently have an ASP.NET web application that connects to a web service (WCF). The web service connects to the DB and calls stored procedures to get data and submit changes to data. Now, I am trying to write a desktop application that can connect to the web service when a connection is available, and work locally when a connection is not available, using the MS Sync Framework. I don't quite understand how to do the architecture for this bit.
Yes, local data cache works with SQL CE 3.5 and you cannot use stored procedures on the cache. Once you add local data cache item to your project it automatically prepares all necessary MS Sync Framework code for data synchronization with the main data source + all necessary SQL scripts for local database and it will also offer you to create either typed datasets or entity data model to access the cache from your application.
Item doesn't work with SQL Server Express - it doesn't offer any other data provider then SQL Compact 3.5. Anyway if you want to use SQL Server Express you will have to either install it on the client machine or use another machine as DB server which breaks whole purpose of Local data cache.
Btw. I think Local data cache works only against database as the main data source so you cannot use it if you want to have WCF services as data source and you will have to write the store and synchronization yourselves.

Resources