1- export const BASIC_TEST_OPTIONS = {
2- scenarios : {
3- // ramp up to 5 VUs over 30 seconds
4- rampUp : {
5- executor : "ramping-vus" ,
6- startVUs : 0 ,
7- stages : [
8- { duration : '30s' , target : 5 }
9- ]
10- } ,
11- // have 5 VUs do 3 iterations each, up to a max of 2 minutes. Start this after
12- // the ramp up time.
13- highLoad : {
14- executor : "per-vu-iterations" ,
15- vus : 5 ,
16- iterations : 3 ,
17- maxDuration : "2m" ,
18- startTime : '30s' ,
19- }
20- } ,
21- thresholds : {
22- exceptions : [ "count == 0" ] ,
23- errors : [ "count == 0" ] ,
24- websocket_session_duration_without_sleep : [ "p(95) < 5000" ] ,
25- long_websocket_sessions : [ "count <= 1" ] ,
26- extra_long_websocket_sessions : [ "count == 0" ]
27- } ,
28- summaryTrendStats : [ "avg" , "min" , "med" , "max" , "p(90)" , "p(95)" , "p(98)" , "p(99)" ] ,
29- } ;
30-
311// TODO: Update to a load testing instance of Javabuilder
322export const UPLOAD_URL = `https://javabuilder-molly-http.dev-code.org/seedsources/sources.json?Authorization=` ;
333export const WEBSOCKET_URL = `wss://javabuilder-molly.dev-code.org?Authorization=` ;
@@ -50,12 +20,48 @@ export const UPLOAD_PARAMS = {
5020export const PRIVATE_KEY = null ;
5121
5222// Thresholds for metrics
23+ // Long requests time: we don't want requests to go over this time in the p(95) case
5324export const LONG_REQUEST_MS = 5000 ;
54- export const EXTRA_LONG_REQUEST_MS = 10000 ;
25+ // Extra long request time: we never want requests to go over this time.
26+ export const EXTRA_LONG_REQUEST_MS = 14000 ;
5527
5628// Mini-app types
5729export const MiniAppType = {
5830 CONSOLE : 'console' ,
5931 NEIGHBORHOOD : 'neighborhood' ,
6032 THEATER : 'theater'
6133} ;
34+
35+ export function getTestOptions ( maxUserGoal , rampUpTimeMinutes , highLoadTimeMinutes ) {
36+ const maxConcurrentUsers = Math . floor ( maxUserGoal / 30 ) ;
37+ return {
38+ scenarios : {
39+ // ramp up to maxConcurrentUsers VUs over rampUpTimeMinutes
40+ rampUp : {
41+ executor : "ramping-vus" ,
42+ startVUs : 0 ,
43+ stages : [
44+ { duration : `${ rampUpTimeMinutes } m` , target : maxConcurrentUsers }
45+ ]
46+ } ,
47+ // have maxConcurrentUsers VUs do 3 iterations each minute, for a total of highLoadTimeMinutes * 3
48+ // iterations per virutal user.
49+ // Start this after the ramp up time and allow for 1 extra minute in the max duration in case of issues.
50+ highLoad : {
51+ executor : "per-vu-iterations" ,
52+ vus : maxConcurrentUsers ,
53+ iterations : 3 * highLoadTimeMinutes , // this is iterations per virtual user
54+ maxDuration : `${ highLoadTimeMinutes + 1 } m` ,
55+ startTime : `${ rampUpTimeMinutes } m` ,
56+ }
57+ } ,
58+ thresholds : {
59+ exceptions : [ "count == 0" ] ,
60+ errors : [ "count == 0" ] ,
61+ websocket_session_duration_without_sleep : [ "p(95) < 5000" ] ,
62+ long_websocket_sessions : [ `count <= ${ maxConcurrentUsers } ` ] ,
63+ extra_long_websocket_sessions : [ "count == 0" ]
64+ } ,
65+ summaryTrendStats : [ "avg" , "min" , "med" , "max" , "p(90)" , "p(95)" , "p(98)" , "p(99)" ] ,
66+ } ;
67+ }
0 commit comments