2 @message |
Performance problem
assert
- Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: acceptable
+ Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: /* perf_issue_tag */ UNACCEPTABLE: 0.57 -- greater than threshold = 0.55
+ Check result of 21 measures:
+ 0 : 0.49
+ 1 : 0.57
+ 2 : 0.57
+ 3 : 0.53
+ 4 : 0.51
+ 5 : 0.61
+ 6 : 0.52
+ 7 : 0.59
+ 8 : 0.57
+ 9 : 0.57
+ 10 : 0.58
+ 11 : 0.51
+ 12 : 0.59
+ 13 : 0.56
+ 14 : 0.56
+ 15 : 0.54
+ 16 : 0.54
+ 17 : 0.55
+ 18 : 0.58
+ 19 : 0.59
+ 20 : 0.58
Median value for 21 ratios of commit_time/compile_time when create 1500 standalone PSQL objects: acceptable
LOG DETAILS:
2024-10-14 04:59:00.487
2024-10-14 04:59:00.492 act = <firebird.qa.plugin.Action object at [hex]>
2024-10-14 04:59:00.497 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2024-10-14 04:59:00.502
2024-10-14 04:59:00.511 @pytest.mark.version('>=3.0')
2024-10-14 04:59:00.517 def test_1(act: Action, capsys):
2024-10-14 04:59:00.522
2024-10-14 04:59:00.526 act.db.set_async_write() # just to be sure, although this is by default
2024-10-14 04:59:00.531
2024-10-14 04:59:00.535 expected_stdout = f"""
2024-10-14 04:59:00.540 Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} packaged PSQL objects: acceptable
2024-10-14 04:59:00.545 Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} standalone PSQL objects: acceptable
2024-10-14 04:59:00.550 """
2024-10-14 04:59:00.557
2024-10-14 04:59:00.564 func_headers_ddl = ''.join( [ '\n function fn_%d returns int;' % i for i in range(N_LIMIT) ] )
2024-10-14 04:59:00.570 func_bodies_ddl = ''.join( [ '\n function fn_%d returns int as begin return %d; end' % (i,i) for i in range(N_LIMIT) ] )
2024-10-14 04:59:00.576
2024-10-14 04:59:00.581 pkg_header_ddl = '\n'.join( ('create or alter package huge as\nbegin', func_headers_ddl, 'end') )
2024-10-14 04:59:00.587 pkg_body_ddl = '\n'.join( ('recreate package body huge as\nbegin', func_bodies_ddl, 'end') )
2024-10-14 04:59:00.594
2024-10-14 04:59:00.599 sp_time = {}
2024-10-14 04:59:00.604 with act.db.connect() as con:
2024-10-14 04:59:00.609
2024-10-14 04:59:00.614 with con.cursor() as cur:
2024-10-14 04:59:00.619 cur.execute('select mon$server_pid as p from mon$attachments where mon$attachment_id = current_connection')
2024-10-14 04:59:00.625 fb_pid = int(cur.fetchone()[0])
2024-10-14 04:59:00.630
2024-10-14 04:59:00.635 for i in range(0, N_MEASURES):
2024-10-14 04:59:00.643 for ftype in ('packaged', 'standalone'):
2024-10-14 04:59:00.653
2024-10-14 04:59:00.659 fb_info_a = psutil.Process(fb_pid).cpu_times()
2024-10-14 04:59:00.664 if ftype == 'packaged':
2024-10-14 04:59:00.670 con.execute_immediate(pkg_header_ddl)
2024-10-14 04:59:00.678 con.execute_immediate(pkg_body_ddl)
2024-10-14 04:59:00.684 else:
2024-10-14 04:59:00.689 for k in range(0,N_LIMIT):
2024-10-14 04:59:00.694 con.execute_immediate( 'create or alter function sf_%d returns int as begin return %d; end' % (k,k) )
2024-10-14 04:59:00.699
2024-10-14 04:59:00.704 fb_info_b = psutil.Process(fb_pid).cpu_times()
2024-10-14 04:59:00.709 con.commit()
2024-10-14 04:59:00.714 fb_info_c = psutil.Process(fb_pid).cpu_times()
2024-10-14 04:59:00.726
2024-10-14 04:59:00.732 cpu_time_for_compile = max(fb_info_b.user - fb_info_a.user, 0.000001)
2024-10-14 04:59:00.737 cpu_time_for_commit = fb_info_c.user - fb_info_b.user
2024-10-14 04:59:00.742
2024-10-14 04:59:00.747 sp_time[ ftype, i ] = cpu_time_for_commit / cpu_time_for_compile
2024-10-14 04:59:00.752
2024-10-14 04:59:00.757 commit_2_compile_ratio_for_package = [round(v,2) for k,v in sp_time.items() if k[0] == 'packaged']
2024-10-14 04:59:00.762 commit_2_compile_ratio_for_standal = [round(v,2) for k,v in sp_time.items() if k[0] == 'standalone']
2024-10-14 04:59:00.767
2024-10-14 04:59:00.772 actual_time_ratios_commit2compile = { 'packaged' : median(commit_2_compile_ratio_for_package), 'standalone': median(commit_2_compile_ratio_for_standal) }
2024-10-14 04:59:00.777
2024-10-14 04:59:00.782 for ftype in ('packaged', 'standalone'):
2024-10-14 04:59:00.793 msg = f"Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} {ftype} PSQL objects: "
2024-10-14 04:59:00.800 if actual_time_ratios_commit2compile[ ftype ] < MAX_TIME_RATIOS_COMMIT_TO_COMPILE[ ftype ]:
2024-10-14 04:59:00.806 print( msg + 'acceptable')
2024-10-14 04:59:00.812 else:
2024-10-14 04:59:00.817 print( msg + '/* perf_issue_tag */ UNACCEPTABLE: %12.2f -- greater than threshold = %12.2f' % (actual_time_ratios_commit2compile[ ftype ], MAX_TIME_RATIOS_COMMIT_TO_COMPILE[ ftype ]) )
2024-10-14 04:59:00.829 print( 'Check result of %d measures:' % N_MEASURES )
2024-10-14 04:59:00.836
2024-10-14 04:59:00.842 # List with concrete values (source for median evaluation):
2024-10-14 04:59:00.847 lst = commit_2_compile_ratio_for_package if ftype == 'packaged' else commit_2_compile_ratio_for_standal
2024-10-14 04:59:00.852 for i,p in enumerate(lst):
2024-10-14 04:59:00.857 print('%3d' % i, ':', '%12.2f' % p)
2024-10-14 04:59:00.863
2024-10-14 04:59:00.868
2024-10-14 04:59:00.873 act.expected_stdout = expected_stdout
2024-10-14 04:59:00.878 act.stdout = capsys.readouterr().out
2024-10-14 04:59:00.883 > assert act.clean_stdout == act.clean_expected_stdout
2024-10-14 04:59:00.888 E assert
2024-10-14 04:59:00.894 E - Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: acceptable
2024-10-14 04:59:00.900 E + Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: /* perf_issue_tag */ UNACCEPTABLE: 0.57 -- greater than threshold = 0.55
2024-10-14 04:59:00.905 E + Check result of 21 measures:
2024-10-14 04:59:00.910 E + 0 : 0.49
2024-10-14 04:59:00.920 E + 1 : 0.57
2024-10-14 04:59:00.929 E + 2 : 0.57
2024-10-14 04:59:00.934 E + 3 : 0.53
2024-10-14 04:59:00.939 E + 4 : 0.51
2024-10-14 04:59:00.945 E + 5 : 0.61
2024-10-14 04:59:00.950 E + 6 : 0.52
2024-10-14 04:59:00.955 E + 7 : 0.59
2024-10-14 04:59:00.961 E + 8 : 0.57
2024-10-14 04:59:00.966 E + 9 : 0.57
2024-10-14 04:59:00.971 E + 10 : 0.58
2024-10-14 04:59:00.976 E + 11 : 0.51
2024-10-14 04:59:00.982 E + 12 : 0.59
2024-10-14 04:59:00.988 E + 13 : 0.56
2024-10-14 04:59:00.993 E + 14 : 0.56
2024-10-14 04:59:00.997 E + 15 : 0.54
2024-10-14 04:59:01.003 E + 16 : 0.54
2024-10-14 04:59:01.009 E + 17 : 0.55
2024-10-14 04:59:01.015 E + 18 : 0.58
2024-10-14 04:59:01.021 E + 19 : 0.59
2024-10-14 04:59:01.027 E + 20 : 0.58
2024-10-14 04:59:01.033 E Median value for 21 ratios of commit_time/compile_time when create 1500 standalone PSQL objects: acceptable
2024-10-14 04:59:01.037
2024-10-14 04:59:01.042 tests/bugs/core_4880_test.py:164: AssertionError
2024-10-14 04:59:01.046 ---------------------------- Captured stdout setup -----------------------------
2024-10-14 04:59:01.051 Creating db: localhost:/var/tmp/qa_2024/test_1970/test.fdb [page_size=None, sql_dialect=None, charset='NONE', user=SYSDBA, password=masterkey]
|
3 #text |
act = <firebird.qa.plugin.Action pytest object at [hex]>
capsys = <_pytest.capture.CaptureFixture pytest object at [hex]>
@pytest.mark.version('>=3.0')
def test_1(act: Action, capsys):
act.db.set_async_write() # just to be sure, although this is by default
expected_stdout = f"""
Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} packaged PSQL objects: acceptable
Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} standalone PSQL objects: acceptable
"""
func_headers_ddl = ''.join( [ '\n function fn_%d returns int;' % i for i in range(N_LIMIT) ] )
func_bodies_ddl = ''.join( [ '\n function fn_%d returns int as begin return %d; end' % (i,i) for i in range(N_LIMIT) ] )
pkg_header_ddl = '\n'.join( ('create or alter package huge as\nbegin', func_headers_ddl, 'end') )
pkg_body_ddl = '\n'.join( ('recreate package body huge as\nbegin', func_bodies_ddl, 'end') )
sp_time = {}
with act.db.connect() as con:
with con.cursor() as cur:
cur.execute('select mon$server_pid as p from mon$attachments where mon$attachment_id = current_connection')
fb_pid = int(cur.fetchone()[0])
for i in range(0, N_MEASURES):
for ftype in ('packaged', 'standalone'):
fb_info_a = psutil.Process(fb_pid).cpu_times()
if ftype == 'packaged':
con.execute_immediate(pkg_header_ddl)
con.execute_immediate(pkg_body_ddl)
else:
for k in range(0,N_LIMIT):
con.execute_immediate( 'create or alter function sf_%d returns int as begin return %d; end' % (k,k) )
fb_info_b = psutil.Process(fb_pid).cpu_times()
con.commit()
fb_info_c = psutil.Process(fb_pid).cpu_times()
cpu_time_for_compile = max(fb_info_b.user - fb_info_a.user, 0.000001)
cpu_time_for_commit = fb_info_c.user - fb_info_b.user
sp_time[ ftype, i ] = cpu_time_for_commit / cpu_time_for_compile
commit_2_compile_ratio_for_package = [round(v,2) for k,v in sp_time.items() if k[0] == 'packaged']
commit_2_compile_ratio_for_standal = [round(v,2) for k,v in sp_time.items() if k[0] == 'standalone']
actual_time_ratios_commit2compile = { 'packaged' : median(commit_2_compile_ratio_for_package), 'standalone': median(commit_2_compile_ratio_for_standal) }
for ftype in ('packaged', 'standalone'):
msg = f"Median value for {N_MEASURES} ratios of commit_time/compile_time when create {N_LIMIT} {ftype} PSQL objects: "
if actual_time_ratios_commit2compile[ ftype ] < MAX_TIME_RATIOS_COMMIT_TO_COMPILE[ ftype ]:
print( msg + 'acceptable')
else:
print( msg + '/* perf_issue_tag */ UNACCEPTABLE: %12.2f -- greater than threshold = %12.2f' % (actual_time_ratios_commit2compile[ ftype ], MAX_TIME_RATIOS_COMMIT_TO_COMPILE[ ftype ]) )
print( 'Check result of %d measures:' % N_MEASURES )
# List with concrete values (source for median evaluation):
lst = commit_2_compile_ratio_for_package if ftype == 'packaged' else commit_2_compile_ratio_for_standal
for i,p in enumerate(lst):
print('%3d' % i, ':', '%12.2f' % p)
act.expected_stdout = expected_stdout
act.stdout = capsys.readouterr().out
> assert act.clean_stdout == act.clean_expected_stdout
E assert
E - Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: acceptable
E + Median value for 21 ratios of commit_time/compile_time when create 1500 packaged PSQL objects: /* perf_issue_tag */ UNACCEPTABLE: 0.57 -- greater than threshold = 0.55
E + Check result of 21 measures:
E + 0 : 0.49
E + 1 : 0.57
E + 2 : 0.57
E + 3 : 0.53
E + 4 : 0.51
E + 5 : 0.61
E + 6 : 0.52
E + 7 : 0.59
E + 8 : 0.57
E + 9 : 0.57
E + 10 : 0.58
E + 11 : 0.51
E + 12 : 0.59
E + 13 : 0.56
E + 14 : 0.56
E + 15 : 0.54
E + 16 : 0.54
E + 17 : 0.55
E + 18 : 0.58
E + 19 : 0.59
E + 20 : 0.58
E Median value for 21 ratios of commit_time/compile_time when create 1500 standalone PSQL objects: acceptable
tests/bugs/core_4880_test.py:164: AssertionError
|