File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ import http from 'k6/http'
2+ import { Rate } from 'k6/metrics'
3+
4+ const URL = "http://" + __ENV . HOST ;
5+
6+ const RATE = ( function ( ) {
7+ switch ( __ENV . HOST ) {
8+ case 'c5xlarge' : return 1650 ;
9+ case 't3axlarge' : return 1500 ;
10+ case 't3anano' : return 1500 ;
11+ default : return 1000 ;
12+ }
13+ } ) ( ) ;
14+
15+ export let options = {
16+ discardResponseBodies : true ,
17+ scenarios : {
18+ constant_request_rate : {
19+ executor : 'constant-arrival-rate' ,
20+ rate : RATE ,
21+ timeUnit : '1s' ,
22+ duration : '30s' ,
23+ preAllocatedVUs : 100 ,
24+ maxVUs : 600 ,
25+ }
26+ } ,
27+ thresholds : {
28+ 'failed requests' : [ 'rate<0.1' ] ,
29+ 'http_req_duration' : [ 'p(95)<1000' ]
30+ }
31+ } ;
32+
33+ const myFailRate = new Rate ( 'failed requests' )
34+
35+ export default function ( ) {
36+ const body = { last_update : 'now' }
37+ const params = {
38+ headers : {
39+ 'Content-Type' : 'application/json' ,
40+ }
41+ }
42+ const res = http . patch ( `${ URL } /actor?actor_id=eq.${ Math . floor ( Math . random ( ) * 203 + 1 ) } ` , JSON . stringify ( body ) , params )
43+ myFailRate . add ( res . status !== 204 )
44+ }
You can’t perform that action at this time.
0 commit comments