django / daphne

Django Channels HTTP/WebSocket server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kubernetes Deployment (General Discussion)

ZuSe opened this issue · comments

Hi folks,

the official docs do provide an good example how to deploy daphne to a BM or VPS, using the combination of supervisor + nginx. However, I personally would consider this to be to heavy for a typical kubernetes deployment, especially considering the fact that many clusters ship with very convenient LB / Ingress support.

For that reason I would like to start a more general discussion on how a smart setup for k8s could look like and what experience people made so far. Eventually it should result in a example / best practice guide to be added to the docs.

So open questions from my side would be.

  1. Is it worth adding nginx to the pod if there is already a LB / Ingress in use?
  2. Does it make sense to use supervisor as process manager or shouldn't it be enough to let k8s manage the lifetime of the pods?
  3. Is there any major problem letting daphne directly manage the HTTP & WS traffic?

Just to share our experience.
For now we are spawning one single daphne process per pod, serving up to 250 rq/s without any major performance issues.
However I am not sure if for larger scale scenarios multiple processes would be beneficial. According to OVH most k8s-nodes are quad-core or higher, i think it's similar on other providers.

Happy to discuss

Best
Patrick

Hi @ZuSe — Welcome, interesting — I'm going to move this to a discussion — that's more appropriate than an issue.

Don't have immediate answers 😬