Can multiple users access an open source Shiny Server concurrently? - r

I have a program that is built in R and runs on the desktop version of Shiny. I am working on moving the project to a Shiny server. Would it be possible for multiple users to use the program at the same time on the Open Source version of Shiny Server or will there be an issue with concurrent users?
Thanks

According to their support page it can have an unlimited number of users:
Yes. Shiny Server is constrained only by its features.

I am not a shiny developer but yes. The limitation is that one R process will be used. So if user1 runs some process that takes some time user2's processes will wait for user1 to finish.

Related

Shiny app disconnected from the server. No errors

I am running a Shiny app on Ubuntu using the free Shiny server.
When I view the app in a tab in a browser (on MacOS or iPhone) it works fine. If I leave the tab open for a few minutes and return to the tab, I see the familiar translucent grey overlay with a rectangular box in the lower left stating, "Disconnected from the server. Reload".
There are no error indicated at /var/log/shiny-server/app-name... or at /var/log/shiny-server.log.
Here's my shiny server config file:
# Define a server that listens on port 3838
server {
listen 3838;
# Define a location at the base URL
location / {
# Defines the amount of time (in seconds) an R process with no active connections should remain open.
app_idle_timeout 0;
# Host the directory of Shiny Apps stored in this directory
site_dir /srv/shiny-server;
# Log all Shiny output to files in this directory
log_dir /var/log/shiny-server;
# When a user visits the base URL rather than a particular application,
# an index of the applications available in this directory will be shown.
directory_index on;
}
}
Based on this post, I thought the addition of app_idle_timeout 0; would prevent this from happening. It hasn't.
Running /opt/shiny-server/bin/shiny-server --version results in:
Shiny Server v1.5.14.948
I understand Dean Attali has created, shinydisconnect, as a way to make this message look nicer. However, I am wondering how to prevent this message from appearing at all if no errors have occurred.
The "Disconnected from Server" error is a generic message that means that the R session has shut down for some reason. This could happen for a multitude of reasons, ranging from missing objects, to data that takes too long to load, to the use of forbidden packages, to hitting the application timeout settings.
The first thing you should do when encountering this error is check the application log. This can be accessed in the shinyapps.io dashboard, under the Logs tab in the Application view, or by running rsconnect::showLogs() in the RStudio console.
This log will contain information about the startup and running of your application. Any errors encountered along the way will be shown here, comparable to the log created when you run the shiny application locally in your own R process.
It may also help to check the Javascript console in your browser while the application is running, which may show additional errors and messages related to your application. The exact instructions for checking this will vary depending on your browser.
If you see errors related to the data, code, or workspace of the application, you will need to fix them before the application will load properly. Remember that applications deployed to shinyapps.io must be independent and self-contained, so all the data, workspace objects, and other resources that the app needs must be deployed with it, or accessible via the internet.
Even if there is no error in the application log, the problem may still lie within your code. There are many resources available online to assist you in debugging and optimizing your app, including our Debugging Shiny Applications article, and the shinyapps-users Google group.
Be aware that your app may run well locally, but fail on shinyapps.io once it comes under load from multiple users. This could happen for a variety of reasons, including but not limited to:
Forgetting to close each database connection after loading in data
Making multiple long-running calls to a public API
Sub-optimal application instance or worker provisioning
Finally, our Scaling and Tuning article describes best practices regarding optimizing the performance of your shinyapps.io application.

Is Shiny Server Open Source capable of multithreading?

I'm looking at setting up a Shiny app that uses the Furrr package behind the scenes for some multithreaded operations. While checking the documentation for Shiny Server I read that the Open Source version is limited to a single process.
Does this mean anything running on Shiny Server Open Source can't be used in conjunction with any of the multithreading packages, since afaik all multithreading in R requires creating multiple processes? Also would this apply as well to something like ShinyProxy?
Per Jcheng on github:
Shiny Server will launch up to one R process for each app to run Shiny, then those R processes can launch child processes if they want.
So the answer is yes shiny server open source is capable of multithreading, it simply wont automatically create new R processes to serve concurrent users' sessions (ie automatic load balancing).

R shiny server: how to update scripts with multiple users and sessions?

We run an R shiny server (R: 3.5.1, Shiny: 1.0.3) on a virtual machine under CentOS. We are experiemcing some issues with script updates to the server.
We find that under certain conditions if we update a script to the server it may take some time (up to days occassionally) for the updated script to be actually executed.
From experience, this delay only occurs when the srcipt has multiple users. Scripts that have a sningle user (me) update instantly as soon as the updated scripts have been written to the server.
This makes sense: as long as users are running the scripts in sessions, you cannot update it. We know that resetting the Shniy server does the trick but this strikes me as a crude way of resolving this issue.
As I am not a linux expert I do not know if this is caused by Shiny or by Linux.
Does anyone know where this behaviour is documented so I can learn how to better control the process of updating?

R - Shiny App : How to host a Shiny App without interruption? If possible on Github or Shiny Server

So my shiny app goes to sleep since it is running locally on my computer, I want people to be able to access it even when my computer is turned off, i.e I want it to be hosted somewhere online so that it can continuously run. Any help would be great

Publish Rstudio Shiny App in intranet

I am trying to build a Rstudio/Shiny App and post it in our intranet so that everyone else in our office could see it. I am a windows guy, and the instructions online about how to setup a shiny server within Linux environment is a bit difficult for me. Is there an easy way that I can could accomplish this goal without messing up with Linux. Even if I have to do so, is there an easy way to just have my webpage available to people within our company, not everyone on the internet. Thanks!
you don't need shiny server for this, you just need to run an R instance with shiny
http://rstudio.github.io/shiny/tutorial/#ui-and-server
http://shiny.rstudio.com/
shiny automatically runs it at local host...
you need to change it to your own ip if you want your colleges be able to access it..
ip="192.168.178.10" # change this!
runApp("../microplate",host=ip) # change microplate to the name of your shiny package/app
RStudio also has a hosted Shiny option that is currently in Alpha. You can sign up here https://www.shinyapps.io/admin/#/signup
With hosted Shiny the intention is to let developers focus on building applications while RStudio will worry about managing servers, monitoring performance, and ensuring uptime.
I am sharing apps using the following:
runApp(list(ui=ui, server=server), host="0.0.0.0", port=1234)
(if your ui.R and server.R are in the same file)
runApp("C:/shinyapp", host="0.0.0.0", port=1234)
(if you have an ui.R and a server.R files as 2 files in the shinyapp folder)
After, I send my IP followed by the port that I set up as an hyperlink. Assuming that my IP is 192.168.178.10, I will send:
http://192.168.178.10:1234
Monitoring a shiny app shared in my internal network

Resources