I'm running cerbos in Kubernetes, is there a recom...
# help
j
I'm running cerbos in Kubernetes, is there a recommended CPU and memory limit to give it?
o
Hi! Cerbos is very lightweight and doesn't require a lot of resources. Obviously, the actual requirements depend on factors like requests per second, number of policies etc. For a typical situation you can start with maybe 64mb of memory limit and 0.1 CPU request. Don't set a CPU limit because that'd just throttle Cerbos even when there's plenty of CPU available. Monitor the performance with those settings and adjust as necessary.
j
Cool, yeah I figured it shouldn't need much. But I'm seeing very high latencies (~1.5s) when checking 50 resources. Is that expected?
Single resources take <100ms
o
Do you run cerbos as a sidecar and send requests to it from the main container? (or how does your setup look like?) Does latency change when you increase the resources?
j
I'm running it as a standalone service. I need to have resource limits for compliance reasons, so I just bumped it up to this setup:
Copy code
resources:
  requests:
    cpu: 150m
    memory: 192Mi
  limits:
    cpu: 1
    memory: 384Mi
and it improved somewhat, about 500ms
I suspect it's something to do with the policy itself since some policies are evaluating much faster
o
Since there are many policies referenced in the request, cerbos parallelizes some of the work. That’s why we highly recommend not using the cpu limits at all with the cerbos. In addition, it is important; 1. what storage method is used? 2. is the client sending requests to cerbos at the same cluster?
j
The request I'm making is actually against just one policy. (many resources, but just one resource kind). Does it still parallelize in that case? I'm using the disk driver for storage. There are no other requests happening since this is in a non-production environment.
o
Yes, it does parallelize in that case too.
👍 1