Victoriametrics: maxConcurrentInserts default value when running inside a container

Created on 8 Dec 2020  路  8Comments  路  Source: VictoriaMetrics/VictoriaMetrics

Is your feature request related to a problem? Please describe.
When running inside a container the default maxConcurrentInserts doesn't seem to take into account the current cgroup limits but only the root cgroup limits. This can cause default value to be wrong (too high) when running inside Docker/Kubernetes.

Describe the solution you'd like
Use current cgroup limits to calculate default value.

Describe alternatives you've considered
Set maxConcurrentInserts explicitly.

Additional context
This could also be an issue for other calculated parameters.

bug

All 8 comments

What version of VictoriaMetrics (or vminsert) do you run? Try the latest one (v1.50.0 now). The issue with incorrect limits' detection should be already fixed in v1.42.0 - see https://github.com/VictoriaMetrics/VictoriaMetrics/issues/685#issuecomment-698595309 .

I tried with 1.48. I just tested with 1.49 (I don't see 1.50 in the releases) and I get the same issue. On a machine with one core maxConcurrentInserts will be set to 4 and on a machine with 16 cores it will be set to 64. In both cases the CPU limit is set to 0.5 core so I would expect maxConcurrentInserts to be set to 2.

The default is runtime.GOMAXPROCS(-1)*4
https://github.com/VictoriaMetrics/VictoriaMetrics/blob/master/lib/writeconcurrencylimiter/concurrencylimiter.go#L16

I guess runtime.GOMAXPROCS(-1) only returns number of cores on the machine.

Confirmed the issue. It should be fixed in the commit 4146fc46681b532ad22973a846c0a0b2941f39ff . @alexandv , could you build VictoriaMetrics from this commit according to the docs and verify whether the CPU limit is applied properly?

The maxConcurrentInserts is now 4 for both cases (1 core and 16 core machines). The cpu limit is set to 500m on the container. Not sure if that's the expected value.

I tried setting the limit to 2 and maxConcurrentInserts becomes 8. So that looks good I think

The maxConcurrentInserts is now 4 for both cases (1 core and 16 core machines). The cpu limit is set to 500m on the container. Not sure if that's the expected value.

That's expected value, since the number of available CPU cores is rounded to 1 if the limit is smaller than a single CPU core.

Sounds good. Thanks @valyala

Was this page helpful?
0 / 5 - 0 ratings