Improvements in the Plastic Proxy
A few releases ago, we published a bunch of improvements related to the Plastic Proxy. These updates are about monitoring space and cleaning cache up on disk. This helps you manage your Proxy behavior.
Let's see in detail all these improvements.
Support to cache data from Plastic Cloud
This is one of the long-awaited features for the Proxy—the ability to cache data from the Cloud.
And it is finally here!
No changes required. Just install a Proxy (and your client too if you use encrypted data in the Cloud) and start caching data.
Disk cache limit
Now, the proxy can limit the size of its on-disk cache.
How to configure
Very easy! Just use the new MaxCacheSizeInGb
in the plasticcached.conf
file.
For example:
<PlasticCacheConf> <MaxCacheSizeInGb>20.5</MaxCacheSizeInGb> </PlasticCacheConf>
And the Proxy will make sure that its cache size doesn't exceed 20.5 Gb.
A value of 0 means that the clean is disabled.
How it works
- The Proxy maintains a LRU (Least Recently Used list) and updates it on every data access.
- Every 10 minutes, it checks if the total cache size is bigger than the value configured. If the maximum size is exceeded, the Proxy retrieves the least recently used entries and removes them from disk.
- Every 3 minutes, the Proxy saves the LRU info to disk, to
proxy-data-path/proxy-lru.dat
. The Proxy also writes data on shutdown. - On startup and then every 8 hours, the Proxy checks if it needs to walk the entire cache directory to rebuild the LRU and recover from possible inconsistencies. While the check runs every 8 hours, a rebuild only happens once every 3 days. The Proxy stores the date of the last rebuild under
proxy-data-path/proxy-last-cache-walk.dat
.
proxy-data-path
is the directory where you configured the proxy to store the cache. For existing Proxy installations, the new version will rebuild the cache on the fly.
Some logs
During the startup of the Proxy, you'll see:
INFO LRU - Walking the disk to build the LRU (least recently used). c:\plastic\proxydata INFO LRU - Last LRU rebuild from disk happened less than 3 days ago. Skipping. 11/04/2019 16:50:00 INFO Daemon - Load LRU info from c:\plastic\proxydata\proxy-lru.dat INFO Daemon - LRU info loaded in 656 ms. 107299 entries. 5.89 Gb total in cache
You can see how the Proxy skips the rebuild and how it loaded 107k entries to the LRU.
Then, every 3 minutes, and during shutdown:
INFO Daemon - Save LRU to c:\plastic\proxydata\proxy-lru.dat INFO Daemon - LRU info saved in 312 ms. 107299 entries. 5.89 Gb total in cache
And during a clean up:
INFO Daemon - Cleaning up 0.69 Gb (17564 entries) of cached data to enforce the 5.20 Gb limit INFO Daemon - Cleaned up 0.69 (17564 entries) Gb in 5110 ms INFO Daemon - Save LRU to c:\plastic\proxydata\proxy-lru.dat INFO Daemon - LRU info saved in 265 ms. 89735 entries. 5.20 Gb total in cache
Monitor free space
The Plastic Proxy is now able to monitor free space on disk and clean up the cache to avoid running out of disk.
You'll see something as follows in the log when it runs out of disk:
INFO Daemon - Disk is running out of space. 5.78 Gb available. Will delete 1.15 Gb from cache INFO Daemon - Cleaning up 1.15 Gb (9576 entries) INFO Daemon - Cleaned up 1.15 Gb (9576 entries) in 2578 ms
And, if there is enough room (twice the size of the cache) then something as follows:
INFO Daemon - Disk still has enough space: 19.53 Gb available.
More info in the log file
The log now shows the caller IP and the user name. This information appears in the log line after the GetObjectsData
call.
You can now see who's causing trouble!
Now the log is as follows:
Proxy - Request: 39. Type: downl. Files requested: 10. Cache misses: 10. Total time: 16 ms. Downloaded: 3.78 Mb from default@localhost:8084. Total returned: 3.78 Mb. IP: 127.0.0.1. User: 'pablo'.
0 comentarios: