-
Notifications
You must be signed in to change notification settings - Fork 473
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
Implement 24-hour check for apt cache updates to reduce network-load … #746
Conversation
…and improve running times This commit introduces a time-based check to ensure the apt-get cache is updated only once every 24 hours, optimizing resource usage and reducing network load. Why: Many Linux servers, including those within our company, utilize unattended upgrades that automatically update the package database. Limiting cache updates to once every 24 hours helps to minimize unnecessary load on our custom repo mirror/apt-cacher, especially when other services may have already performed an update. Technical Details: Modification Time Check: The script checks the modification timestamp of /var/cache/apt/pkgcache.bin to determine when the last update occurred. It calculates the time elapsed since that update using the timestamp. Time Difference Calculation: If more than 24 hours (86400 seconds) have passed since the last update, the script triggers an apt-get update, ensuring updates are performed only when necessary. Benefits: Server Load Reduction: By throttling updates, we reduce the load on package servers, apt-cacher proxies, or custom mirrors, preventing server strain and ensuring better availability of resources. Resource Efficiency: This approach conserves bandwidth and processing power by avoiding unnecessary updates, particularly in stable environments where frequent updates provide minimal benefit. Reduced Script Run Time: By skipping unnecessary updates, the script executes more quickly.
All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA or my organization already has a signed CLA. |
What if someone want's to check every hour for new updates? |
We can set it to update every hour, but in my opinion, it's not necessary to refresh the cache on every run. |
The plugin should be configured to run only every X hours. |
We have running the check not every 1 nor 5 minutes, but a few times a day, but we can set the limit to 6 hours so if someone has forgotten to decrease the interval of the check, it won't update every X Seconds/Minutes. |
This PR is not necessary as you already can achieve its goal with asynchronous execution of the plugin. |
…and improve running times
Proposed changes
General information
This commit introduces a time-based check to ensure the apt-get cache is updated only once every 24 hours, optimizing resource usage and reducing network load.
Why:
Many Linux servers, including those within our company, utilize unattended upgrades that automatically update the package database. Limiting cache updates to once every 24 hours helps to minimize unnecessary load on our custom repo mirror/apt-cacher, especially when other services may have already performed an update.
Technical Details:
Modification Time Check: The script checks the modification timestamp of /var/cache/apt/pkgcache.bin to determine when the last update occurred. It calculates the time elapsed since that update using the timestamp.
Time Difference Calculation: If more than 24 hours (86400 seconds) have passed since the last update, the script triggers an apt-get update, ensuring updates are performed only when necessary.
Benefits:
Server Load Reduction: By throttling updates, we reduce the load on package servers, apt-cacher proxies, or custom mirrors, preventing server strain and ensuring better availability of resources.
Resource Efficiency: This approach conserves bandwidth and processing power by avoiding unnecessary updates, particularly in stable environments where frequent updates provide minimal benefit.
Reduced Script Run Time: By skipping unnecessary updates, the script executes more quickly.