incubator-giraph-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claudio Martella (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GIRAPH-185) Improve concurrency of putMsg / putMsgList
Date Mon, 23 Apr 2012 16:41:36 GMT

    [ https://issues.apache.org/jira/browse/GIRAPH-185?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13259704#comment-13259704
] 

Claudio Martella commented on GIRAPH-185:
-----------------------------------------

I agree with Avery. Last time I modified this code, I populated the transientInMessages datastructure
so that it contained lists only for vertices that were receiving messages.
You could do this by using a ConcurrentHashMap and by using the putIfAbsent() method.

public void add(Object key, Object val) {
    Queue q = map.get(key);
    if (q == null) {
        q = new ConcurrentLinkedQueue();
        Queue temp = map.putIfAbsent(q);
        if (temp != null)
            q = temp;
    }
    q.add(val);
}

This will populate the datastructure only for vertices that have messages AND by using the
ConcurrentLinkedQueue we'd also get rid of the other synchronization block.

What do you think?
                
> Improve concurrency of putMsg / putMsgList
> ------------------------------------------
>
>                 Key: GIRAPH-185
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-185
>             Project: Giraph
>          Issue Type: Improvement
>          Components: graph
>    Affects Versions: 0.2.0
>            Reporter: Bo Wang
>            Assignee: Bo Wang
>             Fix For: 0.2.0
>
>         Attachments: GIRAPH-185.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Currently in putMsg / putMsgList, a synchronized closure is used to protect the whole
transientInMessages when adding the new message. This lock prevents other concurrent calls
to putMsg/putMsgList and increases the response time. We should use fine-grain locks to allow
high concurrency in message communication.

--
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

        

Mime
View raw message