Golang Cache Problem

Hi guys. I have a 1.4GB TXT file in the content of key-value. I want cache this data but I have a problem. I use this library BigCache with default config. My application use too much RAM (7GB RAM Usage). How can I solve this problem.

Instead keeping big files in memory i think using a ssd drive on your computer,server or hosting is almost the same thing in terms of performance but less headaches.

1 Like

Without knowig how you use BigCache, we can’t help you.

But in general, I do assume that a lot of meta data has to be hold for each each key/value pair has to be hold in memory, as BigCache does expire aged entries. It probably needs to keep an index next to the data to be able to access quickly and so on.

But yes, I’d search for alternatives over keeping the file in memory as well.

		// 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: 8192,

You can try setting this to 2048 (2GB) in the config

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.