Can a Shiny server app be multi-threaded to allow for app activity and health checking?
Can a Shiny server app be multi-threaded to allow for app activity and health checking?
I have a shiny app with Shiny Server (open-source version), containerized with docker, deployed to AWS Fargate. The app is fairly basic, in that it does three things:
.Rmd
.pdf
When run locally (with runApp()
or with docker run --rm -p 3838:3838 [image]
), the app works without issue. When deployed to AWS Fargate (after having nailed down some deployment issues), the app is, I think, running into "health check"-related issues. These issues arise, I'm fairly certain, because Step 2 above can take several minutes (and generates a multi-Mb size .pdf
report). The app grays out, a 503 Service Temporarily Unavailable
error appears, and after a few minutes, appears to return to normal upon reloading the page.
runApp()
docker run --rm -p 3838:3838 [image]
.pdf
503 Service Temporarily Unavailable
I can edit the health checks to allow for more time before AWS EC2 thinks that my container is "unhealthy" (based upon unresponsiveness from the Shiny Server) but this is decidedly not best practice for software development (according to software devs in my org).
Is there a way to allow for a long-running Shiny app on open-source Shiny Server to process the R
logic while also allowing health checks? I think this would essentially be keeping the Shiny Server "partially awake" to listen for health checking while also running any R
stuff in the background.
R
R
I have the sneaking suspicion that this is not possible as R
itself is single threaded and only the Shiny Server PRO version allows a health-check endpoint.
R
asynch
promises
@RyanMorton OOH. Looks promising. Thanks for the heads up.
– Steven
Sep 4 '18 at 22:38
"I can edit the health checks to allow for more time before AWS EC2 thinks that my container is "unhealthy"". Does this work? Does your app survive the health checks if you make them adequately long in polling?
– bluescores
Sep 5 '18 at 16:41
0
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
You may want to look into putting some operations into
asynch
withpromises
: blog.rstudio.com/2018/06/26/shiny-1-1-0– Ryan Morton
Sep 4 '18 at 22:23