On 2020-07-08 08:44, 白洋洋 wrote:
> Ok,thank you .But the expression
> "container_memory_usage_bytes{container_name="prometheus"}", which is
> a metrics of kubernetes-cadvisor, shows the memory that Prometheus
> used is about 33G,Isn't it a little too high?Is it that most of this
> memory is cache, and we don't need to worry about it?(The memory of
> the computer is 48G)
From your other checks it suggests most is indeed cache.
As with all databases lots of memory is used to hold values stored on
disk, to speed up queries. As mentioned this cache memory is managed by
the kernel which will use as much as is available (totally free memory
is a waste, so it is better to use it as cache) but throw it away if the
memory is needed for applications.
Prometheus itself does need a reasonable amount of memory to hold
recently scraped data, handle compaction and process queries. This
memory is managed by the application, with the amount needed dependent
on the amount of data scraped (time series & scrape interval) and the
number & complexity of queries.
Prometheus will continue to operate if there isn't much cache memory
available, but performance will be affected at some point - disk access
(even SSD) is generally significantly slower than memory access. Disk IO
usage would increase as well as CPU IO time.
--
Stuart Clark