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

Reset datastores before every benchmark test #270

Conversation

gauravsarma1992
Copy link
Contributor

This PR solves the issue of constant high memory usage when running go test -bench=. -test.benchmem executerbechmark_test.go.
The memory allocated to a map grows as and when you start storing data in it. When you delete data from a map, Go doesn't automatically free up the memory and keeps it allocated to the map. So when the next set of Benchmarking tests ran, it reused some of the deleted memory and the memory footprint remained the same as the last benchmark test with the high number of keys.
In order to actually free the occupied memory and allocate a new block of memory, this PR initialises the data stores in the store.go before running every benchmark test. Looks like the memory footprint reduces again before every benchmark test.

https://discord.com/channels/1034342738960855120/1264145943884992595/1271153754410061927

@gauravsarma1992 gauravsarma1992 marked this pull request as ready for review August 8, 2024 17:35
@gauravsarma1992
Copy link
Contributor Author

Please review @JyotinderSingh

Copy link
Collaborator

@JyotinderSingh JyotinderSingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick debug and fix @gauravsarma1992 and @AshwinKul28!

@JyotinderSingh JyotinderSingh merged commit 82eabce into DiceDB:master Aug 8, 2024
2 checks passed
kushal0511-not pushed a commit to kushal0511-not/dice that referenced this pull request Aug 8, 2024
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

Successfully merging this pull request may close these issues.

2 participants