parsecph / clobbr

⚡️ A tool to check the speed and resilience of your API endpoints against multiple parallel or sequence requests.
https://clobbr.app
MIT License
191 stars 13 forks source link

Issue parsing parallel requests #199

Closed nixstrom closed 1 day ago

nixstrom commented 3 days ago

I'm trying to stress test an endpoint to see how many concurrent requests if can handle. I'm running the command:

pnpx @clobbr/cli run --url "http://kittenswithrockets" --iterations "20" --parallel

When doing so, the script fails with the following message: TypeError: Cannot read properties of undefined (reading '0').

Full error with stacktrace:

image

One observation I have is that the first request is green, the following will turn yellow, amber and finally fail. It seems it's failing already after 2-4 requests.

What works?

If the requests are not parallel, everything seems fine and the results are parsed nicely.

What have I tried?

I've tried running the command with both npx and pnpx, as well as GET and POST. I've also tried switching to a different endpoint, to one I know will succeed (a stupid endpoint that only returns OK 200).

I've also tried firing off multiple requests in Postman and other applications, but this is a bit tricky to time correctly.

Finally, I've tried firing off parallel requests with cURL with inspiration from Stack Overflow. In this case all requests succeeded – but it's just not as nice as clobbr!

nixstrom commented 3 days ago

I have a bit more information.

I was originally trying to test a slow endpoint, but found that the error happens on a fast endpoint as well. Today I tried turning off my VPN, and lo' and behold the fast endpoint now works (but the slow one doesn't).

Now, if I turn my VPN back on, I can replicate the error even on Google.com – although it takes more iterations before it does so. So perhaps it's a latency thing?

pnpx @clobbr/cli run --url "https://google.com" --iterations "50" --parallel

danmindru commented 2 days ago

hi @nixstrom, I've done some fixes in the area and I hope this'll get it working for you. Unfortunately, I could not reproduce the issue no matter how hard I tried :D

So it's a bit of a shot in the dark. Let me know if you still have issues. I am not sure how pnpm cache works, but perhaps you want to run e.g.

pnpx @clobbr/cli@1.16.1 run --url "https://google.com" --iterations "50" --parallel

to make sure you get the latest version.

Let me know how it goes 🙈

nixstrom commented 2 days ago

Hi @danmindru

Thanks for looking into this. Unfortunately, it did not solve the problem for me. 😭

Do you accept contricutions? Perhaps I can look at this next week.

danmindru commented 1 day ago

Darn. What is the error you get this time?

Sure, that would be awesome if you have time! I’d like to have another go at it too. Will keep you posted 🙌

nixstrom commented 1 day ago

Same error as before.

There are two situations where I get this error:

  1. By testing a slow endpoint, which I know throws an error when it is overloaded.
  2. By connecting to VPN and trying to test any endpoint. See below where I try to test Google.com.

image

danmindru commented 1 day ago

I got the craziest idea @nixstrom. Maybe your terminal does not support a certain color I'm using to output the very bad times :D

I took that out. Can you try with v1.16.2? 😬

nixstrom commented 1 day ago

Yes! That was it. I'm on a different network now, but it seems that v1.6.2 works while v1.6.1 still fails.

For reference, I'm using Warp on macOS Ventura.

danmindru commented 22 hours ago

Awesome! That was a nice one haha 🙈 Thanks for reporting!