xiaojian zhou created GEODE-6973:
------------------------------------

             Summary: getExistingIdForType should not compare all entries in 
idToType region
                 Key: GEODE-6973
                 URL: https://issues.apache.org/jira/browse/GEODE-6973
             Project: Geode
          Issue Type: Bug
            Reporter: xiaojian zhou


We found the PeerTypeRegistration's getExistingIdForType() will iterate through 
the idToType region's entries to find if the incoming newType is there. 

If idToType region contains 20K or 100K entries, this will impact the put 
throughput (customers did notice the performance downgrade when there're many 
pdxTypes). 

To make the things worse, the comparison is to compare the whole object, field 
to field. If the json object (which will be converted to pdxType) contains 30 
fields, the comparison will have to compare up to 30 fields. If the idToType 
region contains 20K entries, A new pdxType will do 20K  x 30 string comparisons 
before register it. 

To speed up, we proposed to add an index hashmap, which used pdxType's hashcode 
as key, pdxTypeId's arrayList or hashset as value. 

When a new pdxType arrived, calculate its hashcode, then use the hashcode to 
find its pdxTypeIds (it could be a list if there're hash conflicts, but in most 
of case, it should be only one). Then use this small list to find the pdxTypes. 
Only need to do field-to-filed compare to this small list of pdxType. 

This algorithm will dramatically speed up.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to