From 60d918c490d81712d317b7b5a9ab01ffe85d7e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Andr=C3=A9n?= Date: Wed, 15 Mar 2017 09:15:18 +0100 Subject: [PATCH] Deprecate auto-fusing setting #22431 --- akka-docs/rst/java/stream/stream-composition.rst | 2 +- akka-docs/rst/java/stream/stream-flows-and-basics.rst | 2 +- akka-docs/rst/project/migration-guide-2.4.x-2.5.x.rst | 9 +++++++++ akka-docs/rst/scala/stream/stream-flows-and-basics.rst | 2 ++ akka-stream/src/main/resources/reference.conf | 1 + .../src/main/scala/akka/stream/ActorMaterializer.scala | 1 + .../akka/stream/impl/PhasedFusingActorMaterializer.scala | 4 ++++ 7 files changed, 19 insertions(+), 2 deletions(-) diff --git a/akka-docs/rst/java/stream/stream-composition.rst b/akka-docs/rst/java/stream/stream-composition.rst index d0309706b4..6afacf27b8 100644 --- a/akka-docs/rst/java/stream/stream-composition.rst +++ b/akka-docs/rst/java/stream/stream-composition.rst @@ -283,7 +283,7 @@ the :class:`CompletionStage` part, and wraps the other two values in a cus .. note:: The nested structure in the above example is not necessary for combining the materialized values, it just - demonstrates how the two features work together. See :ref:`flow-combine-mat-java` for further examples + demonstrates how the two features work together. See :ref:`operator-fusion-java` for further examples of combining materialized values without nesting and hierarchy involved. Attributes diff --git a/akka-docs/rst/java/stream/stream-flows-and-basics.rst b/akka-docs/rst/java/stream/stream-flows-and-basics.rst index eccb782e0d..0f17291a1a 100644 --- a/akka-docs/rst/java/stream/stream-flows-and-basics.rst +++ b/akka-docs/rst/java/stream/stream-flows-and-basics.rst @@ -222,7 +222,7 @@ which will be running on the thread pools they have been configured to run on - Reusing *instances* of linear computation stages (Source, Sink, Flow) inside composite Graphs is legal, yet will materialize that stage multiple times. -.. _flow-combine-mat-java: +.. _operator-fusion-java: Operator Fusion --------------- diff --git a/akka-docs/rst/project/migration-guide-2.4.x-2.5.x.rst b/akka-docs/rst/project/migration-guide-2.4.x-2.5.x.rst index 25cf629058..a600d36af7 100644 --- a/akka-docs/rst/project/migration-guide-2.4.x-2.5.x.rst +++ b/akka-docs/rst/project/migration-guide-2.4.x-2.5.x.rst @@ -316,6 +316,15 @@ In 2.4 an explicit `async` marker (``AsyncBoundary`` attribute) had to be added. defined ``blocking-io-dispatcher`` as default followed by a ``map`` will now be separated by an async boundary, which was not the case in 2.4. +Removal of the auto-fuse setting +-------------------------------- + +In 2.4 fusing stages together into the same actor could be completely disabled with the setting +``akka.stream.materializer.auto-fusing``. The new materializer introduced in Akka 2.5 does not support disabling fusing, +so this setting does not have any effect any more and has been deprecated. Running each stage in a stream on a separate +actor can be done by adding explicit async boundaries around every stage. How to add asynchronous boundaries can be seen +in :ref:`operator-fusion-java` (Java) and :ref:`operator-fusion-scala` (Scala). + Remote ====== diff --git a/akka-docs/rst/scala/stream/stream-flows-and-basics.rst b/akka-docs/rst/scala/stream/stream-flows-and-basics.rst index 581a0c3280..7b70cfc1d8 100644 --- a/akka-docs/rst/scala/stream/stream-flows-and-basics.rst +++ b/akka-docs/rst/scala/stream/stream-flows-and-basics.rst @@ -226,6 +226,8 @@ which will be running on the thread pools they have been configured to run on - Reusing *instances* of linear computation stages (Source, Sink, Flow) inside composite Graphs is legal, yet will materialize that stage multiple times. +.. _operator-fusion-scala: + Operator Fusion --------------- diff --git a/akka-stream/src/main/resources/reference.conf b/akka-stream/src/main/resources/reference.conf index 9c6696c35a..896ead6861 100644 --- a/akka-stream/src/main/resources/reference.conf +++ b/akka-stream/src/main/resources/reference.conf @@ -44,6 +44,7 @@ akka { # Enable automatic fusing of all graphs that are run. For short-lived streams # this may cause an initial runtime overhead, but most of the time fusing is # desirable since it reduces the number of Actors that are created. + # Deprecated, since Akka 2.5.0, setting does not have any effect. auto-fusing = on # Those stream elements which have explicit buffers (like mapAsync, mapAsyncUnordered, diff --git a/akka-stream/src/main/scala/akka/stream/ActorMaterializer.scala b/akka-stream/src/main/scala/akka/stream/ActorMaterializer.scala index b851c2145d..0c8d82e27e 100644 --- a/akka-stream/src/main/scala/akka/stream/ActorMaterializer.scala +++ b/akka-stream/src/main/scala/akka/stream/ActorMaterializer.scala @@ -433,6 +433,7 @@ final class ActorMaterializerSettings private ( * this may cause an initial runtime overhead, but most of the time fusing is * desirable since it reduces the number of Actors that are created. */ + @deprecated(since = "2.5.0", message = "Turning off fusing is no longer possible with the traversal based materializer") def withAutoFusing(enable: Boolean): ActorMaterializerSettings = if (enable == this.autoFusing) this else copy(autoFusing = enable) diff --git a/akka-stream/src/main/scala/akka/stream/impl/PhasedFusingActorMaterializer.scala b/akka-stream/src/main/scala/akka/stream/impl/PhasedFusingActorMaterializer.scala index ee4ce738c7..bb9e1dbe81 100644 --- a/akka-stream/src/main/scala/akka/stream/impl/PhasedFusingActorMaterializer.scala +++ b/akka-stream/src/main/scala/akka/stream/impl/PhasedFusingActorMaterializer.scala @@ -347,6 +347,10 @@ case class PhasedFusingActorMaterializer( _logger.warning("Fuzzing mode is enabled on this system. If you see this warning on your production system then " + "set akka.stream.materializer.debug.fuzzing-mode to off.") } + if (!settings.autoFusing) { + _logger.warning("Deprecated setting auto-fusing set to false. Since Akka 2.5.0 it does not have any effect " + + "and streams are always fused.") + } override def shutdown(): Unit = if (haveShutDown.compareAndSet(false, true)) supervisor ! PoisonPill