- Notifications
You must be signed in to change notification settings - Fork21
Tools for load testing Shiny applications
rstudio/shinyloadtest
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This package extends theshinytest package to enable users to load test deployed Shiny applications. Load testing is executed using parallel phantomJS sessions.
Currently,shinyloadtest is available on Github:
devtools::install_github("rstudio/shinyloadtest")
You will also need to installshinytest andphantomJS.shinytest includes a helper function to install the latest version ofphantomJS.
To get started, record a test using theshinytest package's recorder withload_mode enabled. The test should be reflective of expected application use. For more details, see theshinytest documentation. Tests must be recorded against a local copy of the deployed application.
library(shinytest)recordTest("path/to/app",load_mode=TRUE)
The recorder will save interactions with the application and timing information into a R file. Inload_mode the recorded timing includes user pauses. This infomration is used to simulate a realistic user experience while load testing the application.
The easiest way to use the package is through the included addin. From within RStudio, navigate to the application file and then clickLoad Test Shiny App from the Addins menu.
The addin will walk through the parameters for defining a load test and will help pick useful defaults. ClickingRun will begin the load test. The load test includes running the application at load and a baseline test composed of a series of sequential tests, each executed 1 at a time. At the end of the load test an HTML report is created containing useful information about the result of the test. Detailed logs are also generated and written to the current working directory.
WARNING The load test can take a long time to run. The addin includes an estimate of the total test duration. The load test will generate multiple processes on the client machine. Use with caution.
The addin uses theloadTest function to run the load test.
library(shinyloadtest) loadTest(testFile='myloadTest.R',url='https://beta.rstudioconnect.com/content/2551',numConcurrent=8,numTotal=16,loadTimeout=5,stagger=4,phantomTimeout=20)
This function uses theparallel andforeach packages to open concurrent R processes. Each R process uses phantomJS to run the recorded test against the deployed application.
numConcurrent is the number of concurrent connections to the application.
numTotal is the total number of tests run against the application.
loadTimeout is the maximum amount of seconds to wait for the Shiny app to load.
stagger adds a random delay of up tostagger seconds to the concurrent connections.
phantomTimeout is the maximum seconds to wait for the phantomJS process to start.
WARNING Load testing a large number of concurrent connections will open a large number of processes on the client computer. Use with caution.
TheloadTest function returns an event log that contains timing and event information for each visit to the application. The package includes functions for analyzing the event log such asgetSuccesses,getErrors,getMaxConcurrent,getPageLoadTimes, and others.
shinyloadtest is best suited for testing applications with 20-60 concurrent connections. Driving more load on the deployed appliction is possible, but may require a server to act as the client.
We recommend usingshinyloadtest to experiment with application performance and tuning. For more details see:Performance Tuning for Shiny Server Pro,Performance Tuning for RStudio Connect, andPerformance Tuning for shinyapps.io.
About
Tools for load testing Shiny applications
Resources
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors12
Uh oh!
There was an error while loading.Please reload this page.

