You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Martin Chan Shu Ching (JIRA)" <ji...@apache.org> on 2012/07/17 04:52:33 UTC

[jira] [Created] (AMQ-3933) TransportConnection.dispatchQueue synchronized LinkedList to ConcurrentLinkedQueue

Martin Chan Shu Ching created AMQ-3933:
------------------------------------------

             Summary: TransportConnection.dispatchQueue synchronized LinkedList to ConcurrentLinkedQueue
                 Key: AMQ-3933
                 URL: https://issues.apache.org/jira/browse/AMQ-3933
             Project: ActiveMQ
          Issue Type: Improvement
    Affects Versions: 5.6.0
         Environment: Linux 
            Reporter: Martin Chan Shu Ching
            Priority: Minor


TransportConnection.dispatchQueue currently uses a synchronized LinkedList to pass all objects between the broker and the transport connection to the client. This isn't very efficient as the whole list is locked whenever an item is added or removed. ConcurrentLinkedQueue is about 20% faster in my tests.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (AMQ-3933) TransportConnection.dispatchQueue synchronized LinkedList to ConcurrentLinkedQueue

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13416172#comment-13416172 ] 

Gary Tully commented on AMQ-3933:
---------------------------------

can you attach your test or describe the nature of it?
                
> TransportConnection.dispatchQueue synchronized LinkedList to ConcurrentLinkedQueue
> ----------------------------------------------------------------------------------
>
>                 Key: AMQ-3933
>                 URL: https://issues.apache.org/jira/browse/AMQ-3933
>             Project: ActiveMQ
>          Issue Type: Improvement
>    Affects Versions: 5.6.0
>         Environment: Linux 
>            Reporter: Martin Chan Shu Ching
>            Priority: Minor
>              Labels: newbie
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> TransportConnection.dispatchQueue currently uses a synchronized LinkedList to pass all objects between the broker and the transport connection to the client. This isn't very efficient as the whole list is locked whenever an item is added or removed. ConcurrentLinkedQueue is about 20% faster in my tests.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (AMQ-3933) TransportConnection.dispatchQueue synchronized LinkedList to ConcurrentLinkedQueue

Posted by "Martin Chan Shu Ching (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13416972#comment-13416972 ] 

Martin Chan Shu Ching commented on AMQ-3933:
--------------------------------------------

My test attached. Basically what you need to do are:
1. change the LinkedList with ConcurrentLinkedQueue for dispatchQueue
2. remove all synchronized block embracing the dispatchQueue
3. change dispatchQueue.add() with dispatchQueue.offer()
4. change dispatchQueue.remove(0) with dispatchQueue.poll()

Since i made my change in 5.3.1 source so I am not uploading the change because the same change should probably be done in the head.
Attached is a simple test program which creates 1000 consumers and publishes 5000 message, if all consumers receives all messages then the change is safe. We have deployed to a production environment without issue.

                
> TransportConnection.dispatchQueue synchronized LinkedList to ConcurrentLinkedQueue
> ----------------------------------------------------------------------------------
>
>                 Key: AMQ-3933
>                 URL: https://issues.apache.org/jira/browse/AMQ-3933
>             Project: ActiveMQ
>          Issue Type: Improvement
>    Affects Versions: 5.6.0
>         Environment: Linux 
>            Reporter: Martin Chan Shu Ching
>            Priority: Minor
>              Labels: newbie
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> TransportConnection.dispatchQueue currently uses a synchronized LinkedList to pass all objects between the broker and the transport connection to the client. This isn't very efficient as the whole list is locked whenever an item is added or removed. ConcurrentLinkedQueue is about 20% faster in my tests.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AMQ-3933) TransportConnection.dispatchQueue synchronized LinkedList to ConcurrentLinkedQueue

Posted by "Martin Chan Shu Ching (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3933?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Chan Shu Ching updated AMQ-3933:
---------------------------------------

    Attachment: TestQueue.java
    
