Skip to content

Instantly share code, notes, and snippets.

@na--

na--/go.mod Secret

Last active March 6, 2023 13:26
Show Gist options
  • Save na--/3f2b663bedaab47b2fd4b2fbbb76c7e8 to your computer and use it in GitHub Desktop.
Save na--/3f2b663bedaab47b2fd4b2fbbb76c7e8 to your computer and use it in GitHub Desktop.
module testserver
go 1.20
require github.com/mccutchen/go-httpbin/v2 v2.5.6
diff --git a/js/runner.go b/js/runner.go
index dd1c8388..176f89cc 100644
--- a/js/runner.go
+++ b/js/runner.go
@@ -55,7 +55,6 @@ type Runner struct {
console *console
setupData []byte
- BufferPool *lib.BufferPool
}
// New returns a new Runner for the provided source
@@ -99,7 +98,6 @@ func NewFromBundle(piState *lib.TestPreInitState, b *Bundle) (*Runner, error) {
Resolver: netext.NewResolver(
net.LookupIP, 0, defDNS.Select.DNSSelect, defDNS.Policy.DNSPolicy),
ActualResolver: net.LookupIP,
- BufferPool: lib.NewBufferPool(),
}
err = r.SetOptions(r.Bundle.Options)
@@ -225,7 +223,7 @@ func (r *Runner) newVU(
CookieJar: cookieJar,
TLSConfig: tlsConfig,
Console: r.console,
- BufferPool: r.BufferPool,
+ BufferPool: lib.NewBufferPool(),
Samples: samplesOut,
scenarioIter: make(map[string]uint64),
}
data_received..................: 29 GB 683 MB/s
data_sent......................: 52 MB 1.3 MB/s
http_req_blocked...............: avg=3.45µs min=379ns med=1.04µs max=32.6ms p(90)=1.83µs p(95)=2.44µs
http_req_connecting............: avg=863ns min=0s med=0s max=14.9ms p(90)=0s p(95)=0s
http_req_duration..............: avg=15.32ms min=30µs med=3.62ms max=208.04ms p(90)=43.68ms p(95)=56.09ms
{ expected_response:true }...: avg=15.32ms min=30µs med=3.62ms max=208.04ms p(90)=43.68ms p(95)=56.09ms
http_req_failed................: 0.00% ✓ 0 ✗ 520000
http_req_receiving.............: avg=337.79µs min=4.99µs med=25.23µs max=171.7ms p(90)=162.26µs p(95)=692.56µs
http_req_sending...............: avg=10.01µs min=1.93µs med=4.68µs max=50.45ms p(90)=7.75µs p(95)=12.13µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=14.97ms min=19.2µs med=3.36ms max=207.96ms p(90)=43.13ms p(95)=55.4ms
http_reqs......................: 520000 12478.702266/s
iteration_duration.............: avg=104.11ms min=3.53ms med=98.89ms max=352.63ms p(90)=167.89ms p(95)=190.07ms
iterations.....................: 20000 479.950087/s
vus............................: 50 min=50 max=50
vus_max........................: 50 min=50 max=50
running (00m41.7s), 00/50 VUs, 20000 complete and 0 interrupted iterations
default ✓ [======================================] 50 VUs 00m41.7s/10m0s 20000/20000 shared iters
53.48user 14.24system 0:42.68elapsed 158%CPU (0avgtext+0avgdata 260176maxresident)k
0inputs+0outputs (0major+377300minor)pagefaults 0swaps
/usr/bin/time k6 run test.js 53.49s user 14.25s system 158% cpu 42.687 total
data_received..................: 29 GB 684 MB/s
data_sent......................: 52 MB 1.3 MB/s
http_req_blocked...............: avg=3.99µs min=364ns med=1.03µs max=17.92ms p(90)=1.83µs p(95)=2.43µs
http_req_connecting............: avg=1.25µs min=0s med=0s max=13.94ms p(90)=0s p(95)=0s
http_req_duration..............: avg=15.28ms min=30.95µs med=3.77ms max=285.57ms p(90)=43.29ms p(95)=55.55ms
{ expected_response:true }...: avg=15.28ms min=30.95µs med=3.77ms max=285.57ms p(90)=43.29ms p(95)=55.55ms
http_req_failed................: 0.00% ✓ 0 ✗ 520000
http_req_receiving.............: avg=320.28µs min=5.18µs med=25.18µs max=151.6ms p(90)=162µs p(95)=681.22µs
http_req_sending...............: avg=11.01µs min=2.06µs med=4.62µs max=40.11ms p(90)=7.67µs p(95)=11.96µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=14.95ms min=19.35µs med=3.53ms max=285.53ms p(90)=42.82ms p(95)=54.84ms
http_reqs......................: 520000 12501.200194/s
iteration_duration.............: avg=103.9ms min=3.07ms med=99.16ms max=359.55ms p(90)=166.77ms p(95)=189.52ms
iterations.....................: 20000 480.815392/s
vus............................: 50 min=50 max=50
vus_max........................: 50 min=50 max=50
running (00m41.6s), 00/50 VUs, 20000 complete and 0 interrupted iterations
default ✓ [======================================] 50 VUs 00m41.6s/10m0s 20000/20000 shared iters
53.58user 14.11system 0:42.58elapsed 158%CPU (0avgtext+0avgdata 259060maxresident)k
0inputs+0outputs (1major+356291minor)pagefaults 0swaps
/usr/bin/time k6 run test.js 53.58s user 14.12s system 158% cpu 42.591 total
data_received..................: 29 GB 678 MB/s
data_sent......................: 52 MB 1.2 MB/s
http_req_blocked...............: avg=8.28µs min=395ns med=1.04µs max=55.85ms p(90)=1.82µs p(95)=2.44µs
http_req_connecting............: avg=3.06µs min=0s med=0s max=55.83ms p(90)=0s p(95)=0s
http_req_duration..............: avg=15.3ms min=28.66µs med=3.81ms max=225ms p(90)=43.81ms p(95)=56.21ms
{ expected_response:true }...: avg=15.3ms min=28.66µs med=3.81ms max=225ms p(90)=43.81ms p(95)=56.21ms
http_req_failed................: 0.00% ✓ 0 ✗ 520000
http_req_receiving.............: avg=336.1µs min=5.34µs med=25.48µs max=138.95ms p(90)=162.29µs p(95)=701.27µs
http_req_sending...............: avg=16.02µs min=2.04µs med=4.65µs max=55.84ms p(90)=7.62µs p(95)=11.61µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=14.94ms min=18.39µs med=3.54ms max=224.97ms p(90)=43.22ms p(95)=55.45ms
http_reqs......................: 520000 12381.131468/s
iteration_duration.............: avg=104.93ms min=2.74ms med=100.29ms max=383.98ms p(90)=168.67ms p(95)=190.58ms
iterations.....................: 20000 476.197364/s
vus............................: 11 min=11 max=50
vus_max........................: 50 min=50 max=50
running (00m42.0s), 00/50 VUs, 20000 complete and 0 interrupted iterations
default ✓ [======================================] 50 VUs 00m42.0s/10m0s 20000/20000 shared iters
54.02user 14.42system 0:43.01elapsed 159%CPU (0avgtext+0avgdata 257824maxresident)k
0inputs+0outputs (1major+354985minor)pagefaults 0swaps
/usr/bin/time k6 run test.js 54.03s user 14.43s system 159% cpu 43.018 total
data_received..................: 29 GB 747 MB/s
data_sent......................: 52 MB 1.4 MB/s
http_req_blocked...............: avg=4.86µs min=377ns med=1.04µs max=23.69ms p(90)=1.83µs p(95)=2.41µs
http_req_connecting............: avg=1.9µs min=0s med=0s max=22.25ms p(90)=0s p(95)=0s
http_req_duration..............: avg=14.41ms min=25.92µs med=3.15ms max=266.29ms p(90)=41.62ms p(95)=54.36ms
{ expected_response:true }...: avg=14.41ms min=25.92µs med=3.15ms max=266.29ms p(90)=41.62ms p(95)=54.36ms
http_req_failed................: 0.00% ✓ 0 ✗ 520000
http_req_receiving.............: avg=301.36µs min=5.07µs med=25.37µs max=199.46ms p(90)=109.76µs p(95)=615.39µs
http_req_sending...............: avg=10.43µs min=2.05µs med=4.55µs max=22.7ms p(90)=6.97µs p(95)=9.45µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=14.1ms min=16.4µs med=2.94ms max=266.24ms p(90)=41.16ms p(95)=53.74ms
http_reqs......................: 520000 13657.947442/s
iteration_duration.............: avg=95.12ms min=2.92ms med=90.22ms max=353.57ms p(90)=155.7ms p(95)=177.35ms
iterations.....................: 20000 525.305671/s
vus............................: 50 min=50 max=50
vus_max........................: 50 min=50 max=50
running (00m38.1s), 00/50 VUs, 20000 complete and 0 interrupted iterations
default ✓ [======================================] 50 VUs 00m38.1s/10m0s 20000/20000 shared iters
39.64user 14.20system 0:39.17elapsed 137%CPU (0avgtext+0avgdata 714008maxresident)k
0inputs+0outputs (2major+177384minor)pagefaults 0swaps
/usr/bin/time k6 run test.js 39.65s user 14.21s system 137% cpu 39.175 total
data_received..................: 29 GB 739 MB/s
data_sent......................: 52 MB 1.4 MB/s
http_req_blocked...............: avg=5.6µs min=379ns med=1.06µs max=38.93ms p(90)=1.86µs p(95)=2.45µs
http_req_connecting............: avg=2.51µs min=0s med=0s max=30.48ms p(90)=0s p(95)=0s
http_req_duration..............: avg=14.49ms min=29.87µs med=3.14ms max=219.41ms p(90)=41.34ms p(95)=54.62ms
{ expected_response:true }...: avg=14.49ms min=29.87µs med=3.14ms max=219.41ms p(90)=41.34ms p(95)=54.62ms
http_req_failed................: 0.00% ✓ 0 ✗ 520000
http_req_receiving.............: avg=303.81µs min=5.02µs med=25.8µs max=145.15ms p(90)=110.36µs p(95)=614.92µs
http_req_sending...............: avg=10.74µs min=2.06µs med=4.61µs max=39.21ms p(90)=7.03µs p(95)=9.53µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=14.17ms min=18.64µs med=2.94ms max=219.37ms p(90)=40.84ms p(95)=53.97ms
http_reqs......................: 520000 13502.778271/s
iteration_duration.............: avg=96.21ms min=2.87ms med=91.17ms max=384.39ms p(90)=157.36ms p(95)=180.6ms
iterations.....................: 20000 519.337626/s
vus............................: 50 min=50 max=50
vus_max........................: 50 min=50 max=50
running (00m38.5s), 00/50 VUs, 20000 complete and 0 interrupted iterations
default ✓ [======================================] 50 VUs 00m38.5s/10m0s 20000/20000 shared iters
39.88user 14.47system 0:39.49elapsed 137%CPU (0avgtext+0avgdata 696952maxresident)k
0inputs+0outputs (0major+172243minor)pagefaults 0swaps
/usr/bin/time k6 run test.js 39.88s user 14.48s system 137% cpu 39.493 total
data_received..................: 29 GB 728 MB/s
data_sent......................: 52 MB 1.3 MB/s
http_req_blocked...............: avg=5.21µs min=401ns med=1.08µs max=50.82ms p(90)=1.87µs p(95)=2.46µs
http_req_connecting............: avg=2.45µs min=0s med=0s max=14.69ms p(90)=0s p(95)=0s
http_req_duration..............: avg=14.83ms min=31.3µs med=3.19ms max=216.88ms p(90)=42.54ms p(95)=55.76ms
{ expected_response:true }...: avg=14.83ms min=31.3µs med=3.19ms max=216.88ms p(90)=42.54ms p(95)=55.76ms
http_req_failed................: 0.00% ✓ 0 ✗ 520000
http_req_receiving.............: avg=305.73µs min=5.29µs med=26.03µs max=169.58ms p(90)=109.97µs p(95)=624.88µs
http_req_sending...............: avg=9.25µs min=2.08µs med=4.65µs max=68.86ms p(90)=7.11µs p(95)=9.61µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=14.51ms min=19.81µs med=2.98ms max=216.85ms p(90)=42.08ms p(95)=55.07ms
http_reqs......................: 520000 13302.722186/s
iteration_duration.............: avg=97.67ms min=3.35ms med=92.42ms max=375.23ms p(90)=160.72ms p(95)=182.26ms
iterations.....................: 20000 511.643161/s
vus............................: 50 min=50 max=50
vus_max........................: 50 min=50 max=50
running (00m39.1s), 00/50 VUs, 20000 complete and 0 interrupted iterations
default ✓ [======================================] 50 VUs 00m39.1s/10m0s 20000/20000 shared iters
40.32user 14.57system 0:40.10elapsed 136%CPU (0avgtext+0avgdata 714424maxresident)k
0inputs+0outputs (1major+177635minor)pagefaults 0swaps
/usr/bin/time k6 run test.js 40.32s user 14.57s system 136% cpu 40.109 total
data_received..................: 29 GB 664 MB/s
data_sent......................: 52 MB 1.2 MB/s
http_req_blocked...............: avg=10.35µs min=370ns med=1.06µs max=56.96ms p(90)=1.89µs p(95)=2.52µs
http_req_connecting............: avg=4.82µs min=0s med=0s max=56.94ms p(90)=0s p(95)=0s
http_req_duration..............: avg=15.53ms min=32.8µs med=4.1ms max=198.52ms p(90)=43.02ms p(95)=55.47ms
{ expected_response:true }...: avg=15.53ms min=32.8µs med=4.1ms max=198.52ms p(90)=43.02ms p(95)=55.47ms
http_req_failed................: 0.00% ✓ 0 ✗ 520000
http_req_receiving.............: avg=343.92µs min=4.82µs med=26.8µs max=157.25ms p(90)=173.81µs p(95)=740.1µs
http_req_sending...............: avg=17.2µs min=2.06µs med=4.75µs max=45.62ms p(90)=7.94µs p(95)=12.76µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=15.17ms min=20.94µs med=3.8ms max=198.46ms p(90)=42.48ms p(95)=54.75ms
http_reqs......................: 520000 12128.868228/s
iteration_duration.............: avg=107.14ms min=3.03ms med=102.2ms max=390.53ms p(90)=171ms p(95)=193.52ms
iterations.....................: 20000 466.494932/s
vus............................: 50 min=50 max=50
vus_max........................: 50 min=50 max=50
running (00m42.9s), 00/50 VUs, 20000 complete and 0 interrupted iterations
default ✓ [======================================] 50 VUs 00m42.9s/10m0s 20000/20000 shared iters
58.36user 14.77system 0:43.99elapsed 166%CPU (0avgtext+0avgdata 753848maxresident)k
0inputs+0outputs (1major+495129minor)pagefaults 0swaps
/usr/bin/time k6 run test.js 58.37s user 14.78s system 166% cpu 43.993 total
data_received..................: 29 GB 645 MB/s
data_sent......................: 52 MB 1.2 MB/s
http_req_blocked...............: avg=12.85µs min=396ns med=1.06µs max=70.26ms p(90)=1.91µs p(95)=2.54µs
http_req_connecting............: avg=7.94µs min=0s med=0s max=19.55ms p(90)=0s p(95)=0s
http_req_duration..............: avg=15.85ms min=30.54µs med=4.4ms max=237.84ms p(90)=43.95ms p(95)=56.67ms
{ expected_response:true }...: avg=15.85ms min=30.54µs med=4.4ms max=237.84ms p(90)=43.95ms p(95)=56.67ms
http_req_failed................: 0.00% ✓ 0 ✗ 520000
http_req_receiving.............: avg=356.24µs min=5.11µs med=27.2µs max=158.76ms p(90)=181.78µs p(95)=756.45µs
http_req_sending...............: avg=16.62µs min=2µs med=4.8µs max=75.37ms p(90)=8.18µs p(95)=13.29µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=15.48ms min=18.61µs med=4.08ms max=237.8ms p(90)=43.44ms p(95)=55.92ms
http_reqs......................: 520000 11786.928872/s
iteration_duration.............: avg=110.22ms min=3.5ms med=105.48ms max=335.86ms p(90)=176.93ms p(95)=199ms
iterations.....................: 20000 453.343418/s
vus............................: 50 min=50 max=50
vus_max........................: 50 min=50 max=50
running (00m44.1s), 00/50 VUs, 20000 complete and 0 interrupted iterations
default ✓ [======================================] 50 VUs 00m44.1s/10m0s 20000/20000 shared iters
58.82user 14.77system 0:45.27elapsed 162%CPU (0avgtext+0avgdata 750136maxresident)k
0inputs+0outputs (3major+512205minor)pagefaults 0swaps
/usr/bin/time k6 run test.js 58.82s user 14.77s system 162% cpu 45.275 total
data_received..................: 29 GB 654 MB/s
data_sent......................: 52 MB 1.2 MB/s
http_req_blocked...............: avg=3.47µs min=370ns med=1.07µs max=15.25ms p(90)=1.92µs p(95)=2.54µs
http_req_connecting............: avg=776ns min=0s med=0s max=13.17ms p(90)=0s p(95)=0s
http_req_duration..............: avg=15.74ms min=34.34µs med=4.21ms max=248.98ms p(90)=43.55ms p(95)=56.73ms
{ expected_response:true }...: avg=15.74ms min=34.34µs med=4.21ms max=248.98ms p(90)=43.55ms p(95)=56.73ms
http_req_failed................: 0.00% ✓ 0 ✗ 520000
http_req_receiving.............: avg=354.31µs min=5.42µs med=26.96µs max=161.46ms p(90)=173.62µs p(95)=740.36µs
http_req_sending...............: avg=12.02µs min=2.06µs med=4.8µs max=43.43ms p(90)=8.05µs p(95)=12.87µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=15.37ms min=22.05µs med=3.91ms max=248.91ms p(90)=42.97ms p(95)=55.93ms
http_reqs......................: 520000 11956.943388/s
iteration_duration.............: avg=108.66ms min=3.16ms med=103.75ms max=395.07ms p(90)=174.21ms p(95)=198.11ms
iterations.....................: 20000 459.882438/s
vus............................: 50 min=50 max=50
vus_max........................: 50 min=50 max=50
running (00m43.5s), 00/50 VUs, 20000 complete and 0 interrupted iterations
default ✓ [======================================] 50 VUs 00m43.5s/10m0s 20000/20000 shared iters
57.98user 14.87system 0:44.63elapsed 163%CPU (0avgtext+0avgdata 743168maxresident)k
0inputs+0outputs (1major+515545minor)pagefaults 0swaps
/usr/bin/time k6 run test.js 57.99s user 14.88s system 163% cpu 44.638 total
data_received..................: 29 GB 564 MB/s
data_sent......................: 52 MB 1.0 MB/s
http_req_blocked...............: avg=9.13µs min=353ns med=1.03µs max=57.89ms p(90)=1.95µs p(95)=2.64µs
http_req_connecting............: avg=3.19µs min=0s med=0s max=24.93ms p(90)=0s p(95)=0s
http_req_duration..............: avg=16.59ms min=31.12µs med=8.97ms max=194.68ms p(90)=41.01ms p(95)=51.65ms
{ expected_response:true }...: avg=16.59ms min=31.12µs med=8.97ms max=194.68ms p(90)=41.01ms p(95)=51.65ms
http_req_failed................: 0.00% ✓ 0 ✗ 520000
http_req_receiving.............: avg=607.08µs min=5.18µs med=29.72µs max=172.47ms p(90)=552.58µs p(95)=3.22ms
http_req_sending...............: avg=37.91µs min=2.01µs med=4.92µs max=69.98ms p(90)=23.41µs p(95)=76.93µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=15.95ms min=21.4µs med=8.06ms max=177.43ms p(90)=40.09ms p(95)=50.45ms
http_reqs......................: 520000 10304.298947/s
iteration_duration.............: avg=126.07ms min=3.69ms med=121.76ms max=386.51ms p(90)=188.24ms p(95)=208.99ms
iterations.....................: 20000 396.31919/s
vus............................: 50 min=50 max=50
vus_max........................: 50 min=50 max=50
running (00m50.5s), 00/50 VUs, 20000 complete and 0 interrupted iterations
default ✓ [======================================] 50 VUs 00m50.5s/10m0s 20000/20000 shared iters
92.94user 15.06system 0:51.55elapsed 209%CPU (0avgtext+0avgdata 277344maxresident)k
0inputs+0outputs (0major+1221565minor)pagefaults 0swaps
/usr/bin/time k6 run test.js 92.94s user 15.07s system 209% cpu 51.556 total
data_received..................: 29 GB 552 MB/s
data_sent......................: 52 MB 1.0 MB/s
http_req_blocked...............: avg=7.48µs min=367ns med=1.05µs max=26.5ms p(90)=2.02µs p(95)=2.74µs
http_req_connecting............: avg=2.27µs min=0s med=0s max=26.41ms p(90)=0s p(95)=0s
http_req_duration..............: avg=16.91ms min=30.48µs med=9.11ms max=201.35ms p(90)=41.41ms p(95)=52.35ms
{ expected_response:true }...: avg=16.91ms min=30.48µs med=9.11ms max=201.35ms p(90)=41.41ms p(95)=52.35ms
http_req_failed................: 0.00% ✓ 0 ✗ 520000
http_req_receiving.............: avg=662.71µs min=5.16µs med=30.56µs max=160.65ms p(90)=637.9µs p(95)=3.8ms
http_req_sending...............: avg=34.48µs min=1.93µs med=5.01µs max=58.69ms p(90)=23.83µs p(95)=78.72µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=16.21ms min=18.69µs med=8.15ms max=201.33ms p(90)=40.35ms p(95)=51.17ms
http_reqs......................: 520000 10079.692605/s
iteration_duration.............: avg=128.87ms min=3.8ms med=124.19ms max=371.61ms p(90)=192.65ms p(95)=215.29ms
iterations.....................: 20000 387.680485/s
vus............................: 50 min=50 max=50
vus_max........................: 50 min=50 max=50
running (00m51.6s), 00/50 VUs, 20000 complete and 0 interrupted iterations
default ✓ [======================================] 50 VUs 00m51.6s/10m0s 20000/20000 shared iters
94.50user 15.35system 0:52.54elapsed 209%CPU (0avgtext+0avgdata 282408maxresident)k
0inputs+0outputs (0major+1148635minor)pagefaults 0swaps
/usr/bin/time k6 run test.js 94.50s user 15.36s system 209% cpu 52.551 total
data_received..................: 29 GB 553 MB/s
data_sent......................: 52 MB 1.0 MB/s
http_req_blocked...............: avg=23.23µs min=396ns med=1.05µs max=39.61ms p(90)=1.97µs p(95)=2.67µs
http_req_connecting............: avg=16.08µs min=0s med=0s max=39.6ms p(90)=0s p(95)=0s
http_req_duration..............: avg=16.85ms min=32.66µs med=9.11ms max=185.92ms p(90)=41.34ms p(95)=51.95ms
{ expected_response:true }...: avg=16.85ms min=32.66µs med=9.11ms max=185.92ms p(90)=41.34ms p(95)=51.95ms
http_req_failed................: 0.00% ✓ 0 ✗ 520000
http_req_receiving.............: avg=658.14µs min=5.16µs med=30.5µs max=168.94ms p(90)=577.64µs p(95)=3.66ms
http_req_sending...............: avg=37µs min=2.08µs med=5.01µs max=47.56ms p(90)=22.48µs p(95)=77.14µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=16.15ms min=21.78µs med=8.08ms max=177.57ms p(90)=40.32ms p(95)=50.67ms
http_reqs......................: 520000 10112.139426/s
iteration_duration.............: avg=128.48ms min=4.12ms med=124.8ms max=378.1ms p(90)=190.52ms p(95)=211.41ms
iterations.....................: 20000 388.928439/s
vus............................: 50 min=50 max=50
vus_max........................: 50 min=50 max=50
running (00m51.4s), 00/50 VUs, 20000 complete and 0 interrupted iterations
default ✓ [======================================] 50 VUs 00m51.4s/10m0s 20000/20000 shared iters
95.22user 15.07system 0:52.46elapsed 210%CPU (0avgtext+0avgdata 279816maxresident)k
0inputs+0outputs (0major+1138510minor)pagefaults 0swaps
/usr/bin/time k6 run test.js 95.22s user 15.08s system 210% cpu 52.464 total
package main
import (
"bytes"
"fmt"
"net/http"
"net/http/httptest"
"os"
"os/signal"
"syscall"
"github.com/mccutchen/go-httpbin/v2/httpbin"
)
var mbData = bytes.Repeat([]byte("0123456789"), 100000)
func main() {
httpbin := httpbin.New(
httpbin.WithMaxBodySize(100000000),
)
mux := http.NewServeMux()
mux.Handle("/", httpbin.Handler())
mux.HandleFunc("/1mbdata", http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
_, err := resp.Write(mbData)
if err != nil {
fmt.Println(err)
}
}))
t := httptest.NewServer(mux)
defer t.Close()
fmt.Println(t.URL)
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
<-c
os.Exit(0)
}
import http from 'k6/http';
export let options = {
vus: 50,
iterations: 20000,
batchPerHost: 25,
insecureSkipTLSVerify: true
};
var testServer = 'http://127.0.0.1:36867' // Change to your server URL
export default function () {
http.get(`${testServer}/`);
http.post(`${testServer}/post`);
http.batch([
['GET', `${testServer}/gzip`],
['GET', `${testServer}/gzip`],
['GET', `${testServer}/deflate`],
['GET', `${testServer}/deflate`],
['GET', `${testServer}/redirect/5`],
['GET', `${testServer}/get`],
['GET', `${testServer}/html`],
['GET', `${testServer}/bytes/100000`],
['GET', `${testServer}/image/png`],
['GET', `${testServer}/image/jpeg`],
['GET', `${testServer}/image/jpeg`],
['GET', `${testServer}/image/webp`],
['GET', `${testServer}/image/svg`],
['GET', `${testServer}/forms/post`],
['GET', `${testServer}/bytes/100000`],
['GET', `${testServer}/stream-bytes/100000`],
]);
http.get(`${testServer}/get`);
http.get(`${testServer}/get`);
http.get(`${testServer}/1mbdata`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment