You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2018/03/28 05:57:53 UTC

[GitHub] sijie opened a new pull request #1299: [dlog] use Atomic***FieldUpdater and LongAdder if possible

sijie opened a new pull request #1299: [dlog] use Atomic***FieldUpdater and LongAdder if possible
URL: https://github.com/apache/bookkeeper/pull/1299
 
 
   
   
   Descriptions of the changes in this PR:
   
   Atomic**FieldUpdater + volatile provides similar guarantees as Atomic*** but use much fewer memory.
   In dlog, when handling large number of streams, there can be a lot of Atomic*** fields with `LogHandler`, `SegmentWriter` and such.
   Switching using Atomic*** to using Atomic**FieldUpdater + volatile will save a lot of memory. See [details](http://normanmaurer.me/blog/2013/10/28/Lesser-known-concurrent-classes-Part-1/)
   
   LongAdder is less contended across threads, which is more preferable to AtomicLong when multiple threads update a common sum. E.g. SampledMovingAverageRate.
   Switching to use LongAdder if AtomicLong is not needed. See [details](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/LongAdder.html)
   
   Master Issue: #<master-issue-number>
   
   > ---
   > Be sure to do all of the following to help us incorporate your contribution
   > quickly and easily:
   >
   > If this PR is a BookKeeper Proposal (BP):
   >
   > - [ ] Make sure the PR title is formatted like:
   >     `<BP-#>: Description of bookkeeper proposal`
   >     `e.g. BP-1: 64 bits ledger is support`
   > - [ ] Attach the master issue link in the description of this PR.
   > - [ ] Attach the google doc link if the BP is written in Google Doc.
   >
   > Otherwise:
   > 
   > - [ ] Make sure the PR title is formatted like:
   >     `<Issue #>: Description of pull request`
   >     `e.g. Issue 123: Description ...`
   > - [ ] Make sure tests pass via `mvn clean apache-rat:check install spotbugs:check`.
   > - [ ] Replace `<Issue #>` in the title with the actual Issue number.
   > 
   > ---
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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