You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bookkeeper.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/11/02 21:10:59 UTC

[jira] [Commented] (BOOKKEEPER-964) Add concurrent maps and sets for primitive types

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

ASF GitHub Bot commented on BOOKKEEPER-964:
-------------------------------------------

GitHub user merlimat opened a pull request:

    https://github.com/apache/bookkeeper/pull/72

    BOOKKEEPER-964: Add concurrent maps and sets for primitive types

    In BookKeeper there are many instances of maps and sets that use ledger id
    and entry ids as keys or values. JDK concurrent collections have the overhead
    of boxing all the primitive values into objects (eg: long --> Long) that would
    need to be allocated from the heap. In addition to that, JDK map implementations
    are closed hash tables and they will require at least one more allocation to hold
    the linked-list/tree node.
    
    There are already available libraries that offer primitive collections with
    zero-allocation, but none of these support concurrent maps/sets.
    
    We have added a handful of specializations, all based on the same implementation
    idea. We have a hash table which is broken down into multiple sections. Each
    sections, on its own, is an open hash table with linear probing, protected by
    a stamped lock.
    
    All insertions, lookups and iterations on these collections are allocation free.
    
    ```
    ConcurrentLongHashMap: Map<long, Object>
    ConcurrentLongHashSet: Set<long>
    ConcurrentLongLongHashMap: Map<long, long>
    ConcurrentLongLongPairHashMap: Map< Pair<long, long>, Pair<long, long> >
    ConcurrentOpenHashMap: Map<Object, Object>
    ConcurrentOpenHashSet: Set<Object>
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/merlimat/bookkeeper bk-collections

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/bookkeeper/pull/72.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #72
    
----
commit 7e315d934d15beef2f1ce8930f223489636a09df
Author: Matteo Merli <mm...@yahoo-inc.com>
Date:   2016-11-02T21:08:48Z

    BOOKKEEPER-964: Add concurrent maps and sets for primitive types

----


> Add concurrent maps and sets for primitive types
> ------------------------------------------------
>
>                 Key: BOOKKEEPER-964
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-964
>             Project: Bookkeeper
>          Issue Type: Improvement
>            Reporter: Matteo Merli
>            Assignee: Matteo Merli
>             Fix For: 4.5.0
>
>
> In BookKeeper there are many instances of maps and sets that use ledger id
> and entry ids as keys or values. JDK concurrent collections have the overhead
> of boxing all the primitive values into objects (eg: long --> Long) that would
> need to be allocated from the heap. In addition to that, JDK map implementations
> are closed hash tables and they will require at least one more allocation to hold
> the linked-list/tree node.
> There are already available libraries that offer primitive collections with
> zero-allocation, but none of these support concurrent maps/sets.
> We have added a handful of specializations, all based on the same implementation
> idea. We have a hash table which is broken down into multiple sections. Each
> sections, on its own, is an open hash table with linear probing, protected by
> a stamped lock.
> All insertions, lookups and iterations on these collections are allocation free.
> {noformat}
> ConcurrentLongHashMap: Map<long, Object>
> ConcurrentLongHashSet: Set<long>
> ConcurrentLongLongHashMap: Map<long, long>
> ConcurrentLongLongPairHashMap: Map< Pair<long, long>, Pair<long, long> >
> ConcurrentOpenHashMap: Map<Object, Object>
> ConcurrentOpenHashSet: Set<Object>
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)