jsdelivr / globalping-probe

The globalping probe code that runs on your hardware and connects to the global community network of probes
https://www.jsdelivr.com/globalping
79 stars 21 forks source link

Confirm multi-core support with data per test #10

Open zarianec opened 2 years ago

zarianec commented 2 years ago

The probe server must utilize all available CPU cores.

Yes, I wanted to use throng for clustering but it means that every single probe will create multiple separate ws clients.

Originally posted by @zarianec in https://github.com/jsdelivr/globalping/issues/37#issuecomment-1073936379zz

Alternative by Patryk https://nodejs.org/docs/latest-v12.x/api/worker_threads.html

jimaek commented 2 years ago

each command execution spawns a separate process, the master process just handles the connection to the server and passes data back and forth so this task can be closed imo as long as we spawn a new process per command its done

patrykcieszkowski commented 2 years ago

each command execution spawns a separate process, the master process just handles the connection to the server and passes data back and forth so this task can be closed imo as long as we spawn a new process per command its done

@zarianec It might make sense to run output parsers in worker threads, but I wouldn't worry about HTTP I/O, and ofc we don't have to worry about native commands since they run on separate processes already.

jimaek commented 2 years ago

Note to correctly handle native HTTP tests as well that dont call a binary https://github.com/jsdelivr/globalping/issues/91

patrykcieszkowski commented 2 years ago

@jimaek as explained - it’s done

jimaek commented 2 years ago

Even HTTP (got)?

patrykcieszkowski commented 2 years ago

HTTP is an I/O request - it’s asynchronous like web sockets are. It’s not recommended to run I/O requests on separate threads, since native aync mechanism is much more performant. I’ve also proven this on my benchmark test cases.

https://github.com/patrykcieszkowski/node-io-benchmark

https://nodejs.org/api/worker_threads.html#worker-threads

jimaek commented 2 years ago

@zarianec let us know what you think and if the task can be closed