I have three clients on the same EC2 instance calling the same API:
1) k6 (v0.57):
import http from 'k6/http';
export default function () {
http.post(
'https://api.example.com/endpoint',
JSON.stringify({ foo: 'bar' }),
{ headers: { 'X-Auth-Token': __ENV.TOKEN }, timeout: '60s', redirects: 5 }
);
}
2) Python:
import json, sys
from urllib import request
req = request.Request(
'https://api.example.com/endpoint',
json.dumps({ 'foo': 'bar' }).encode(),
{ 'X-Auth-Token': sys.argv[1], 'Content-Type': 'application/json' }
)
resp = request.urlopen(req, timeout=60)
print(resp.read())
3) Shell (curl):
curl -sSL -w "STATUS:%{http_code}" \
-H "X-Auth-Token: $1" \
-H "Content-Type: application/json" \
--data '{"foo":"bar"}' \
https://api.example.com/endpoint
Observed:
- Python & curl complete in ~200 ms.
- k6 blocks for 60 s, then times out (server did not see the request).
What I’ve already tried:
- export K6_DNS=“policy=onlyIPv4” (still hung)
- export GODEBUG=“http2client=0” (still hung)
- k6 run --dns=“policy=onlyIPv4” --http-debug=“full” script.js
- change container from alpine to ubuntu, still hung
Notes:
- k6 v0.57
- No proxy in use
Questions:
- What else can I try to force k6 to behave like curl/python?
- Any known bugs in v0.57 around DNS or HTTP/2?
Thanks!
1 post - 1 participant