robinhood / faust

Python Stream Processing
Other
6.74k stars 535 forks source link

Best practices for deploying Faust agent using Kubernetes #623

Open vishal-kvn opened 4 years ago

vishal-kvn commented 4 years ago

Checklist

Steps to reproduce

I am trying to deploy a Faust agent to production env using 2 pods. The agent consumes from a topic that has 6 partitions. After the deploy the agent runs until it receives a SIGTERM(15) and the agent shut downs and stops consuming messages.

I am wondering if there are any best practices around deploys using kubernetes.

Expected behavior

Agent gracefully handles the sigterm.

Actual behavior

App shuts down and stop consuming messages

Versions

afausti commented 4 years ago

@vishal-kvn I use a k8s deployment to run the Faust workers. I have configured the Faust app to auto discover the agents and the workers run indefinitely. This set up works fine to me.

vishal-kvn commented 4 years ago

@afausti Thanks for the reply. I will try it out.

vishal-kvn commented 4 years ago

@afausti Setting autodiscover=True did not fix the above issue. Also, I noticed that you set the replicaCount to 1(https://github.com/lsst-sqre/charts/blob/master/charts/kafka-aggregator/values.yaml#L3) for your worker. Have you deployed with a replicaCount greater than 1? For my use case I have a replicaCount of 3 but I noticed that only 1 worker(pod) is consuming messages. Please let me know if you came across this behavior.

bobh66 commented 4 years ago

A couple of questions:

Kubernetes will tell you what it doesn't like, you just need to look hard for it.

Hope this helps

vishal-kvn commented 4 years ago

@bobh66 Thanks for the reply.

taybin commented 3 years ago

@afausti I see you're using the memory storage for Tables. Do you think you'd need to use a StatefulSet instead of a Deployment if you switched to rocksdb?

muaaaz commented 2 years ago

@taybin have you tried implementing a StatefulSet for Faust when using Rocksdb?

burbma commented 1 year ago

@vishal-kvn My Faust app is also getting a sigterm 15, though I'm running via docker-compose, not k8s. I'm wondering if this ever went anywhere for you?