-
Notifications
You must be signed in to change notification settings - Fork 479
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
Disk cache grows beyond the limit #45
Comments
Another thing, the cache files are stored flat on the filesystem (that's the default option for the diskv |
I don't understand this code neither: var cacheDir = flag.String("cacheDir", "", "directory to use for file cache")
var cacheSize = flag.Uint64("cacheSize", 100, "maximum size of file cache (in MB)")
...
var c httpcache.Cache
if *cacheDir != "" {
d := diskv.New(diskv.Options{
BasePath: *cacheDir,
CacheSizeMax: *cacheSize * 1024 * 1024,
})
c = diskcache.NewWithDiskv(d)
} else if *cacheSize != 0 {
c = httpcache.NewMemoryCache()
} |
Maybe to do something like this ? var c httpcache.Cache
if *fileCache {
if *cacheDir != "" {
d := diskv.New(diskv.Options{
BasePath: *cacheDir,
CacheSizeMax: *cacheSize * 1024 * 1024,
})
c = diskcache.NewWithDiskv(d)
} //TODO else error ?
} else if *memCache {
c = httpcache.NewMemoryCache()
} else {
c = nil
} |
Done it there toubib@6a0c813, no cache mode added. |
okay, so I figured out why this is happening. It's because I completely misunderstood what the This means that we don't actually have a way to limit the size of the image cache at this time for any of the backends. I'm going remove the cacheSize related code, since it's not doing anything meaningful. I'll leave the flag for the time being so that it doesn't cause panics, but it should no longer be used. |
this flag was never actually doing what I thought it was in the first place. Also fix up a few instances of cacheDir still be used in config files fixes #45
I've done a load test on my installation with this configuration (there is some options from my fork):
In front of that there is a nginx with a disk cache (who doesn't work the same than imageproxy cache as imageproxy still make a head request to the original server).
I've requested lot of different files and the imageproxy cache is now 3,2GiB with 56197 files. That's far beyond of the 1014MB given on the command line. Am I missing something ?
Since I already have a cache with nginx, it is possible to add an option to disable imageproxy cache ?
The text was updated successfully, but these errors were encountered: