Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Tools for load testing Shiny applications

NotificationsYou must be signed in to change notification settings

rstudio/shinyloadtest

Repository files navigation

R-CMD-check

Theshinyloadtest packageand the accompanyingshinycannon command linetool make it possible toload test deployed Shiny apps. Load testinghelps developers and administrators estimate how many users theirapplication can support. If an application requires tuning, load testingand load test result analysis can be used to identify performancebottlenecks and to guide changes to infrastructure, configuration, orcode.

Scientific load testing helps put to rest the common misconception that“Shiny doesn’t scale”. As rstudio::conf(2018) Sean Lopp presented onScaling Shiny whichshows how to to horizontally scale an app to handle tens of thousands ofusers.

Installation

To perform a load test you’ll need two pieces of software:

  • shinyloadtest is an R package used to generate recordings andanalyze results. You should install it on your development machinewithinstall.packages("shinyloadtest").
  • shinycannon is a command-line used to replay recordings in parallel.You can install it on your development machine for testing, but forbest results we recommend installing it on a server, and preferablynot the one the application under test is also on. Seeinstallationinstructionsfor operating specific install instructions..

Quick Start

The process for load testing a Shiny application consists of threesteps:

  1. Record a typical user session for the app.
  2. Replay the session in parallel, simulating many simultaneoususers accessing the app.
  3. Analyze the results of the load test and determine if the appperformed well enough.

Rinse and repeat as necessary. Each step is described below.

Step 1: Recording

Record a session usingshinyloadtest::record_session(), which takesthe URL of thedeployed application as an argument:

shinyloadtest::record_session("https://shinyapp.example.com/")

Running the function will open a browser displaying the app. Once open,interact with the application as a typical user might then close thebrowser. After closing the app, a file (recording.log by default) willbe created that contains a recording of the session. This recording willserve as the basis for the load test.

If your application requires authentication, consult theauthenticationarticle.Also be aware thatcertain Shinyfeaturesare not compatible with shinyloadtest.

Step 2: Run the Load Test

With the recording in hand, we’re ready to run the load test. The actualtest is conducted outside of R using theshinycannon command-linetool. You can run it using your system’s terminal or console program, oryou can run it from the RStudio IDE’s terminal tab. A typical run lookslike this:

shinycannon recording.log https://shinyapp.example.com/ --workers 5 --loaded-duration-minutes 2 --output-dir run1

(On Windows, you will need to replace “shinycannon” withjava -jar shinycannon-VERSION.jar.)

Seethe shinycannonarticlefor details.

Step 3: Analyze the Results

Now we can analyse our results by reading the data intoshinyloadtest::load_runs() and create a report withshinyloadtest_report():

df<-shinyloadtest::load_runs("run1")shinyloadtest::shinyloadtest_report(df,"run1.html")

This self contained html report will be opened in your browser forinspection. For further analysis explanation, please visitAnalysingload testlogs.

Analysis Example

Analysis Example

About

Tools for load testing Shiny applications

Resources

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors12

Languages


[8]ページ先頭

©2009-2025 Movatter.jp