[jboss-jira] [JBoss JIRA] (JBJCA-1305) Performance degradation using fair semaphores in heavily contended workloads

Tom Jenkinson (JIRA) issues at jboss.org
Tue Dec 8 05:26:00 EST 2015


    [ https://issues.jboss.org/browse/JBJCA-1305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13138248#comment-13138248 ] 

Tom Jenkinson edited comment on JBJCA-1305 at 12/8/15 5:25 AM:
---------------------------------------------------------------

>From https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Semaphore.html: "Generally, semaphores used to control resource access should be initialized as fair, to ensure that no thread is starved out from accessing a resource. When using semaphores for other kinds of synchronization control, the throughput advantages of non-fair ordering often outweigh fairness considerations."

As I understand it this semaphore is for accessing a resource so the guidance from the SDK is that fair would be desirable for that type of work load. However, if there are still use-cases that guard access to resources where none-fair is advantageous, a configurable option may therefore be appropriate.


was (Author: tomjenkinson):
>From https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Semaphore.html: "Generally, semaphores used to control resource access should be initialized as fair, to ensure that no thread is starved out from accessing a resource. When using semaphores for other kinds of synchronization control, the throughput advantages of non-fair ordering often outweigh fairness considerations."

As I understand it this semaphore is for accessing a resource so the guidance from the SDK is that fair would be desirable for that type of work load. However, if there are still use-cases that guard access to resources where none-fair is advantageous, a configurable option may therefore be appropriate. Please can you create a forum thread to discuss this further?

> Performance degradation using fair semaphores in heavily contended workloads
> ----------------------------------------------------------------------------
>
>                 Key: JBJCA-1305
>                 URL: https://issues.jboss.org/browse/JBJCA-1305
>             Project: IronJacamar
>          Issue Type: Enhancement
>          Components: Core
>    Affects Versions: WildFly/IronJacamar 1.3.1.Final
>            Reporter: John O'Hara
>            Assignee: Jesper Pedersen
>
> Under heavy contention, a fair semaphore causes performance degradation for threads trying to acquire a permit from the semaphore.  Changing the semaphore to not fair alleviates the performance degradation under heavy contention.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the jboss-jira mailing list