Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

periodic cleanup of shared memory? #282

Open
skycyan opened this issue Nov 13, 2023 · 2 comments
Open

periodic cleanup of shared memory? #282

skycyan opened this issue Nov 13, 2023 · 2 comments
Labels

Comments

@skycyan
Copy link

skycyan commented Nov 13, 2023

In the nginx-module-vts, when using vhost_traffic_status_filter_by_set_key, it leads to continuous growth of shared memory. Is it possible to periodically clean up the data in shared memory, for example, retaining only the data from the last 7 days?

@SuperQ
Copy link
Collaborator

SuperQ commented Nov 13, 2023

No, not really possible without restarting. The reason is you can't do partial cleanup of data easily. Most of the monitoring uses counters, which need to be monotonic. It also needs to be consistent across counters in the same metric family.

From a "principal of lease surprise" perspective, a reload or restart that clears all metrics is what is possible.

@vozlt
Copy link
Owner

vozlt commented Nov 23, 2023

The shared memory used by the vts module is not dynamically increased after initial allocation. If you want to delete data in the shared memory allocated during operation, you can use status control api. Even if you use this command, the allocated shared memory remains the same. How much shared memory's maxSize, usedSize, usedNode is on the status page on average?

FYI. https://blog.openresty.com/en/how-nginx-shm-consume-ram/#fake-memory-leaks

@u5surf u5surf added the question label Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants