← 输入框|github.com|刷新
Skip to content

Test execution takes ages for large projects with thousands of packages #458

Closed

Description

@mikechip1980

For large projects having thousands of packages in tested schema (like OEBS apps schema) one simple test takes about 20 minutes. The test engine tries to find all the annotations in ALL_SOURCE view wich is time consuming.
Can we specify optional test packages name prefix before execution (or somewhere in configuration) to reduce the scan efforts?

Activity

  1. jgebal commented on Aug 17, 2017

    @jgebal
    Member

    Ok. We need to dig out the cache mechanism for annotations then.

  2. pesse commented on Aug 17, 2017

    @pesse
    Member

    I like the idea of configurable name pattern to reduce scanning work

  3. jgebal commented on Aug 17, 2017

    @jgebal
    Member

    We can't really do a skip-scan, as we build suite hierarchy and execute setup from parent suite even when you explicitly call child suite.
    Cache seems the only reasonable option here.
    I already had a PoC of cache some time back (January or so) just need to update it and refactor existing code to use it.
    This could be part of 3.1.0 release.
    20 minutes is not acceptable for scanning.

  4. jgebal commented on Aug 17, 2017

    @jgebal
    Member

    Are you interested in contributing?

  5. mikechip1980 commented on Aug 17, 2017

    @mikechip1980
    Author

    Not sure of how cache can help here. If you talk about plsql tables, then it's suitable for the second run in the same session.
    Jenkins, for example, creates new session for every build, such a cache won't work here.
    May be result cache can help... other solutions look more complex
    But the simpliest solution is a prefix with assumption that all the test packages use the same naming convention. Again, it will be used for large objects only and probably it is not so often used feature and may be complex solution does not makes sense here

  6. mathewbutler commented on Aug 17, 2017

    @mathewbutler
    Contributor

    Hi,

    Have we confirmed that this is the all_source scan? I've seen slow access on some versions and experienced some Oracle bugs in this area.

    What version are we talking about?

    Do we have instrumentation that helps diagnose these types of issues? We should add.

    Once confirmed that the issue is as reported we should capture an execution plan for the query and take things from there.

    Adding a new cache adds more complexity with synchronisation. We should try and avoid this if possible.

    Definitely worth generating a large test suite to reproduce in this project - even if this not run continuously.

    Cheers

  7. Pazus commented on Aug 18, 2017

    @Pazus
    Member

    Hi!

    Version 3.0.3 which is about to be released soon, uses dba_ views if they are accessible which significantly speeds up the parsing.

    As you said even if we use cache there will be the "first" execution which will still take 20 mins. Not an option... I'd measure the influence of dba views first.

  8. jgebal commented on Aug 18, 2017

    @jgebal
    Member

    Only the first execution ever would take 20 minutes.
    All others would benefit from cache and only package spec compiled after last run would need scanning.

  9. jgebal commented on Aug 18, 2017

    @jgebal
    Member

    Anyway. 3.0.3 had some performance improvements for 12.1 and 12.2 related to dbms_preprocessor slowness.
    Please try it once it is released and let us know if it helps.

  10. mikechip1980 commented on Aug 18, 2017

    @mikechip1980
    Author

    I'll give some details. there is a loop in the UT_SUITE_MANAGER package, line 274 (see below)
    It walks thow all the valid packages in current schema and parses data into memory.
    APPS schema in OEBS (for example) has 40k valid packages. ut test puts some data into memory and tries to parse then. judging by v$active_session_history, it takes about 1G of memory. Seems like all the code is fetched into memory before parse. The solution is not suitable for large projects, cache won't fix the issue.
    I can see 2 easy ways to fix it

    1. Add the optional prefix name restriction to the loop (which I had to do in my installation)

    2. use separate schema for the test packages and grant all the preveliges to the objects being tested.

      -- form the single-dimension list of suites constructed from parsed packages
      for rec in (select t.owner
      ,t.object_name
      from all_objects t
      where t.owner = a_owner_name
      and t.status = 'VALID' -- scan only valid specifications
      and t.object_type in ('PACKAGE')
      ) loop
      -- parse the source of the package
      l_suite := config_package(rec.owner, rec.object_name);

      if l_suite is not null then
      l_all_suites(l_suite.path) := l_suite;
      end if;

      end loop;

  11. jgebal commented on Aug 18, 2017

    @jgebal
    Member

    Hi @mikechip1980
    We do not keep all packages in memory, we do them one by one. We only keep annotations.
    Dbms_preporessor in current version was causing huge slowness on 12.1 and 12.2 installations.
    I'm not sure why the session would consume 1 GB of memory. That doesn't seem right and would need to be investigated separately.
    For now I would really like you to wait and try version 3.0.3
    You can also add a feature request to allow execution of suites by part of a name (pattern).
    This should like a nice extension. We need well documented requirements.

  12. jgebal commented on Aug 31, 2017

    @jgebal
    Member

    Hi @mikechip1980 , can you install v3.0.3 and give feedback on it's prformance?
    It will allow us to prioritize further actions.

  13. mikechip1980 commented on Aug 31, 2017

    @mikechip1980
    Author

    Hello!
    At first, I'd like to thank you for the new release! I really appreciate the efforts of people wrking on it.
    So, the first execution of a simple test after 3.0.3 upgrate took 24 min 32 sec. The second run took 1 sec.
    Putting here tha last 100 lines of the session history(see link below). As you can see, the process occupied more than 2Gb of PGA. I think the prefixed scan is the only change which could help with such a projects.
    https://drive.google.com/open?id=0B87VBUz-5kNaYlMzTElKZm1VQTA

    Here is sql for the report
    select sample_time, (select sql_text from v$sql where sql_id=h.sql_id and rownum=1) sql_text, pga_allocated from ( select * from v$active_session_history h where session_id=318 order by sample_id desc) h where rownum<100

  14. jgebal commented on Aug 31, 2017

    @jgebal
    Member

    @Pazus I think we need to take a close look at the way we use our CLOB's.
    https://asktom.oracle.com/pls/asktom/f%3Fp%3D100:11:0::::P11_QUESTION_ID:2957424542334
    Most probably we have memory leaks in CLOB handling.

  15. jgebal commented on Aug 31, 2017

    @jgebal
    Member

    @mikechip1980
    Just for clarity:

    • what DB version are you on?
    • what OS is the DB on?
    • what is the exact call that you execute to run your tests?
  16. 14 remaining items

  17. jgebal commented on Oct 15, 2017

    @jgebal
    Member

    @safokkens @mikechip1980 ,
    Would you be able to help me with testing on Oracle EBS schema for this branch?
    https://github.com/utPLSQL/utPLSQL/tree/feature/annotations_restructuring

    It should give a huge performance boost for:

    • initial scan / first run of tests
    • consecutive run in same or different session
    • consecutive run after package/packages get recompiled

    Your help in validating performance improvements is much appreciated as you were facing significant performance issues.

  18. safokkens commented on Oct 18, 2017

    @safokkens

    Sorry for my late reaction, I had a few days off.

    I tried the branch you mentioned. It needed a small modification before I was able to run it. I tried pushing my change back to github, but I'm not authorized.

    I changed ut_annotation_manager.pkb, line 37 "ut3" in:
    ]'||l_ut_owner||q'[

    After that, I tried to measure the execution time but I failed. Do you know how I can empty the cache for a clean new run?

  19. jgebal commented on Oct 18, 2017

    @jgebal
    Member

    Hi, please delete from ut_annotation_cache_info
    I will look into the issue you reported and see why it was not captured by our tests.

  20. safokkens commented on Oct 18, 2017

    @safokkens

    Thank you!
    On my test system I got 47.789 seconds, pretty impressive!
    As you would imagine, after that the run takes around 0.2 seconds every time.

  21. jgebal commented on Oct 18, 2017

    @jgebal
    Member

    50 seconds for initial scan on EBS schema - nice! :)

  22. safokkens commented on Oct 18, 2017

    @safokkens

    Thinking about it, a tried adding a filter to limit the packages that are searched for annotations.
    Because in EBS there is a standard where user-created packages are named 'XX.....' I added

    name like 'XX%

    After clearing the buffer, I got 4.7 seconds! So, maybe you can add this (undocumented?) filter for EBS systems. This is not a naming convention by us, but an Oracle standard.

    Link

    To reduce the risk that your custom application short name could conflict with a future Oracle E-Business Suite short name, we recommend that your custom application short name begins with "XX". Oracle reserves all three to four character codes starting with the letter O, the letters CP, and the letter E, as well as all names currently used by Oracle E-Business Suite products (query all applications in the Applications window).

    When using this convention, there won't be an unit test package that doesn't start with 'XX'. People who don't use the convention don't have the benefits of filtering. They'll get an initial time of 47 seconds.

  23. jgebal commented on Oct 18, 2017

    @jgebal
    Member

    With cache introduced in annotations_restructuring, only the scan with cache invalidated or empty will take long. This means:

    • when all packages got recompiled
    • when utPLSQL cache is empty (new install)

    Limiting by object name prefix is very strong restriction and isn't the direction I'd like to go.

    When designing, we wanted to keep architecture open, so it is applicable to various projects, that have their own requirements and constraints.

  24. jgebal commented on Oct 18, 2017

    @jgebal
    Member

    I tried the branch you mentioned. It needed a small modification before I was able to run it. I tried pushing my change back to github, but I'm not authorized.

    @safokkens, to contribute to the project, you need to:

    • have your own fork of utPLSQL project
    • make the changes you want to make in your own repo
    • create a Pull Request to our repo (either develop or specific feature branch)

    You can have a look into contributing guide

  25. safokkens commented on Oct 18, 2017

    @safokkens

    I understand, but as mentioned earlier, we have to flashback our database every run. The database for unit tests is our continuous integration database: every release gets built and tested the same way. Therefore, every run we have to make an initial scan.

    I do understand you can't make modifications for every project using utPLSQL, but I'm thinking about Oracle EBS users in general. That's why an optional restriction on the package name (flexible or fixed 'XX%') might be a solution for all those users.

    Maybe the filter shouldn't be on the name, but some kind of flag for Oracle EBS systems?

    BTW: thanks for showing the contributing guide!

  26. jgebal commented on Oct 18, 2017

    @jgebal
    Member

    Since you run your tests with CI, which is definitely a way to go, could you take the initial snapshot of the DB with:

    • initial state
    • utPLSQL installed
    • utPLSQL executed once on EBS schema (even without any custom code installed)

    If you would put all of the above as initial state of your DB, utPLSQL would start within ~<1 sec.

  27. jgebal commented on Oct 18, 2017

    @jgebal
    Member

    For schema-level object filtering by name prefix, the only way i would see it is to have it as parameter for the run command.
    Still, the side effect would be, if there are dependencies to objects not matching filter (parent suites in a hierarchy), the suite hierarchy would be built incorrectly.

    This is the main reason for not putting any ability to filter the scanning - so we're always scanning for parent suites when executing a nested suite.

  28. safokkens commented on Oct 18, 2017

    @safokkens

    Okay, I tried your suggestion by only deleting object_name like 'XX%' from ut_annotation_cache_info.
    Now it takes 15 seconds to finish. Because the build server is dynamically created: is it possible to export this table and load it on every run, or do I need more tables than that one?

  29. jgebal commented on Oct 18, 2017

    @jgebal
    Member

    You need 2 tables:
    ut_annotation_cache and ut_annotation_cache_info

  30. jgebal commented on Oct 18, 2017

    @jgebal
    Member

    I would hold with that however and wait for the chage to be released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions