Deprecate and remove in-memory object caching (#5481)

in-memory caching cannot be cleanly implemented
without the access to GC which Go doesn't naturally
provide. At times we have seen that object caching
is more of an hindrance rather than a boon for
our use cases.

Removing it completely from our implementation
  related to #5160 and #5182
This commit is contained in:
Harshavardhana
2018-02-02 10:17:13 -08:00
committed by kannappanr
parent 1ebbc2ce88
commit 0c880bb852
15 changed files with 4 additions and 1022 deletions

View File

@@ -53,42 +53,3 @@ func setMaxResources() (err error) {
err = sys.SetMaxMemoryLimit(maxLimit, maxLimit)
return err
}
func getMaxCacheSize(curLimit, totalRAM uint64) (cacheSize uint64) {
// Return zero if current limit or totalTAM is less than minRAMSize.
if curLimit < minRAMSize || totalRAM < minRAMSize {
return cacheSize
}
// Return 50% of current rlimit or total RAM as cache size.
if curLimit < totalRAM {
cacheSize = curLimit / 2
} else {
cacheSize = totalRAM / 2
}
return cacheSize
}
// GetMaxCacheSize returns maximum cache size based on current RAM size and memory limit.
func GetMaxCacheSize() (cacheSize uint64, err error) {
// Get max memory limit
var curLimit uint64
if curLimit, _, err = sys.GetMaxMemoryLimit(); err != nil {
return cacheSize, err
}
// Get total RAM.
var stats sys.Stats
if stats, err = sys.GetStats(); err != nil {
return cacheSize, err
}
// In some OS like windows, maxLimit is zero. Set total RAM as maxLimit.
if curLimit == 0 {
curLimit = stats.TotalRAM
}
cacheSize = getMaxCacheSize(curLimit, stats.TotalRAM)
return cacheSize, err
}