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

Jonathan Ellis commented on CASSANDRA-5538:
-------------------------------------------

nice work, +1.

It looks like this basically optimizes local writes, right?  ISTM that the 
next-most-common case will be "single, local datacenter."  Can we optimize for 
that with a SingletonMap instead of a full hashmap?

Wrinkle is I'm not entirely sure the best way to ask, "are multiple DCs 
involved."  Brute force: add a Snitch.isMultiDC method ("did you see multiple 
DCs when you initialized yourself"); downside is I'm not sure how to do this 
for EC2Snitch; might just have to assume True.

Less coupling: pre-iterate the targets and track "last-seen datacenter" and 
compare; downside is one, possibly two hash lookups per target, then a string 
compare, and in the case we're trying to optimize for we do the most 
comparisons.

So maybe brute force is the way to go unless you have a better idea.  Okay to 
break that out into a separate ticket if you'd rather.
                
> Reduce Empty Map allocations in StorageProxy.sendToHintedEndpoints
> ------------------------------------------------------------------
>
>                 Key: CASSANDRA-5538
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-5538
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 2.0
>            Reporter: Dave Brosius
>            Assignee: Dave Brosius
>            Priority: Trivial
>             Fix For: 2.0
>
>         Attachments: 5538.txt
>
>
> StorageProxy.sendToHintedEndpoints allocates HashMaps consistently that are 
> very often not used.
> See output: http://pastebin.com/jEaBxz1h
> Format is
> Type Date SourceLine CollectionSize NumBuckets NumBucketsUsed
> The snapshot is taken after the size of the collection hasn't changed for 5 
> seconds.
> Postpone creation of hashmap until you need it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to