Hi,
I am investigating the memory footprint of our gRPC-based application. While I was looking at a heap dump I found out that the most often created String (60000 objects) is "dummy.DummyService/subscribe" which is contained in:
java.lang.String @ 0xff38c8a8 dummy.DummyService/subscribe
'- fullMethodName io.grpc.internal.CensusStatsModule$ServerTracer @ 0xff38c948
'- [0] io.grpc.StreamTracer[2] @ 0xff38c930
'- tracers io.grpc.internal.StatsTraceContext @ 0xff38c9e8
|- statsTraceCtx, statsTraceCtx io.grpc.netty.NettyServerStream$TransportState @ 0xff38ca10
|- statsTraceCtx io.grpc.internal.MessageDeframer @ 0xff38ca68
|- statsTraceCtx io.grpc.netty.NettyServerStream @ 0xff38cb38
|- statsTraceCtx io.grpc.internal.MessageFramer @ 0xff38cb80
For reference the second most often created String (which is not related to gRPC) has 10000 instances.
This let me to the conclusion that the tracing should be disabled (because the application is not using this data), but methods like setStatsEnabled, setTracingEnabled in io.grpc.netty.NettyServerBuilder are protected.
Environment: Java 8, gRPC 1.12.0
I have few questions:
- Why are these methods protected? Are stats and tracing vital for correctly working gRPC server?
- May be it is a good idea to intern the mentioned String?
- Are there other components which can be disabled for better performance and lower memory footprint?
Thanks,
Stefan