|  | 
|  | 1 | +import http from "k6/http"; | 
|  | 2 | + | 
|  | 3 | +export const options = { | 
|  | 4 | +  discardResponseBodies: true, | 
|  | 5 | +  scenarios: { | 
|  | 6 | +    dispatch: { | 
|  | 7 | +      executor: "ramping-vus", | 
|  | 8 | +      startVUs: 1, | 
|  | 9 | +      stages: [ | 
|  | 10 | +        { target: 1, duration: "0" }, | 
|  | 11 | +        { target: 1, duration: "10s" }, | 
|  | 12 | +        // https://k6.io/docs/examples/instant-load-increase/ | 
|  | 13 | +        { target: 10, duration: "0" }, | 
|  | 14 | +        { target: 10, duration: "20s" }, | 
|  | 15 | +        { target: 20, duration: "0" }, | 
|  | 16 | +        { target: 20, duration: "20s" }, | 
|  | 17 | +        { target: 50, duration: "0" }, | 
|  | 18 | +        { target: 50, duration: "20s" }, | 
|  | 19 | +        { target: 100, duration: "0" }, | 
|  | 20 | +        { target: 100, duration: "20s" }, | 
|  | 21 | +        { target: 200, duration: "0" }, | 
|  | 22 | +        { target: 200, duration: "20s" }, | 
|  | 23 | +        { target: 300, duration: "0" }, | 
|  | 24 | +        { target: 300, duration: "20s" }, | 
|  | 25 | +        { target: 400, duration: "0" }, | 
|  | 26 | +        { target: 400, duration: "20s" }, | 
|  | 27 | +        { target: 500, duration: "0" }, | 
|  | 28 | +        { target: 500, duration: "20s" }, | 
|  | 29 | +        { target: 600, duration: "0" }, | 
|  | 30 | +        { target: 600, duration: "20s" }, | 
|  | 31 | +        { target: 0, duration: "0" }, | 
|  | 32 | +      ], | 
|  | 33 | +      exec: "dispatch", | 
|  | 34 | +    }, | 
|  | 35 | +    direct: { | 
|  | 36 | +      executor: "ramping-vus", | 
|  | 37 | +      startVUs: 1, | 
|  | 38 | +      stages: [ | 
|  | 39 | +        { target: 1, duration: "0" }, | 
|  | 40 | +        { target: 1, duration: "10s" }, | 
|  | 41 | +        // https://k6.io/docs/examples/instant-load-increase/ | 
|  | 42 | +        { target: 10, duration: "0" }, | 
|  | 43 | +        { target: 10, duration: "20s" }, | 
|  | 44 | +        { target: 20, duration: "0" }, | 
|  | 45 | +        { target: 20, duration: "20s" }, | 
|  | 46 | +        { target: 50, duration: "0" }, | 
|  | 47 | +        { target: 50, duration: "20s" }, | 
|  | 48 | +        { target: 100, duration: "0" }, | 
|  | 49 | +        { target: 100, duration: "20s" }, | 
|  | 50 | +        { target: 200, duration: "0" }, | 
|  | 51 | +        { target: 200, duration: "20s" }, | 
|  | 52 | +        { target: 300, duration: "0" }, | 
|  | 53 | +        { target: 300, duration: "20s" }, | 
|  | 54 | +        { target: 400, duration: "0" }, | 
|  | 55 | +        { target: 400, duration: "20s" }, | 
|  | 56 | +        { target: 500, duration: "0" }, | 
|  | 57 | +        { target: 500, duration: "20s" }, | 
|  | 58 | +        { target: 600, duration: "0" }, | 
|  | 59 | +        { target: 600, duration: "20s" }, | 
|  | 60 | +        { target: 0, duration: "0" }, | 
|  | 61 | +      ], | 
|  | 62 | +      exec: "direct", | 
|  | 63 | +    }, | 
|  | 64 | +  }, | 
|  | 65 | +}; | 
|  | 66 | + | 
|  | 67 | +// | 
|  | 68 | +// Respond immediately with `pong` | 
|  | 69 | +// This allows cleanly testing the cold starts that happen when concurrent | 
|  | 70 | +// requests suddenly increase | 
|  | 71 | +// | 
|  | 72 | +export function dispatch() { | 
|  | 73 | +  http.get("https://lambdadispatch.ghpublic.pwrdrvr.com/ping"); | 
|  | 74 | +} | 
|  | 75 | +export function direct() { | 
|  | 76 | +  http.get("https://directlambda.ghpublic.pwrdrvr.com/ping"); | 
|  | 77 | +} | 
0 commit comments