-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Improve performance of fork/join by one order of magnitude as measured by ForkJoinBenchmark #8611
Copy link
Copy link
Closed
Labels
Description
Fork/join has a relatively high cost when the life of the fiber is short-lived, as shown by ForkJoinBenchmark.
This ticket is to optimize fork/join so that the benchmark shows roughly a 1 order of magnitude performance, without breaking any tests or altering backward compatibility.
The overall steps involved in solving this problem:
- Profile using Visual VM, YourKit, or JProfiler. Free licenses are available for the latter due to ZIO's status as an open source project.
- Identity leading sources for optimization.
- Optimize, measure, and repeat, starting from step (1).
I have already analyzed this and found there is not a single source of overhead that could improve performance by about 10x. Rather, there are a lot of small things that have to be optimized independently, including:
- The performance of FiberRefs, as well as core operations on FiberRefs involved in fork/join.
- The performance of WeakConcurrentBag, which is used for tracking root fibers.
- The overhead of forking, which involves a message to the mailbox that has its own overhead, and tracking the fiber.
- The overhead of joining, which involves FiberRefs-related machinery and success/error propagation.
- Scheduling overhead.
Reactions are currently unavailable