Description
ContactMechWorker.get[Entity]ContactMechValueMaps are old historic functions that resolve all contact mech context related to an Entity (Party, Facility, Order, WorkEffort).
The problem that they create too many db call during their execution that decrease OFBiz performance when the contactMech history grow.
On customer site I realized a new adaptation (oriented and not generic at all) and control the performance issue with a unit test :
public void testContactMechSearch() throws Exception { UtilTimer timer = new UtilTimer("test contactmech", true, true); timer.startTimer(); List<Map<String, Object>> cmwPostalAdress = ContactMechWorker.getPartyContactMechValueMaps(delegator, "10375", false, "POSTAL_ADDRESS"); timer.timerString("PA cmw " + cmwPostalAdress.size()); List<Map<String, Object>> cmwTelecomNumber = ContactMechWorker.getPartyContactMechValueMaps(delegator, "10375", false, "TELECOM_NUMBER"); timer.timerString("TN cmw " + cmwTelecomNumber.size()); List<Map<String, Object>> cmwEmail = ContactMechWorker.getPartyContactMechValueMaps(delegator, "10375", false, "EMAIL_ADDRESS"); timer.timerString("E cmw " + cmwEmail.size()); List<Map<String, Object>> epwPostalAdress = CustomPartyWorker.getPartyContactMechValueMaps(delegator, "10375", false, "POSTAL_ADDRESS", null); timer.timerString("PA cpw " + epwPostalAdress.size()); List<Map<String, Object>> epwTelecomNumber = CustomPartyWorker.getPartyContactMechValueMaps(delegator, "10375", false, "TELECOM_NUMBER", null); timer.timerString("TN cpw " + epwTelecomNumber.size()); List<Map<String, Object>> epwEmail = CustomPartyWorker.getPartyContactMechValueMaps(delegator, "10375", false, "EMAIL_ADDRESS", null); timer.timerString("E cpw " + epwEmail.size()); }
The partyId "10375" is linked with more tha 600 contactMechs on my local site db. And the test excecution give :
With ContactMechWorker [java] [[PA cmw 2- total:....,since last(Begin):33.707]] - 'test contactmech' [java] [[TN cmw 2- total:....,since last(PA cmw 2):33.837]] - 'test contactmech' [java] [[E cmw 1- total:1..,since last(TN cmw 2):33.115]] - 'test contactmech' With CustomPartyWorker [java] [[PA epw 2- total:...,since last(E cmw 1):0.53]] - 'test contactmech' [java] [[TN epw 2- total:...,since last(PA epw 2):0.588]] - 'test contactmech' [java] [[E epw 1- total:...,since last(TN epw 2):0.631]] - 'test contactmech'
total ~100s for ContactMechWorker and ~1.5s for CustomPartyWorker
Difference come that CustomPartyWorker works on a view entity gathering the data and populating GenericValue with makeValue (using the data within the view) instead of creating new getRelated db access.
I will implement this idea on generic context to improve these functions
Attachments
Attachments
Issue Links
- breaks
-
OFBIZ-10540 Warning in console logs related to entity definitions
-
- Closed
-