SkyAPM / go2sky

Distributed tracing and monitor SDK in Go for Apache SkyWalking APM
https://skywalking.apache.org/
Apache License 2.0
448 stars 122 forks source link

Performance of report. #31

Closed surechen closed 4 years ago

surechen commented 4 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] I find that function newSegmentRoot will create a coroutine for every request . At the end of each Segment collection, a message is sent immediately.I'm afraid this will affect performance.

Describe the solution you'd like A clear and concise description of what you want to happen.

I'm wondering if go2sky can implement a collector to collect messages and send them based on time and quantity dimensions, so as to avoid creating a large number of coroutines in high concurrency scenarios.User can set report interval and number of segments.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

wu-sheng commented 4 years ago

Could you point out the codes about this concern?

surechen commented 4 years ago

Could you point out the codes about this concern?

Thanks for your reply. I mean in function call chain CreateEntrySpan->CreateLocalSpan->newSegmentSpan->newSegmentRoot. In func newSegmentRoot :
go func() { total := -1 defer close(ch) defer close(s.doneCh) for { select { case span := <-s.notify: s.segment = append(s.segment, span) case n := <-s.doneCh: total = int(n) } if total == len(s.segment) { break } } s.tracer.reporter.Send(append(s.segment, s)) }() I'm worried about performance. I want a collector to be able to collect segments and send in batches after interval time or reach max count limit, rather than send each message immediately.

wu-sheng commented 4 years ago

I'm worried about performance.

If this reports as a grpc stream, it is safe. SkyWalking javaagent doesn't need any collector, it could work in 5k-10k tps with 10% CPU only. Your concern should base on experiences, and code optimization. In most cases, the collector wouldn't help.

surechen commented 4 years ago

I'm worried about performance.

If this reports as a grpc stream, it is safe. SkyWalking javaagent doesn't need any collector, it could work in 5k-10k tps with 10% CPU only. Your concern should base on experiences, and code optimization. In most cases, the collector wouldn't help.

Thansk for your reply.