commonshost / commonshost/dohnut

Use cluster instead of worker_threads

Open
#7 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
89
Forks
6
PR merge metrics
No merged PRs in 30d

Description

## Cluster

Pro:
- Load balancing happens by kernel/Node.js distributing UDP messages across all sockets listening on the same host:port.
- No per-query IPC.
- Scales horizontally even with a single DoH upstream.
- Simpler design. Every cluster worker is an independent "master." Without the message passing and state management between threaded master/workers.

Con:
- One HTTP/2 session per origin per worker. Potentially less efficient on the network than re-using the same session.

## Worker Threads

Pro:
- Single HTTP/2 session per DoH resolver.
- Shiny new API.

Con:
- Wasted IPC on single-core CPU of Raspberry Pi or restricted Docker.
- Fixed overhead of IPC between worker/master.
- Cloning buffers is slower than expected. Sharing memory may be better but hard to measure performance (no support yet in Clinic.js).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.