chproxy icon indicating copy to clipboard operation
chproxy copied to clipboard

[QUESTION] Possible unexpected behavior in cacheSize/cacheItems metrics

Open hulk8 opened this issue 1 year ago • 1 comments

Question details I have an original Grafana dashboard for chproxy and faced issue with current cache size and cache items metrics. In my configuration there is a expire: 15m and max_size: 200Gb configs but on the dashboard and in metrics gauge values cacheItems and cacheSize are keep increasing. As I know, gauge can go up and down. image

Cache config:

caches:
  - name: "shortterm"
    mode: "file_system"
    file_system:
      dir: "/app/chproxy/shortterm/cache"
      max_size: 200Gb
    expire: 15m
    shared_with_all_users: true

Is this is an expected behavior? Does chproxy clear cache files only when max_size is reached?

hulk8 avatar Sep 06 '24 17:09 hulk8

It looks like unexpected behavior in expire := f.expire + f.grace. As far as I understand, expire calculated like this to prevent thundering herd and in fact calculated like this expire = expire + max_execution_time (because of this). Unexpected behavior is that cache persists after expire and max_execution_time cannot be big - cache will accumulate, and cannot be low - queries will be killed after max_execution_time timeout.

hulk8 avatar Sep 11 '24 13:09 hulk8