Git Product home page Git Product logo

Comments (7)

minborg avatar minborg commented on July 25, 2024

Preliminary investigations show that the following benefits can be obtained with the proposed solution:

Throughput

More than a 10% performance increase in the EventLoop. (handlers/s invoked)

image

Latency Percentiles

About 7% latency reduction at six nines (us)

image

Average Latency

About 4% reduction of the average latency (ns)

image

Potential Drawbacks

IsolatedEventLoop would be less favorable in cases where handlers are added and removed relatively often or in cases with a large number of handlers with mixed priority.
If we add a method runOnce(), the drawback of adding and removing short-lived handlers could be mitigated.

Test setup:

Property Value
Pauser Busy
OS Mac OS, Catalina 10.15.4
RAM 64 GB
CPU 2.3 GHz 8 core i9
Java 1.8.0_191
   
Priority 2 High, 6 Medium
returns true except on average 128:th time
Other threads Poke the wound: EventLoop::toString each ms
Benchmark 10s with 1 warmup and 3 measure rounds, compute compound result from the 3 measure rounds
   
Cases  
Throughput counter++
Histogram duration -> Histogram::sampleNanos
Latency duration -> array[i]++
   
Summary  
Throughput >10% improvement
Histogram 6 9s 7% improvement @ 10% higher load
Average latency 4% improvement @ 10% higher load

from chronicle-threads.

peter-lawrey avatar peter-lawrey commented on July 25, 2024

The most common case is a small number of medium handlers
The performance of these can be improved by loop unrolling for this use case.

from chronicle-threads.

minborg avatar minborg commented on July 25, 2024

The improved VanillaEventLoop (85ebc2e) compared with only 4 medium handlers stacks up like this compared to IsolatedVanillaLoop:

  Vanilla Isolated
Throughput events/s 172578247.7 187162429.1
Latency (us) @99.99% 0.18 0.18
Mean latency (ns) 16.491 15.500

image

from chronicle-threads.

JerryShea avatar JerryShea commented on July 25, 2024

There is also MediumEventLoop which Peter introduced in December. We should apply optimisations to this too or else get rid of it.

@peter-k-lawrey did you mean for EventGroup to use it like this?

        core = priorities.stream().anyMatch(VanillaEventLoop.ALLOWED_PRIORITIES::contains)
                ? corePriorities.equals(EnumSet.of(HandlerPriority.MEDIUM))
                ? new MediumEventLoop(this, name + "medium-event-loop", pauser, daemon, binding)
                : new VanillaEventLoop(this, name + "core-event-loop", pauser, 1, daemon, binding, priorities)
                : null;

from chronicle-threads.

JerryShea avatar JerryShea commented on July 25, 2024

@peter-k-lawrey I've made the change above

from chronicle-threads.

RobAustin avatar RobAustin commented on July 25, 2024

@JerryShea and @minborg - I assume that this can now be closed, please reopen if you feel there is more to do.

from chronicle-threads.

hft-team-city avatar hft-team-city commented on July 25, 2024

Released in Chronicle-Threads-2.20.102, BOM-2.20.173

from chronicle-threads.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.