-
Notifications
You must be signed in to change notification settings - Fork 7
metarepos: avoid unnecessary stringification #423
Copy link
Copy link
Closed
Description
In profiling the metadata repository, I was surprised at unnecessary stringification.
(pprof) top20
Showing nodes accounting for 861616681, 81.50% of 1057181937 total
Dropped 490 nodes (cum <= 5285909)
Showing top 20 nodes out of 112
flat flat% sum% cum cum%
125614123 11.88% 11.88% 125614123 11.88% github.com/kakao/varlog/proto/mrpb.(*Report).Unmarshal
116831511 11.05% 22.93% 116831511 11.05% google.golang.org/grpc/internal/transport.(*itemList).enqueue (inline)
86035309 8.14% 31.07% 86035309 8.14% github.com/kakao/varlog/proto/snpb.(*GetReportResponse).Unmarshal
78118341 7.39% 38.46% 78655766 7.44% github.com/kakao/varlog/internal/metarepos.(*reportCollectExecutor).processReport
54327143 5.14% 43.60% 183294678 17.34% github.com/kakao/varlog/proto/mrpb.(*Reports).Unmarshal
52997758 5.01% 48.61% 52997758 5.01% strconv.formatBits
It is caused by types.(NodeID).String, which are called to make a label value of telemetry. We can avoid this by using a numeric value instead of a string value for that label.
varlog/internal/metarepos/raft_metadata_repository.go
Lines 815 to 820 in fc5b655
| mr.tmStub.mb.Records("mr.raft.commit.delay").Record(context.TODO(), | |
| float64(time.Since(r.CreatedTime).Nanoseconds())/float64(time.Millisecond), | |
| attribute.KeyValue{ | |
| Key: "nodeid", | |
| Value: attribute.StringValue(mr.nodeID.String()), | |
| }) |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
