Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0033133Openbravo ERPA. Platformpublic2016-06-03 17:142022-02-01 08:09
shuehner 
Triage Platform Base 
normalminorhave not tried
newopen 
5
 
 
Core
No
0033133: OBCriteria skip adding client+org filters if table is known to not required these.
Every table in Openbravo is configured with a Data Access Level (in ad_table).

For tables which are 'System only' adding filters for readable clients + organizations should not be required.

So depending on the table used for a criteria those filters should be skipped to avoid some processing overhead.

Any change here needs to be carefully validated to not break client+org security model.
Also there maybe special cases (table joins) which probably require extra care.

NOTE: Even some partial optimization for some cases (i.e. no joins) could be useful.
Measure total runtime of i.e. OBMessageUtils.messageBD unmodified versus a version of the function which 'manually' removes those extra filters.

To simulate change the following can be used:
      obcMessage.setFilterOnReadableClients(false);
      obcMessage.setFilterOnReadableOrganization(false);

As a simple testcase to show performance difference the following can be used to do 10 runs of 10k invocations of the function with and without the proposed change.

  @Test
  public void testSHU2() {
    for (int run = 0; run < 10; run++) {
      long s1 = System.currentTimeMillis();
      for (int i = 0; i < 10000; i++) {
        String res = OBMessageUtils.messageBD("OrderDocumentno");
      }
      long s2 = System.currentTimeMillis();
      log.info("Took: " + (s2 - s1));
    }
  }

Testing in a normal pristine pi + retail database show a runtime of
a.) unmodified: ca. 8.4 seconds per run
b.) patched: 6.8s per run

In a different systems having a lot more organizations (ca. 300) the following time difference can be seen:
a.) unpatched: ca. 12.1 seconds per run
b.) patched: ca. 10.2s per run
Performance
related to defect 0033132 closed platform OBCriteria (at least sometimes) add client + org filters twice 
Issue History
2016-06-03 17:14shuehnerNew Issue
2016-06-03 17:14shuehnerAssigned To => platform
2016-06-03 17:14shuehnerModules => Core
2016-06-03 17:14shuehnerTriggers an Emergency Pack => No
2016-06-03 17:14shuehnerRelationship addedrelated to 0033132
2016-06-03 17:14shuehnerTag Attached: Performance
2022-02-01 08:09alostaleAssigned Toplatform => Triage Platform Base

There are no notes attached to this issue.