Shiny Server + Integrating with Apache

1,565 views
Skip to first unread message

Greg

unread,
Mar 11, 2014, 1:31:59 PM3/11/14
to shiny-...@googlegroups.com

 I'm (very) new to shiny, but so far this looks great. In the past I've been calling Rscript on the backend using php  and then displaying the results the Rscript would return to my php call. A few questions regarding the shiny server:


1) If I make app1, can only one user use app1 at a time? Is that the difference between the pro and the free versions? If that is the case, is there a way to make apache spawn different process? For instance, if I have a .R file, I can have apache span many copies of that all running different inputs.
2) Is there a tutorial on getting the Shiny server and Apache playing nice together. What I'd really like is to have a wordpress (or some other site)  which runs R apps. Right now I do this through PHP. Is the only way to have it via shiny is through an iframe?
3) On a more conceptual question, is the functionality from Shiny pretty much the same as an ajax call + a javascript entry to execute on a change?

Thank you everyone for your help! This project looks great and I'm looking forward to playing more with it!

Joe Cheng [RStudio]

unread,
Mar 11, 2014, 5:18:54 PM3/11/14
to shiny-...@googlegroups.com
1) A single R process is limited to serving a single app at a time, BUT that app is able to service many concurrent sessions (meaning, a connected browser) at once. Each session will maintain its own set of inputs and outputs. Any variables you create inside the shinyServer(function(...){ ... }) closure will be specific to a particular session.

How many sessions can you service simultaneously? That depends on how fast your hardware is, and much more significantly, how much work your application is doing. With Shiny Server Open Source edition, when you run out of capacity in your single-process-per-app, that's it. Shiny Server Pro, on the other hand, can be configured to automatically launch new processes to handle additional load.

2) Going through an iframe makes by far the most sense right now, although Shiny was designed to eventually make it possible to embed Shiny apps directly in the HTML of any web application (it's possible now, I believe, though not documented).

3) Not really. Ajax calls are inherently stateless while Shiny sessions not only maintain state, they build reactive behaviors on top of that state. This makes it easy to do partial recalculation, for example. As you make your way through the Shiny tutorial it should gradually become clear how our approach differs from the typical AJAX/RPC/REST model.

Greg

unread,
Mar 11, 2014, 11:25:10 PM3/11/14
to shiny-...@googlegroups.com
Hi,

Thanks for the response! Just a few follow up questions to that :-):

Re 1) Still a bit confused. Simply put, if I have user1 and user2 using my app at the same point, would that work? Eg, they both point there browser to: mydomain.com/myapp.
Re 2) Is there any tutorial on getting shiny to work nice with Apache?

Thanks again for your help!

Jeff Allen

unread,
Mar 11, 2014, 11:37:29 PM3/11/14
to shiny-...@googlegroups.com
Hi Greg.

1.) Yes that would work. Multiple users can have connections to the same R/Shiny process concurrently. So even though the open-source version can only run one process per application, multiple users can connect to that process.

2.) I'm unaware of anything. But an iframe would have a variety of benefits, so I'd recommend exposing Shiny Server on an external port and going that route.

Jeff

Indra Kshattry

unread,
May 4, 2014, 10:08:06 PM5/4/14
to shiny-...@googlegroups.com

Re 2) Is there any tutorial on getting shiny to work nice with Apache?

I am also curious to know the answer of this question, but I didn't really understand the answer to this question.

Thank you

Indra

Lipper Z

unread,
Aug 18, 2015, 3:23:39 AM8/18/15
to Shiny - Web Framework for R
Did you solve the problem?I  want to know the solution ,too, so, please send me the details, thanks a lot!

Dean Attali

unread,
Aug 18, 2015, 10:06:57 PM8/18/15
to Shiny - Web Framework for R
Not sure if this is useful or not, but RStudio has a short article on configuring Apache for RStudio Server. Maybe it's useful for shiny server as well?
Reply all
Reply to author
Forward
0 new messages