Skip to content
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

why Get sometimes become slow #106

Open
sanyfan opened this issue Mar 16, 2022 · 4 comments
Open

why Get sometimes become slow #106

sanyfan opened this issue Mar 16, 2022 · 4 comments

Comments

@sanyfan
Copy link

sanyfan commented Mar 16, 2022

I allocate 3G memory for cache. The size of cached data is about 10m terms and the cache memory is almost full.
When I use cache.Get(), I found sometimes it will cost much time in getting some items.

image

The flame graph shows cache.Get() spent a lot of time in lookup() and entryPtrIdx()

However, after I restart the server and rebuild the cache with the same data(maybe not in the same order), the performance issue disappears. The CPU time of the whole process decreases from more than 10 seconds to 0.X second.

Is there any factor that will affect this performance? The position of data? The data is evicted?

@fare83
Copy link

fare83 commented Apr 24, 2022

it use Lock in get。
easy way is you can new more cache object for performance。

@coocood
Copy link
Owner

coocood commented Apr 24, 2022

What's the hardware and OS environment?
Are there other processes running on the same machine?

@sanyfan
Copy link
Author

sanyfan commented Apr 25, 2022

What's the hardware and OS environment? Are there other processes running on the same machine?

we have 3 pods, each pod has 2 CPUs and 6G memory. the OS environment is Alpine. According to the log, there is no other request at our test time.

@sanyfan
Copy link
Author

sanyfan commented Apr 25, 2022

it use Lock in get。 easy way is you can new more cache object for performance。

according to the flame graph, it seems spent little time on Lock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants