Description Super classes Methods
Provide a set of utilities to profile handling. You can profile or benchmark specific routes, specific handlers within routes, or load test the whole application itself.
webtools::Configurable
-> webtools::Plugin
-> webtools::DispatchPlugin
-> PerfPlugin
new()
Create a new PerfPlugin
PerfPlugin$new()
profile()
Profile a request passed through the handler stacks, pass route name in order to profile just a specific route.
PerfPlugin$profile( path = "/", url = NULL, router = NULL, message = NULL, binary = FALSE, method = "get", base_path = "", content = "", headers = list(), trust = TRUE, attach = c("request", "message", "header"), interval = 0.005, close = TRUE, ... )
path
(str) path to be hit by the request
url
(str) URL of the request
router
(str) route name
message
(str) message glue string
binary
(flg) is the message a binary message?
method
(str) HTTP method
base_path
(str) root; stripped out of the path when handling requests
content
(str) content of the request
headers
(lst) list of request headers of the test request
trust
(flg) indicates whether request should be trusted
attach
(str) whether to use the request, message, or header stack
interval
(num) loop interval for profiling
close
(flg) if this is not a route, then close the connection?
...
(arg) additional arguments to fiery::fake_request()
benchmark()
Measure the times needed to run through handler stack, pass route name in order to benchmark a specific route
PerfPlugin$benchmark( path = "/", url = NULL, router = NULL, message = NULL, binary = FALSE, method = "get", base_path = "", content = "", headers = list(), trust = TRUE, attach = c("request", "message", "header"), times = 100L, close = TRUE, ... )
path
(str) path to be hit by the request
url
(str) URL of the request
router
(str) route name
message
(str) message glue string
binary
(flg) is the message a binary message?
method
(str) HTTP method
base_path
(str) root; stripped out of the path when handling requests
content
(str) content of the request
headers
(lst) list of request headers of the test request
trust
(flg) indicates whether request should be trusted
attach
(str) whether to use the request, message, or header stack
times
(int) number of times to run the expression
close
(flg) if this is not a route, then close the connection?
...
(arg) additional arguments to fiery::fake_request()
load_test()
Run a load test on the application; this works by spinning up the application on the main thread and running an RStudio job to do the load test.
PerfPlugin$load_test( path = "/", method = "GET", threads = future::availableCores() * 2L, loops = 64L, headers = NULL, body = NULL, encode = c("raw", "json"), ramp = 0L, delay = 0L, wait = 0L )
path
(str) path to be hit by the request
method
(str) HTTP method
threads
(int) number of threads being run
loops
(int) number of times each thread will run a hit
headers
(lst) list of headers to send with the request
body
(lst) list to send as body of request
encode
(str) either "json" or "raw"
ramp
(str) number of seconds before all threads are firing
delay
(str) delay for each request from the load tester
wait
(int) seconds to wait before starting load test
clone()
The objects of this class are cloneable with this method.
PerfPlugin$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.