I use nodejs to implement a feature, for exaple:
var net = require('net');
var maxConn = 15;
var head_str = 'GET / HTTP/1.1\r\nHost: www.test031801.com\r\n'
var clientArray = [];
while(maxConn--){
var client = net.connect({port: 80, host:'www.test031801.com'});
client.write(head_str);
client.on('error',function(e){
console.log(e)
})
client.on('end',function(){
console.log('end')
})
clientArray.push(client);
}
setInterval(function(){
clientArray.forEach(function(v){
v.write('xhead: gap\r\n');
})
},1000*8);
How I achieved it with K6 ?
Hi @boa_killer,
k6 is not nodejs … it has just as much in common with it as a browser.
Can you explain what you mean by “http terminator” and what you want to do?
Do you want to very slowly feed the request body to the server? That is currently not possible, you can open an issue if that is the case.
yes, I want to very slowly feed the request body to the server, and control the request body.
or I want to call the request module in nodejs,
import http from "k6/http";
import { check,sleep } from "k6";
import { request } from '/home/test_script/request/index.js';
But, it keeps reporting errors:
"WARN[0001] A url was resolved but it didn't have scheme. This will be deprecated in the future and all remote modules will need to explicitly use `https` as scheme url=//extend
ERRO[0021] GoError: The moduleSpecifier "extend" couldn't be retrieved from the resolved url "https://extend". Error : "Get https://extend: Unable to connect" "
You can’t call the request module in nodejs because k6 isn’t running on nodejs …
You are getting this message because you are trying to import extend
which I suppose is a some npm module? You can read more about modules in k6 and specifically about node modules.
1 Like