diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-10-06 01:25:37 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-10-06 01:25:37 -0700 |
| commit | 8668d49c9d14b063d8c363e0abd3e0bf7e0120e8 (patch) | |
| tree | bc32657c87f92b0f943a365f16b62f0e054be5b2 | |
| parent | 6b31f3c97a5d12b29e93182db10fdddd82e198b5 (diff) | |
| download | seaweedfs-8668d49c9d14b063d8c363e0abd3e0bf7e0120e8.tar.xz seaweedfs-8668d49c9d14b063d8c363e0abd3e0bf7e0120e8.zip | |
test with real redis
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
BenchmarkNameList-12 1789 760599 ns/op
BenchmarkRedis-12 17539 64122 ns/op
PASS
| -rw-r--r-- | weed/filer/redis3/kv_directory_children_test.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/weed/filer/redis3/kv_directory_children_test.go b/weed/filer/redis3/kv_directory_children_test.go index 1b97d8aaf..5c1cff2bb 100644 --- a/weed/filer/redis3/kv_directory_children_test.go +++ b/weed/filer/redis3/kv_directory_children_test.go @@ -117,3 +117,44 @@ func BenchmarkRedis(b *testing.B) { client.ZAddNX(context.Background(),"/yyy/bin", &redis.Z{Score: 0, Member: "name"+strconv.Itoa(i)}) } } + + +func xBenchmarkNameList(b *testing.B) { + + server, err := tempredis.Start(tempredis.Config{}) + if err != nil { + panic(err) + } + defer server.Term() + + client := redis.NewClient(&redis.Options{ + Addr: "localhost:6379", + Password: "", + DB: 0, + }) + + store := newSkipListElementStore("/yyy/bin", client) + var data []byte + for i := 0; i < b.N; i++ { + nameList := skiplist.LoadNameList(data, store, maxNameBatchSizeLimit) + + nameList.WriteName("name"+strconv.Itoa(i)) + + if nameList.HasChanges() { + data = nameList.ToBytes() + } + } +} + +func xBenchmarkRedis(b *testing.B) { + + client := redis.NewClient(&redis.Options{ + Addr: "localhost:6379", + Password: "", + DB: 0, + }) + + for i := 0; i < b.N; i++ { + client.ZAddNX(context.Background(),"/xxx/bin", &redis.Z{Score: 0, Member: "name"+strconv.Itoa(i)}) + } +} |
