DiceDB / dice

DiceDB is a redis-compliant, in-memory, real-time, and reactive database optimized for modern hardware and for building and scaling truly real-time applications.
https://dicedb.io/
Other
6.6k stars 1.05k forks source link

`BenchmarkEvalMSET` benchmark test behaviour is inconsistent #385

Closed AshwinKul28 closed 1 month ago

AshwinKul28 commented 2 months ago

How to reproduce?


$ cd core
$ /core go test -bench=. -test.benchmem 
     | 2024/08/22 00:33:48 possible cross protocol scripting attack detected. dropping the request.
     | rand seed: 1724267028521704000Queue size : 3
     | goos: darwin
     | goarch: arm64
     | pkg: github.com/dicedb/dice/core
     | BenchmarkAOFWithExat-10                                               271           4498089 ns/op              32 B/op          1 allocs/op
     | BenchmarkLargeByteArray1-10                                      1000000000               0.005893 ns/op        0 B/op          0 allocs/op
     | BenchmarkLargeByteArray2-10                                             1        5055459959 ns/op         2159744 B/op      32003 allocs/op

The test suite forever halts at this point. There's an issue in the BenchmarkEvalMSET (If you comment this particular test whole suite runs perfectly fine) Get the debug logs while benchmarking - GODEBUG=gctrace=1 go test -bench=. -test.benchmem

Probable issue:

It seems in each iteration, the store and required values are not getting initialized causing blockage

sbshah97 commented 2 months ago

Hi is it okay if I give this a try?

AshwinKul28 commented 2 months ago

Sure @sbshah97 Thanks for picking it up!

@JyotinderSingh please assign it to him.

JyotinderSingh commented 2 months ago

Hi is it okay if I give this a try?

Assigned

sbshah97 commented 2 months ago

Hi I'm going to be looking at this on Tuesday. Slightly caught up on the weekend.

sbshah97 commented 2 months ago
Running tool: /opt/homebrew/bin/go test -benchmem -run=^$ -bench ^BenchmarkEvalMSET$ github.com/dicedb/dice/core

goos: darwin
goarch: arm64
pkg: github.com/dicedb/dice/core
BenchmarkEvalMSET-10           50248         22360 ns/op      328741 B/op         24 allocs/op
PASS
ok      github.com/dicedb/dice/core 1.615s

Fixed this and tested on local running only the test. Earlier it was not running, runs now based on the above hints. Sending MR now.