[ 
https://issues.apache.org/jira/browse/ARTEMIS-3618?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Francesco Nigro updated ARTEMIS-3618:
-------------------------------------
    Description: 
Currently {{ClientConsumerImpl}}, responsible of calling JMS 
{{MessageListener::onMessage}}, is installing/restoring the listener thread's 
context ClassLoader by using a secured action regardless any security manager 
is installed.
This secured action (using {{AccessController::doPrivileged}}) is very 
heavyweight and can often be as costy (or more) then the user/application code 
handling the received message (see 
https://bugs.openjdk.java.net/browse/JDK-8062162 for more info).

The {{SecurityManager}} will be removed in the future (see 
https://openjdk.java.net/jeps/411) but until that moment would be nice to 
reduce such cost at least if no {{SecurityManager}} is installed.


This is a flamegraph showing the listener stack trace:
 !noSecurityManager.png! 

As the image shows, in violet, here's the cost of 
{{AccessController::doPrivileged}} is no {{SecurityManager}} is installed ie 14 
samples
- handling the message costs 3 samples
- acknowledge it costs 19 samples

TLDR {{AccessController::doPrivileged}} cost ~5 times handling the message and 
nearly the same as acking back it

  was:
Currently {{ClientConsumerImpl}}, responsible of calling JMS 
{{MessageListener::onMessage}}, is installing/restoring the listener thread's 
context ClassLoader by using a secured action regardless any security manager 
is installed.
This secured action (using {{AccessController::doPrivileged}}) is very 
heavyweight and can often be as costy as the user/application code handling the 
received message (see https://bugs.openjdk.java.net/browse/JDK-8062162 for more 
info).

The {{SecurityManager}} will be removed in the future (see 
https://openjdk.java.net/jeps/411) but until that moment would be nice to 
reduce such cost at least if no {{SecurityManager}} is installed.


> Faster Artemis CORE client MessageListener::onMessage without SecurityManager
> -----------------------------------------------------------------------------
>
>                 Key: ARTEMIS-3618
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3618
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>            Reporter: Francesco Nigro
>            Assignee: Francesco Nigro
>            Priority: Major
>         Attachments: noSecurityManager.png
>
>
> Currently {{ClientConsumerImpl}}, responsible of calling JMS 
> {{MessageListener::onMessage}}, is installing/restoring the listener thread's 
> context ClassLoader by using a secured action regardless any security manager 
> is installed.
> This secured action (using {{AccessController::doPrivileged}}) is very 
> heavyweight and can often be as costy (or more) then the user/application 
> code handling the received message (see 
> https://bugs.openjdk.java.net/browse/JDK-8062162 for more info).
> The {{SecurityManager}} will be removed in the future (see 
> https://openjdk.java.net/jeps/411) but until that moment would be nice to 
> reduce such cost at least if no {{SecurityManager}} is installed.
> This is a flamegraph showing the listener stack trace:
>  !noSecurityManager.png! 
> As the image shows, in violet, here's the cost of 
> {{AccessController::doPrivileged}} is no {{SecurityManager}} is installed ie 
> 14 samples
> - handling the message costs 3 samples
> - acknowledge it costs 19 samples
> TLDR {{AccessController::doPrivileged}} cost ~5 times handling the message 
> and nearly the same as acking back it



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to