Closed ypid-work closed 1 year ago
I did not consider that vector container should be allowed to use more CPU than what it requests as needed and unused capacity is there. So setting VECTOR_THREADS to CPU request is a bad idea as it would prevent that. I am closing this. The vector default is perfectly fine.
Thanks for following up @ypid-work !
I tested if Vector 0.33.0 can detect resource.requests.cpu from the Kubernetes pod it is running in. It or rather std::thread::available_parallelism() cannot. I then came up with:
Works nicely. Only thing to note, if a pod has no CPU request set, it sets the variable to 0 and vector is not happy about that. But that is something that can be solved with gotemplate.
I cannot contribute a PR but thought I would share this snippet. I am testing it starting now.
Ref: https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#store-container-fields Ref: https://vector.dev/highlights/2023-09-27-0-33-0-upgrade-guide/#runtime-worker-threads