Hi Konrad. I don't believe I used that phrase, but thanks for elaborating.
I will digest what you wrote and discuss it.
Any thoughts on having a lifecycle method on Materializer vs
ActorMaterializer?

On Mon, Oct 23, 2017 at 7:39 PM, Konrad “ktoso” Malawski <
[email protected]> wrote:

> Hi Richard,
> Saying that “using Materializer” will cause leaks is somewhat of a weird
> phrasing, since that sounds just like “using ActorSystem can cause leaks” —
> well sure, just like “using objects can cause leaks” :-)
>
> Let’s step back and analyse where your colleague’s statement came from,
> and perhaps how/why the misinterpretation happened.
>
> I see someone really enjoyed Colin’s awesome talk about streams and actors
> there :-)
> // Likely the best talk about those two and how they fit together I’ve
> seen by the way.
> // You may want to read his blog http://blog.colinbreck.
> com/integrating-akka-streams-and-akka-actors-part-ii/
> In his talk he explains the lifecycle differences between creating an
> ActorMaterializer from an ActorSystem,
> vs. creating an ActorMaterializer from an ActorContext. Note that both are
> possible, since they are both ActorRefFactories.
>
> The ActorMaterializer’s lifecycle is bound to the ActorRefFactory that it
> was created from.
>
> In other words:
> 1) ActorMaterializer created from ActorSystem
>   - will terminate all its streams if the ActorSystem terminates
> 2) ActorMaterializer created from ActorContext
>   - will terminate all its streams if THAT actor terminates
>
> It’s not that one is a leak and the other one isn’t.
> It’s that the 1st case is good for long lived streams, and such that
> should out-live an Actor if it was started in one.
> Say, this is good for persistence query, or akka http, or some shared
> stream many other parts of your system rely on.
> The 2nd case is a good choice if the stream and actor are inherently
> related to one another - say, the stream relates to some “user”, and the
> actor that started that stream is also “the user”, so if the actor dies we
> should also kill the stream.
>
> Hope this clarifies things.
>
> I also submitted a documentation improvement about it right now, so please
> see here:
> https://github.com/akka/akka/pull/23836
>
> --
> Cheers,
> Konrad 'ktoso <http://kto.so>' Malawski
> Akka <http://akka.io/> @ Lightbend <http://lightbend.com/>
>
> On October 24, 2017 at 8:04:10, Richard Rodseth ([email protected])
> wrote:
>
> I just heard from someone who attended a talk at Reactive Summit that you
> can leak resources if you are restarting a stream within a host actor, and
> not shutting down the materializer.
>
> I've written most of the stream creation logic and messages using
> Materializer, not ActorMaterializer, and I see that the shutdown method is
> only on ActorMaterializer.
>
> Easy enough to change my types, but I was curious if this was a considered
> decision.
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/
> current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to