-
Notifications
You must be signed in to change notification settings - Fork 185
Test execution takes ages for large projects with thousands of packages #458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Ok. We need to dig out the cache mechanism for annotations then. |
I like the idea of configurable name pattern to reduce scanning work |
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. |
Are you interested in contributing? |
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. |
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 |
Hi! Version 3.0.3 which is about to be released soon, uses 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. |
Anyway. 3.0.3 had some performance improvements for 12.1 and 12.2 related to dbms_preprocessor slowness. |
I'll give some details. there is a loop in the UT_SUITE_MANAGER package, line 274 (see below)
|
Hi @mikechip1980 |
Hi @mikechip1980 , can you install v3.0.3 and give feedback on it's prformance? |
Hello! Here is sql for the report |
@Pazus I think we need to take a close look at the way we use our CLOB's. |
@mikechip1980
|
@mikechip1980 |
I did a test on my DB in a schema with over 500 packages. declare
l_pga number;
l_pga1 number;
function get_stat_val( p_name in varchar2 ) return number
as
l_val number;
begin
select b.value
into l_val
from v$statname a, v$mystat b
where a.statistic# = b.statistic#
and a.name = p_name;
return l_val;
end;
begin
l_pga := get_stat_val( 'session pga memory' );
ut.run('my_schema:com.my_company.my_project.my_module');
l_pga1 := get_stat_val( 'session pga memory' );
if ( (l_pga1-l_pga) <> 0 ) then
dbms_output.put_line ( ' pga before ' || l_pga || '.... ' || (l_pga1-l_pga) || ' pga change' );
dbms_output.put_line ( ' pga after ' || l_pga1 );
end if;
end;
So it seems that the run took 2.7MB of PGA. Are you sure that it's not the unit test itself that is causing excessive PGA usage? |
Sorry for not reading in details: If you find such annotation-style comment lines, can you share some of them? |
Hello!
begin Don't think this actually matters, there are 5563151 lines of the code in package specifications in APPS schema, only the query below takes 2 minutes. There are no invalid packages.
I think the version and os don't matters if test scans all the code, it's just a huge data and won't work fast. The only simple way is to take a piece of it, as I suggested, using prefix. I've put the prefix into ut_suite_manager package and now the first test takes seconds. |
Putting the tests into separate schema is a good option, I'll try it (This idea I put also into my previos posts). The schema should have access to all the APPS objects. Will see if it helps |
There are 758 lines returned by query but basically these are lines like this. Please give me another template if you would like me to check. |
I'm afraid that caching won't fix our problem. We use unit testing on our continuous integration build server. After every build the build server will get a flashback to its starting point, ready for the next build. |
Can you check on your DB how long it takes for this query to execute in EBS schema? select t.owner, t.object_name
from all_objects t
where t.owner = :a_owner_name
and t.status = 'VALID' and t.object_type in ('PACKAGE')
and t.object_name IN (
select name from all_source
where owner = :a_owner_name and lower(text) like '%suite%'
) and same on dba_views select t.owner, t.object_name
from dba_objects t
where t.owner = :a_owner_name
and t.status = 'VALID' and t.object_type in ('PACKAGE')
and t.object_name IN (
select name from dba_source
where owner = :a_owner_name and lower(text) like '%suite%'
) That could give us a clue on possible hotfix. Idea is to limit the scanned sources to those that are unit test suites. |
@mikechip1980 |
The first query takes 20.647 seconds. |
Ok, so up to 80-100 seconds to start the runner |
Guess that would be much better than what you face now |
much better indeed! For now I'll try putting my tests in another schema. |
@safokkens @mikechip1980 , It should give a huge performance boost for:
Your help in validating performance improvements is much appreciated as you were facing significant performance issues. |
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: 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? |
Hi, please delete from ut_annotation_cache_info |
Thank you! |
50 seconds for initial scan on EBS schema - nice! :) |
Thinking about it, a tried adding a filter to limit the packages that are searched for annotations.
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.
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. |
With cache introduced in
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. |
@safokkens, to contribute to the project, you need to:
You can have a look into contributing guide |
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! |
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. |
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. 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 |
You need 2 tables: |
I would hold with that however and wait for the chage to be released |
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?
The text was updated successfully, but these errors were encountered: