mcollina / autocannon

fast HTTP/1.1 benchmarking tool written in Node.js
MIT License
7.83k stars 325 forks source link

custom logic instead of simple http request #405

Open LiranBri opened 2 years ago

LiranBri commented 2 years ago

Hi, great tool! is it possible to make a custom logic operation instead of a simple HTTP request?

for example, I would like to make a query to Cassandra. or even test cpu-intensive operations.

thanks

mcollina commented 2 years ago

Unfortunately autocannon is based on HTTP... but maybe would you like to work on this?

ChakshuGautam commented 2 years ago

I would like to work on this. I know this is not a replacement to https://k6.io/ but I would want a similar functionality without much of a perf hit. An API similar to this maybe?

let checkRes = check(response, {
        "http2 is used": (r) => r.proto === "HTTP/2.0",
        "status is 200": (r) => r.status === 200,
        "content is present": (r) => r.body.indexOf("Collection of simple web-pages suitable for load testing.") !== -1,
});
mcollina commented 2 years ago

go for it!

ChakshuGautam commented 2 years ago

I think I wrongly read the issue. I just want custom checks - the OP wants to build more of an adapter for other connections. I will create a separate issue for this.