You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/02/01 14:26:05 UTC
[GitHub] [skywalking] kezhenxu94 opened a new pull request #4305:
Performance tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
kezhenxu94 opened a new pull request #4305: Performance tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
URL: https://github.com/apache/skywalking/pull/4305
### Motivation:
Reduce unnecessary memory allocation in frequently used class.
### Modifications:
Replace the `AtomicInteger` with `AtomicIntegerFieldUpdater`
### Result:
We can save 4 bytes (for the reference to `AtomicInteger` itself) for each `TracingContext`, which saves credible memory in a high-concurrent agent service.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] wu-sheng merged pull request #4305: Performance
tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
Posted by GitBox <gi...@apache.org>.
wu-sheng merged pull request #4305: Performance tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
URL: https://github.com/apache/skywalking/pull/4305
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] kezhenxu94 commented on issue #4305: Performance
tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on issue #4305: Performance tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
URL: https://github.com/apache/skywalking/pull/4305#issuecomment-581040183
> @kezhenxu94 I think you miss an important factor, in the `AtomicIntegerFieldUpdaterImpl`, it is using the refactor, which causes more CPU. This is a memory-CPU tradeoff, I am not sure this is the performance tuning. In my mind, in today's production env, CPU is more valuable than the memory.
>
> Especially, CPU is affecting latency, response time and throughput more.
@wu-sheng as you can see, the updater is `static` and is only instantiated once, and reflection is only use in the instantiation to find the field offset, so the CPU cost is an one-time cost
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] wu-sheng commented on issue #4305: Performance tuning:
replace AtomicInteger with AtomicIntegerFieldUpdater
Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #4305: Performance tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
URL: https://github.com/apache/skywalking/pull/4305#issuecomment-581039671
@kezhenxu94 I think you miss an important factor, in the `AtomicIntegerFieldUpdaterImpl`, it is using the refactor, which causes more CPU. This is a memory-CPU tradeoff, I am not sure this is the performance tuning. In my mind, in today's production env, CPU is more valuable than the memory.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] kezhenxu94 edited a comment on issue #4305:
Performance tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
Posted by GitBox <gi...@apache.org>.
kezhenxu94 edited a comment on issue #4305: Performance tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
URL: https://github.com/apache/skywalking/pull/4305#issuecomment-581035208
If you're interested in the theory and benchmark, please refer to http://normanmaurer.me/blog/2013/10/28/Lesser-known-concurrent-classes-Part-1/ and the counterpart Chinese version is here: https://kezhenxu94.github.io/2020/01/30/Concurrent-classes-AtomicFieldUpdater/
I've also checked other classes using `Atomic*` and they are left AS IS because they are not concurrency-sensitive
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] kezhenxu94 edited a comment on issue #4305:
Performance tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
Posted by GitBox <gi...@apache.org>.
kezhenxu94 edited a comment on issue #4305: Performance tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
URL: https://github.com/apache/skywalking/pull/4305#issuecomment-581035208
If you're interested in the theory and benchmark, please refer to http://normanmaurer.me/blog/2013/10/28/Lesser-known-concurrent-classes-Part-1/ and the counterpart Chinese version is here: https://kezhenxu94.github.io/2020/01/30/Concurrent-classes-AtomicFieldUpdater/
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] codecov-io commented on issue #4305: Performance
tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #4305: Performance tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
URL: https://github.com/apache/skywalking/pull/4305#issuecomment-581038922
# [Codecov](https://codecov.io/gh/apache/skywalking/pull/4305?src=pr&el=h1) Report
> Merging [#4305](https://codecov.io/gh/apache/skywalking/pull/4305?src=pr&el=desc) into [master](https://codecov.io/gh/apache/skywalking/commit/5c6914fc9eea78eb7285976060690e1a1a80010f?src=pr&el=desc) will **increase** coverage by `0.11%`.
> The diff coverage is `61.53%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/skywalking/pull/4305/graphs/tree.svg?width=650&token=qrILxY5yA8&height=150&src=pr)](https://codecov.io/gh/apache/skywalking/pull/4305?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #4305 +/- ##
==========================================
+ Coverage 26.72% 26.83% +0.11%
==========================================
Files 1170 1170
Lines 25579 25577 -2
Branches 3655 3655
==========================================
+ Hits 6835 6863 +28
+ Misses 18133 18104 -29
+ Partials 611 610 -1
```
| [Impacted Files](https://codecov.io/gh/apache/skywalking/pull/4305?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...walking/apm/agent/core/context/TracingContext.java](https://codecov.io/gh/apache/skywalking/pull/4305/diff?src=pr&el=tree#diff-YXBtLXNuaWZmZXIvYXBtLWFnZW50LWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NreXdhbGtpbmcvYXBtL2FnZW50L2NvcmUvY29udGV4dC9UcmFjaW5nQ29udGV4dC5qYXZh) | `61.43% <61.53%> (+0.54%)` | :arrow_up: |
| [...m/agent/core/remote/TraceSegmentServiceClient.java](https://codecov.io/gh/apache/skywalking/pull/4305/diff?src=pr&el=tree#diff-YXBtLXNuaWZmZXIvYXBtLWFnZW50LWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NreXdhbGtpbmcvYXBtL2FnZW50L2NvcmUvcmVtb3RlL1RyYWNlU2VnbWVudFNlcnZpY2VDbGllbnQuamF2YQ==) | `82.35% <0%> (+1.47%)` | :arrow_up: |
| [.../core/remote/ServiceAndEndpointRegisterClient.java](https://codecov.io/gh/apache/skywalking/pull/4305/diff?src=pr&el=tree#diff-YXBtLXNuaWZmZXIvYXBtLWFnZW50LWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NreXdhbGtpbmcvYXBtL2FnZW50L2NvcmUvcmVtb3RlL1NlcnZpY2VBbmRFbmRwb2ludFJlZ2lzdGVyQ2xpZW50LmphdmE=) | `31.46% <0%> (+3.37%)` | :arrow_up: |
| [.../agent/core/profile/ProfileTaskChannelService.java](https://codecov.io/gh/apache/skywalking/pull/4305/diff?src=pr&el=tree#diff-YXBtLXNuaWZmZXIvYXBtLWFnZW50LWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NreXdhbGtpbmcvYXBtL2FnZW50L2NvcmUvcHJvZmlsZS9Qcm9maWxlVGFza0NoYW5uZWxTZXJ2aWNlLmphdmE=) | `36.78% <0%> (+8.04%)` | :arrow_up: |
| [...alking/apm/agent/core/remote/AgentIDDecorator.java](https://codecov.io/gh/apache/skywalking/pull/4305/diff?src=pr&el=tree#diff-YXBtLXNuaWZmZXIvYXBtLWFnZW50LWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NreXdhbGtpbmcvYXBtL2FnZW50L2NvcmUvcmVtb3RlL0FnZW50SUREZWNvcmF0b3IuamF2YQ==) | `85.71% <0%> (+17.85%)` | :arrow_up: |
| [...ache/skywalking/apm/agent/core/jvm/JVMService.java](https://codecov.io/gh/apache/skywalking/pull/4305/diff?src=pr&el=tree#diff-YXBtLXNuaWZmZXIvYXBtLWFnZW50LWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NreXdhbGtpbmcvYXBtL2FnZW50L2NvcmUvanZtL0pWTVNlcnZpY2UuamF2YQ==) | `77.04% <0%> (+19.67%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/skywalking/pull/4305?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/skywalking/pull/4305?src=pr&el=footer). Last update [5c6914f...0a36c10](https://codecov.io/gh/apache/skywalking/pull/4305?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] wu-sheng edited a comment on issue #4305: Performance
tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
Posted by GitBox <gi...@apache.org>.
wu-sheng edited a comment on issue #4305: Performance tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
URL: https://github.com/apache/skywalking/pull/4305#issuecomment-581039671
@kezhenxu94 I think you miss an important factor, in the `AtomicIntegerFieldUpdaterImpl`, it is using the refactor, which causes more CPU. This is a memory-CPU tradeoff, I am not sure this is the performance tuning. In my mind, in today's production env, CPU is more valuable than the memory.
Especially, CPU is affecting latency, response time and throughput more.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [skywalking] kezhenxu94 commented on issue #4305: Performance
tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
Posted by GitBox <gi...@apache.org>.
kezhenxu94 commented on issue #4305: Performance tuning: replace AtomicInteger with AtomicIntegerFieldUpdater
URL: https://github.com/apache/skywalking/pull/4305#issuecomment-581035208
If you're interested in the theory and experiment, please refer to http://normanmaurer.me/blog/2013/10/28/Lesser-known-concurrent-classes-Part-1/ and the counterpart Chinese version is here: https://kezhenxu94.github.io/2020/01/30/Concurrent-classes-AtomicFieldUpdater/
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services