You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "pjfanning (via GitHub)" <gi...@apache.org> on 2024/09/17 13:22:58 UTC
[PR] mark stop() method as noinline [pekko]
pjfanning opened a new pull request, #1485:
URL: https://github.com/apache/pekko/pull/1485
relates to #1484
I have similar issues in https://github.com/pjfanning/micrometer-pekko and this change fixes the broken test I ran into there when upgrading to Pekko 1.1.
More changes will be needed for Kamon but I'm raising this to show a path forward and to see if this acceptable for Pekko 1.1.2. We can add more changes in more PRs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] mark stop() method as noinline [pekko]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on PR #1485:
URL: https://github.com/apache/pekko/pull/1485#issuecomment-2363584447
> It would be good to document these unwritten compatibility constraints. In Akka, we used `@InternalStableApi` but any kind of simple documentation will help to later understand the reasoning behind adding something like `@noinline` (which otherwise is very uncommon in Scala and has potential performance impacts in the future).
@jrudolph I've summarised the situation in intro to https://github.com/apache/pekko/discussions/1487 and the aim of that discussion is to discuss how we can remove the `@noinline` annotations at some point in the future.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] mark stop() method as noinline [pekko]
Posted by "Roiocam (via GitHub)" <gi...@apache.org>.
Roiocam commented on code in PR #1485:
URL: https://github.com/apache/pekko/pull/1485#discussion_r1764275206
##########
actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala:
##########
@@ -159,7 +159,7 @@ private[pekko] trait Dispatch { this: ActorCell =>
catch handleException
// ➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
- final def stop(): Unit =
+ @noinline final def stop(): Unit =
Review Comment:
I wonder why this method has been inline. Does us toggle something on? If does, for those method like `start`, `resume`, `suspend` shouldn't be inline too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] mark stop() method as noinline [pekko]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on PR #1485:
URL: https://github.com/apache/pekko/pull/1485#issuecomment-2372172692
https://github.com/apache/pekko/pull/1489 was merged - would it be possible for any Pekko PMC members to review this? This change is more useful for micrometer-pekko than Kamon.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] mark stop() method as noinline [pekko]
Posted by "Roiocam (via GitHub)" <gi...@apache.org>.
Roiocam commented on code in PR #1485:
URL: https://github.com/apache/pekko/pull/1485#discussion_r1764789225
##########
actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala:
##########
@@ -159,7 +159,7 @@ private[pekko] trait Dispatch { this: ActorCell =>
catch handleException
// ➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
- final def stop(): Unit =
+ @noinline final def stop(): Unit =
Review Comment:
Thanks for the clarification. @jrudolph
##########
actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala:
##########
@@ -159,7 +159,7 @@ private[pekko] trait Dispatch { this: ActorCell =>
catch handleException
// ➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
- final def stop(): Unit =
+ @noinline final def stop(): Unit =
Review Comment:
I am not sure this PR can be resolve the kamon issue, because [Kamon Instruementation](https://github.com/kamon-io/Kamon/blob/master/instrumentation/kamon-pekko/src/main/scala/kamon/instrumentation/pekko/instrumentations/DispatcherInstrumentation.scala) seem like didn't advise/intercept this method.
the stack trace of the original issue post shows that the `DispatcherPrerequisites` weren't assigned correctly.
Is it probably caused by this inline? https://github.com/apache/pekko/blob/0f1db5301ed87fea39ab331b5bce88022ccb54da/actor/src/main/scala-2.13/org/apache/pekko/compat/PartialFunction.scala#L28-L29
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] mark stop() method as noinline [pekko]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #1485:
URL: https://github.com/apache/pekko/pull/1485#discussion_r1765951565
##########
actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala:
##########
@@ -159,7 +159,7 @@ private[pekko] trait Dispatch { this: ActorCell =>
catch handleException
// ➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
- final def stop(): Unit =
+ @noinline final def stop(): Unit =
Review Comment:
Thanks @Roiocam - there will need to be more changes. This PR is just to show one change and to highlight that the change doesn't break anything (tests or binary compatibility checks).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] mark stop() method as noinline [pekko]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #1485:
URL: https://github.com/apache/pekko/pull/1485#discussion_r1768390246
##########
actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala:
##########
@@ -159,7 +159,7 @@ private[pekko] trait Dispatch { this: ActorCell =>
catch handleException
// ➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
- final def stop(): Unit =
+ @noinline final def stop(): Unit =
Review Comment:
#1489 adds more annotations
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] mark stop() method as noinline [pekko]
Posted by "jrudolph (via GitHub)" <gi...@apache.org>.
jrudolph commented on code in PR #1485:
URL: https://github.com/apache/pekko/pull/1485#discussion_r1764532944
##########
actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala:
##########
@@ -159,7 +159,7 @@ private[pekko] trait Dispatch { this: ActorCell =>
catch handleException
// ➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
- final def stop(): Unit =
+ @noinline final def stop(): Unit =
Review Comment:
The Scala compiler is free to inline method when it is sound. This is the case, when the final receiver of a call can be determined. Whether or not that has any performance impact is always hard to say. In general, the JVM JIT compilation will also do heavy inlining and may in many cases do the same kind of optimizations at runtime. In other cases, like e.g. for higher-order methods, the Scala compiler might be able to generate significantly less code by earlier inlining, which also helps JIT compilations.
That said, the point of adding `@noinline` here is that some telemetry tools like Kamon instrument internal APIs to do their work. This has mainly historic reasons. In the future, it could be better to introduce official hooks for these kinds of use cases, so that it is easier to track what the public telemetry API is instead of relying on keeping some internal APIs stable.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] mark stop() method as noinline [pekko]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning merged PR #1485:
URL: https://github.com/apache/pekko/pull/1485
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] mark stop() method as noinline [pekko]
Posted by "jrudolph (via GitHub)" <gi...@apache.org>.
jrudolph commented on code in PR #1485:
URL: https://github.com/apache/pekko/pull/1485#discussion_r1764532944
##########
actor/src/main/scala/org/apache/pekko/actor/dungeon/Dispatch.scala:
##########
@@ -159,7 +159,7 @@ private[pekko] trait Dispatch { this: ActorCell =>
catch handleException
// ➡➡➡ NEVER SEND THE SAME SYSTEM MESSAGE OBJECT TO TWO ACTORS ⬅⬅⬅
- final def stop(): Unit =
+ @noinline final def stop(): Unit =
Review Comment:
The Scala compiler is free to inline methods when it is sound. This is the case, when the final receiver of a call can be determined. Whether or not that has any performance impact is always hard to say. In general, the JVM JIT compilation will also do heavy inlining and may in many cases do the same kind of optimizations at runtime. In other cases, like e.g. for higher-order methods, the Scala compiler might be able to generate significantly less code by earlier inlining, which also helps JIT compilations.
That said, the point of adding `@noinline` here is that some telemetry tools like Kamon instrument internal APIs to do their work. This has mainly historic reasons. In the future, it could be better to introduce official hooks for these kinds of use cases, so that it is easier to track what the public telemetry API is instead of relying on keeping some internal APIs stable.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [PR] mark stop() method as noinline [pekko]
Posted by "jrudolph (via GitHub)" <gi...@apache.org>.
jrudolph commented on PR #1485:
URL: https://github.com/apache/pekko/pull/1485#issuecomment-2357685812
It would be good to document these unwritten compatibility constraints. In Akka, we used `@InternalStableApi` but any kind of simple documentation will help understand the reasoning behind adding something like `@noinline` later (which otherwise is very uncommon in Scala and has potential performance impacts in the future).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org