You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test execution takes ages for large projects with thousands of packages #458
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?
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.
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
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.
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.
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.
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
Add the optional prefix name restriction to the loop (which I had to do in my installation)
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;
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.
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
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?
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.
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.
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)
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?
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.
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?
Activity
jgebal commentedon Aug 17, 2017
Ok. We need to dig out the cache mechanism for annotations then.
pesse commentedon Aug 17, 2017
I like the idea of configurable name pattern to reduce scanning work
jgebal commentedon Aug 17, 2017
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.
jgebal commentedon Aug 17, 2017
Are you interested in contributing?
mikechip1980 commentedon Aug 17, 2017
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
mathewbutler commentedon Aug 17, 2017
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
Pazus commentedon Aug 18, 2017
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.
jgebal commentedon Aug 18, 2017
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.
jgebal commentedon Aug 18, 2017
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.
mikechip1980 commentedon Aug 18, 2017
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
Add the optional prefix name restriction to the loop (which I had to do in my installation)
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;
jgebal commentedon Aug 18, 2017
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.
jgebal commentedon Aug 31, 2017
Hi @mikechip1980 , can you install v3.0.3 and give feedback on it's prformance?
It will allow us to prioritize further actions.
mikechip1980 commentedon Aug 31, 2017
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<100jgebal commentedon Aug 31, 2017
@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.
jgebal commentedon Aug 31, 2017
@mikechip1980
Just for clarity:
14 remaining items
jgebal commentedon Oct 15, 2017
@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:
Your help in validating performance improvements is much appreciated as you were facing significant performance issues.
safokkens commentedon Oct 18, 2017
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?
jgebal commentedon Oct 18, 2017
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.
safokkens commentedon Oct 18, 2017
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.
jgebal commentedon Oct 18, 2017
50 seconds for initial scan on EBS schema - nice! :)
safokkens commentedon Oct 18, 2017
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
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.
jgebal commentedon Oct 18, 2017
With cache introduced in
annotations_restructuring, only the scan with cache invalidated or empty will take long. This means: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.
jgebal commentedon Oct 18, 2017
@safokkens, to contribute to the project, you need to:
You can have a look into contributing guide
safokkens commentedon Oct 18, 2017
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!
jgebal commentedon Oct 18, 2017
Since you run your tests with CI, which is definitely a way to go, could you take the initial snapshot of the DB with:
If you would put all of the above as initial state of your DB, utPLSQL would start within ~<1 sec.
jgebal commentedon Oct 18, 2017
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.
safokkens commentedon Oct 18, 2017
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?
jgebal commentedon Oct 18, 2017
You need 2 tables:
ut_annotation_cache and ut_annotation_cache_info
jgebal commentedon Oct 18, 2017
I would hold with that however and wait for the chage to be released