Low level interpreter tests working without GraphAssembly #22423
This commit is contained in:
parent
44260fe5d3
commit
c028b550f2
26 changed files with 354 additions and 575 deletions
|
|
@ -276,17 +276,6 @@ public class FlowDocTest extends AbstractJavaTest {
|
|||
}
|
||||
|
||||
public void fusingAndAsync() {
|
||||
//#explicit-fusing
|
||||
Flow<Integer, Integer, NotUsed> flow =
|
||||
Flow.of(Integer.class).map(x -> x * 2).filter(x -> x > 500);
|
||||
Graph<FlowShape<Integer, Integer>, NotUsed> fused =
|
||||
akka.stream.Fusing.aggressive(flow);
|
||||
|
||||
Source.fromIterator(() -> Stream.iterate(0, x -> x + 1).iterator())
|
||||
.via(fused)
|
||||
.take(1000);
|
||||
//#explicit-fusing
|
||||
|
||||
//#flow-async
|
||||
Source.range(1, 3)
|
||||
.map(x -> x + 1).async()
|
||||
|
|
|
|||
|
|
@ -227,24 +227,17 @@ which will be running on the thread pools they have been configured to run on -
|
|||
Operator Fusion
|
||||
---------------
|
||||
|
||||
Akka Streams 2.0 contains an initial version of stream operator fusion support. This means that
|
||||
the processing steps of a flow or stream graph can be executed within the same Actor and has three
|
||||
consequences:
|
||||
By default Akka Streams will fuse the stream operators. This means that the processing steps of a flow or
|
||||
stream graph can be executed within the same Actor and has two consequences:
|
||||
|
||||
* starting up a stream may take longer than before due to executing the fusion algorithm
|
||||
* passing elements from one processing stage to the next is a lot faster between fused
|
||||
stages due to avoiding the asynchronous messaging overhead
|
||||
* fused stream processing stages no longer run in parallel to each other, meaning that
|
||||
* fused stream processing stages does not run in parallel to each other, meaning that
|
||||
only up to one CPU core is used for each fused part
|
||||
|
||||
The first point can be countered by pre-fusing and then reusing a stream blueprint as sketched below:
|
||||
|
||||
.. includecode:: ../code/docs/stream/FlowDocTest.java#explicit-fusing
|
||||
|
||||
In order to balance the effects of the second and third bullet points you will have to insert asynchronous
|
||||
boundaries manually into your flows and graphs by way of adding ``Attributes.asyncBoundary`` using the method
|
||||
``async`` on ``Source``, ``Sink`` and ``Flow`` to pieces that shall communicate with the rest of the graph in
|
||||
an asynchronous fashion.
|
||||
To allow for parallel processing you will have to insert asynchronous boundaries manually into your flows and
|
||||
graphs by way of adding ``Attributes.asyncBoundary`` using the method ``async`` on ``Source``, ``Sink`` and ``Flow``
|
||||
to pieces that shall communicate with the rest of the graph in an asynchronous fashion.
|
||||
|
||||
.. includecode:: ../code/docs/stream/FlowDocTest.java#flow-async
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue