Let's try and break my basic Node.js concurrent app

5 points by christosmaris ↗ HN
I build a NodeJS app that uses worker_threads for concurrency. Ultimately, I want to create an app that keeps track of all the online clients on a WebRTC network that I'll build.

What I want to see is how many clients can it keep track of at the same time. It identifies clients via their IP (which can be masked). It would be awesome if you could help me find its limits by doing the following:

1. Open 4-5 chrome tabs and navigate to https://clientcounter.herokuapp.com/total in all of them.

2. Open the console and paste the following code:

setInterval(()=>{fetch("https://clientcounter.herokuapp.com/subscribe",{method:"get",headers:{"x-forwarded-for":Math.random().toString(36).replace(/[^a-z]+/g,"")}}).then(e=>e.json()).then(console.log)},50);

3. Let it run for quite some time.

4. Tell your friends :)

The github repo (in case anyone is curious or would like to help) is: https://github.com/christosmaris/clientcounter

Thanks a lot in advance :D

3 comments

[ 2.7 ms ] story [ 21.6 ms ] thread
Interesting, I think you'd get more participants if you made it an actual website.

Instead of having to open the devtools and manually paste in the script, why not just have a script on a HTML page?

If you’re trying to load test then why not use a load testing tool like Vegeta or k6? You can use a list of ip addresses and have it set a special header with an IP address. Then your app could use the ip address in the header to keep track of clients.

You probably get better and faster results.