> TransportConnection.dispatchQueue synchronized LinkedList to ConcurrentLinkedQueue
> ----------------------------------------------------------------------------------
>
>                 Key: AMQ-3933
>                 URL: https://issues.apache.org/jira/browse/AMQ-3933
>             Project: ActiveMQ
>          Issue Type: Improvement
>    Affects Versions: 5.6.0
>         Environment: Linux 
>            Reporter: Martin Chan Shu Ching
>            Priority: Minor
>              Labels: newbie
>         Attachments: TestQueue.java
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> TransportConnection.dispatchQueue currently uses a synchronized LinkedList to pass all objects between the broker and the transport connection to the client. This isn't very efficient as the whole list is locked whenever an item is added or removed. ConcurrentLinkedQueue is about 20% faster in my tests.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (AMQ-3933) TransportConnection.dispatchQueue synchronized LinkedList to ConcurrentLinkedQueue

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3933?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish closed AMQ-3933.
-----------------------------

    Resolution: Won't Fix
    
> TransportConnection.dispatchQueue synchronized LinkedList to ConcurrentLinkedQueue
> ----------------------------------------------------------------------------------
>
>                 Key: AMQ-3933
>                 URL: https://issues.apache.org/jira/browse/AMQ-3933
>             Project: ActiveMQ
>          Issue Type: Improvement
>    Affects Versions: 5.6.0
>         Environment: Linux 
>            Reporter: Martin Chan Shu Ching
>            Priority: Minor
>              Labels: newbie
>         Attachments: TestQueue.java, TransportConnectionTest.java
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> TransportConnection.dispatchQueue currently uses a synchronized LinkedList to pass all objects between the broker and the transport connection to the client. This isn't very efficient as the whole list is locked whenever an item is added or removed. ConcurrentLinkedQueue is about 20% faster in my tests.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AMQ-3933) TransportConnection.dispatchQueue synchronized LinkedList to ConcurrentLinkedQueue

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3933?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Tully updated AMQ-3933:
----------------------------

    Attachment: TransportConnectionTest.java

I am not finding any proof of an improvement in my junit tests. In fact, for low number of threads the concurrent queue is slower.Can you peek at this simple junit test and see if you can tweek it to demonstrate what you saw.
                
> TransportConnection.dispatchQueue synchronized LinkedList to ConcurrentLinkedQueue
> ----------------------------------------------------------------------------------
>
>                 Key: AMQ-3933
>                 URL: https://issues.apache.org/jira/browse/AMQ-3933
>             Project: ActiveMQ
>          Issue Type: Improvement
>    Affects Versions: 5.6.0
>         Environment: Linux 
>            Reporter: Martin Chan Shu Ching
>            Priority: Minor
>              Labels: newbie
>         Attachments: TestQueue.java, TransportConnectionTest.java
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> TransportConnection.dispatchQueue currently uses a synchronized LinkedList to pass all objects between the broker and the transport connection to the client. This isn't very efficient as the whole list is locked whenever an item is added or removed. ConcurrentLinkedQueue is about 20% faster in my tests.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (AMQ-3933) TransportConnection.dispatchQueue synchronized LinkedList to ConcurrentLinkedQueue

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3933?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13423932#comment-13423932 ] 

Timothy Bish commented on AMQ-3933:
-----------------------------------

>From reviewing the code and looking at what some of the sync points are I don't think even with the ConcurrentLinkedQueue you can remove all the syncronization as it servers to control orderly shutdown as well.  It doesn't really appear that making this change would result in much improvement once you account for the shutdown cases.  
                
> TransportConnection.dispatchQueue synchronized LinkedList to ConcurrentLinkedQueue
> ----------------------------------------------------------------------------------
>
>                 Key: AMQ-3933
>                 URL: https://issues.apache.org/jira/browse/AMQ-3933
>             Project: ActiveMQ
>          Issue Type: Improvement
>    Affects Versions: 5.6.0
>         Environment: Linux 
>            Reporter: Martin Chan Shu Ching
>            Priority: Minor
>              Labels: newbie
>         Attachments: TestQueue.java, TransportConnectionTest.java
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> TransportConnection.dispatchQueue currently uses a synchronized LinkedList to pass all objects between the broker and the transport connection to the client. This isn't very efficient as the whole list is locked whenever an item is added or removed. ConcurrentLinkedQueue is about 20% faster in my tests.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira