[
https://issues.apache.org/jira/browse/ARTEMIS-3618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17462644#comment-17462644
]
Francesco Nigro commented on ARTEMIS-3618:
------------------------------------------
With the fix applied any cost related the secured action just disappear
> 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
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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|width=920,height=398!
> 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)