Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cluster instead of worker_threads #7

Open
sebdeckers opened this issue Feb 24, 2019 · 0 comments
Open

Use cluster instead of worker_threads #7

sebdeckers opened this issue Feb 24, 2019 · 0 comments

Comments

@sebdeckers
Copy link
Member

sebdeckers commented Feb 24, 2019

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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant