elastic / elastic/logstash

Experiment with LongAdder

Open
#4,508 0 comments 0 reactions 0 assignees View on GitHub
monitoring v5.5.0
Dominant language
Java
Stars
14.9k
Forks
3.5k
Avg merge
19h 14m
Merged PRs (30d)
63

Description

The current implementation of the `Counter` in the metrics use the `concurrent-ruby` `AtomicFixnum` class for managing the counter (docs https://github.com/ruby-concurrency/concurrent-ruby/blob/master/lib/concurrent/atomic/atomic_fixnum.rb). The java implementation of this code uses Java's `AtomicLong`.

This class gives OK performance, but since multiples thread can change the counter it might be a good idea to investigate if replacing the code with a `LongAdder` would actually yield benefits.

See:
- http://blog.palominolabs.com/2014/02/10/java-8-performance-improvements-longadder-vs-atomiclong/
- https://minddotout.wordpress.com/2013/05/11/java-8-concurrency-longadder/

Java 8 comes with but Java 7 doesn't, but an implementation exist for java 7, ES actually use it and its also present in `concurrent-ruby` code https://github.com/ruby-concurrency/concurrent-ruby/blob/master/ext/com/concurrent_ruby/ext/jsr166e/LongAdder.java

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.