You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Nicolas Malin (JIRA)" <ji...@apache.org> on 2018/08/10 21:19:00 UTC

[jira] [Updated] (OFBIZ-10514) Refactoring ContactMechWorker.get[Entity]ContactMechValueMaps

     [ https://issues.apache.org/jira/browse/OFBIZ-10514?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nicolas Malin updated OFBIZ-10514:
----------------------------------
    Attachment: OFBIZ-10514.patch

> Refactoring ContactMechWorker.get[Entity]ContactMechValueMaps
> -------------------------------------------------------------
>
>                 Key: OFBIZ-10514
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-10514
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: party
>            Reporter: Nicolas Malin
>            Assignee: Nicolas Malin
>            Priority: Major
>         Attachments: OFBIZ-10514.patch
>
>
> 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 :
> {code:java}
> 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());
> }
> {code}
> The partyId "10375" is linked with more tha 600 contactMechs on my local site db. And the test excecution give :
> {code:java}
> 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'
> {code}
> 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  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)