New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize AgentByteBoundedQueue to avoid excessive latency in concurrent scenarios #282
Optimize AgentByteBoundedQueue to avoid excessive latency in concurrent scenarios #282
Conversation
My test method:
Here are the compression test data before optimization:
Here are the optimized compression test data
K6 is used for the pressure test tool, and the following is the pressure test script
|
Thanks for your contribution. Nice job.
|
|
report/src/main/java/com/megaease/easeagent/report/async/zipkin/AgentByteBoundedQueue.java
Outdated
Show resolved
Hide resolved
To make sure the functionality of this class is fully migrated, I hope you can add unit tests |
OK,I'll deal with the atomicity problem, and then add a single test before submitting. |
@observeralone It has been processed, please look at the |
report/src/main/java/com/megaease/easeagent/report/async/zipkin/AgentByteBoundedQueue.java
Show resolved
Hide resolved
report/src/main/java/com/megaease/easeagent/report/async/zipkin/AgentByteBoundedQueue.java
Show resolved
Hide resolved
report/src/main/java/com/megaease/easeagent/report/async/zipkin/AgentByteBoundedQueue.java
Outdated
Show resolved
Hide resolved
report/src/test/java/com/megaease/easeagent/report/async/zipkin/AgentByteBoundedQueueTest.java
Outdated
Show resolved
Hide resolved
report/src/test/java/com/megaease/easeagent/report/async/zipkin/AgentByteBoundedQueueTest.java
Outdated
Show resolved
Hide resolved
report/src/test/java/com/megaease/easeagent/report/async/zipkin/AgentByteBoundedQueueTest.java
Show resolved
Hide resolved
…e of multi-state by the way of atomic variables.
…the data and subtract according to the size of the data.
report/src/main/java/com/megaease/easeagent/report/async/zipkin/AgentByteBoundedQueue.java
Outdated
Show resolved
Hide resolved
report/src/main/java/com/megaease/easeagent/report/async/zipkin/AgentByteBoundedQueue.java
Show resolved
Hide resolved
report/src/main/java/com/megaease/easeagent/report/async/zipkin/AgentByteBoundedQueue.java
Outdated
Show resolved
Hide resolved
Overall, this is a good optimization. |
2. Optimize the logic of doDrain to avoid calling size methods
… acquisition to write to death directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for your contribution.
We found that the difference in latency between using and not using the easeagent was relatively large, as observed by the flame chart, and finally located that the reason was because com.megaease.easeagent.report.async.zipkin.AgentByteBoundedQueue# offer method, it will call the ReentrantLock#lock method at the entry point, and it will get stuck here in a high concurrency scenario.
I've seen others on github who have encountered the same problem: openzipkin/zipkin-reporter-java#101