GithubHelp home page GithubHelp logo

Comments (5)

janisz avatar janisz commented on June 1, 2024

Could you share your configuration. Bigcache does not free once allocated memory to system.

from bigcache.

teng231 avatar teng231 commented on June 1, 2024
func getConfig(config *BigCacheConfig) bigcache.Config {
	return bigcache.Config{
		// number of shards (must be a power of 2)
		Shards: 16,

		// time after which entry can be evicted
		LifeWindow: 10 * time.Hour, // 5 * time.Minute,

		// Interval between removing expired entries (clean up).
		// If set to <= 0 then no action is performed.
		// Setting to < 1 second is counterproductive — bigcache has a one second resolution.
		CleanWindow: 5 * time.Minute,

		// rps * lifeWindow, used only in initial memory allocation
		MaxEntriesInWindow: 1000 * 10 * 60,

		// max entry size in bytes, used only in initial memory allocation
		MaxEntrySize: 100,

		// prints information about additional memory allocation
		Verbose: false,

		// cache will not allocate more memory than this limit, value in MB
		// if value is reached then the oldest entries can be overridden for the new ones
		// 0 value means no size limit
		HardMaxCacheSize: 500,

		// callback fired when the oldest entry is removed because of its expiration time or no space left
		// for the new entry, or because delete was called. A bitmask representing the reason will be returned.
		// Default value is nil which means no callback and it prevents from unwrapping the oldest entry.
		OnRemove: nil,

		// OnRemoveWithReason is a callback fired when the oldest entry is removed because of its expiration time or no space left
		// for the new entry, or because delete was called. A constant representing the reason will be passed through.
		// Default value is nil which means no callback and it prevents from unwrapping the oldest entry.
		// Ignored if OnRemove is specified.
		OnRemoveWithReason: nil,
	}
}

from bigcache.

janisz avatar janisz commented on June 1, 2024

so in your example cache uses 400MB while max size it's 500MB. I think it's correct behavior.

from bigcache.

teng231 avatar teng231 commented on June 1, 2024

so in your example cache uses 400MB while max size it's 500MB. I think it's correct behavior.

mem start with 90mb my data limit 2000 items
but after 10 days increase 1gb
image
i setup limit resource on k8s pod will be restarted when memory equal 1GB. if not limit maybe can increase more

from bigcache.

janisz avatar janisz commented on June 1, 2024

Go 1.19 introduced GOMEMLIMIT maybe it's worth to use it. Although bigcache should not consume more memory then HardMaxCacheSize there is still some room for underlying map and a chance that Go does not release once allocated memory.

from bigcache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.