Skip to content

Use cluster instead of worker_threads #7

@sebdeckers

Description

@sebdeckers

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions