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

Sylvain Lebresne commented on CASSANDRA-13063:
----------------------------------------------

I doubt this has much noticeable impact in practice but there is definitively 
no reason to create an object every time so happy if you want to provide a 
patch. Using a {{ConcurrentHashMap}} is however quite heavy handed imo: we 
support at best a handful of versions in any given release so I suggest 
declaring them as static instances (or through an enum) and use a simple switch 
to retrieve the proper object form the version string.

> Too many instances of BigVersion
> --------------------------------
>
>                 Key: CASSANDRA-13063
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13063
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Simon Zhou
>            Assignee: Simon Zhou
>            Priority: Minor
>
> When debugging with Cassandra 3.0.10 I found 70+ BigVersion objects on a new 
> node after . This was from a cluster created by CMM and had very little data. 
> Since we create a new instance of BigVersion for each SSTable, that would 
> create too many objects, eg, when bootstrapping new node in a cluster with 
> many sstables.
> Looks like sstables can actually share the same BigVersion instance as long 
> as they has same version. What we can do is to create a object cache and only 
> create new object if not found.
> {code}
> ConcurrentHashMap<String, BigVersion> versions = new ConcurrentHashMap<>();
> {code}
> May not be a big deal but a minor improvement.  [~tjake] what do you think?



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

Reply via email to