-
Notifications
You must be signed in to change notification settings - Fork 22
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
ADBDEV-6156 Count startup memory of each process when using resource groups #1023
base: adb-6.x-dev
Are you sure you want to change the base?
Changes from 20 commits
635f0da
f075158
f8bd708
da24513
c1acd81
fb14e74
cdf357a
ec269c9
8c71e1c
4579e61
ef84cdb
cf1b560
562ac84
94328c9
73582b3
4a9360e
475f3cb
ef3a7e5
524afa5
021c829
bd7ab6e
c765b67
0c1831d
caa4e57
492e4bd
c4f373c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
-- start_ignore | ||
! gpconfig -c runaway_detector_activation_percent -v 10; | ||
! gpstop -rai; | ||
|
||
drop table if exists t1; | ||
drop role if exists test; | ||
drop resource group test_group; | ||
-- end_ignore | ||
|
||
create resource group test_group with (cpu_rate_limit=20, memory_limit=15, memory_shared_quota=100, memory_spill_ratio=0); | ||
CREATE | ||
|
||
create role test with resource group test_group; | ||
CREATE | ||
|
||
set role test; | ||
SET | ||
create table t1 (a int) distributed by (a); | ||
CREATE | ||
insert into t1 select a from generate_series(1, 10) a; | ||
INSERT 10 | ||
alter table t1 set distributed randomly; | ||
ALTER | ||
|
||
-- Test that the starting memory is visible to the resource group. | ||
1: set role test; | ||
SET | ||
1&: select count(*) from t1 where pg_sleep(1) is not null; <waiting ...> | ||
|
||
2: select segment, mem.* from gp_toolkit.gp_resgroup_status, json_object_keys(memory_usage) as segment, json_to_record(memory_usage -> segment) mem (used int) where rsgname = 'test_group'; | ||
segment | used | ||
---------+------ | ||
-1 | 12 | ||
0 | 12 | ||
1 | 12 | ||
2 | 12 | ||
(4 rows) | ||
1<: <... completed> | ||
count | ||
------- | ||
10 | ||
(1 row) | ||
1q: ... <quitting> | ||
2q: ... <quitting> | ||
|
||
-- The runaway detector test. A query with a large number of slices should | ||
-- be terminated due to high memory consumption. | ||
select count(*) from t1 a1 join t1 a2 using(a) join t1 a3 using(a) join t1 a4 using(a) join t1 a5 using(a) join t1 a6 using(a) join t1 a7 using(a) join t1 a8 using(a) join t1 a9 using(a) join t1 a10 using(a); | ||
ERROR: Canceling query because of high VMEM usage. current group id is 712716, group memory usage 133 MB, group shared memory quota is 102 MB, slot memory quota is 0 MB, global freechunks memory is 277 MB, global safe memory threshold is 277 MB (runaway_cleaner.c:197) (seg1 slice10 172.18.0.3:6003 pid=88018) (runaway_cleaner.c:197) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rewrite please the test so that the error about memory consumption before the patch and after the patch occurs for different reasons |
||
|
||
drop table t1; | ||
DROP | ||
reset role; | ||
RESET | ||
drop role test; | ||
DROP | ||
drop resource group test_group; | ||
DROP | ||
-- start_ignore | ||
-- end_ignore |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,10 @@ | |
-- | ||
-- end_matchsubs | ||
|
||
-- start_ignore | ||
! gpstop -rai; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this line is added? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reverted |
||
-- end_ignore | ||
|
||
CREATE OR REPLACE FUNCTION resGroupPalloc(float) RETURNS int AS | ||
'@abs_builddir@/../regress/regress@DLSUFFIX@', 'resGroupPalloc' | ||
LANGUAGE C READS SQL DATA; | ||
|
@@ -135,7 +139,7 @@ SELECT num_running FROM gp_toolkit.gp_resgroup_status WHERE rsgname='rg_move_que | |
1&: SELECT pg_sleep(3); | ||
2: SET ROLE role_move_query_mem_small; | ||
2: BEGIN; | ||
2: SELECT hold_memory_by_percent_on_qe(1,0.1); | ||
2: SELECT hold_memory_by_percent_on_qe(1,0.2); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why 0.1 is replaced with 0.2 here and below? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reverted |
||
3&: SELECT gp_toolkit.pg_resgroup_move_query(pid, 'rg_move_query') FROM pg_stat_activity WHERE query LIKE '%hold_memory_by_percent_on_qe%' AND rsgname='rg_move_query_mem_small'; | ||
1<: | ||
-- connection 1 finished, it will wake up connection 3 | ||
|
@@ -150,7 +154,7 @@ SELECT num_running FROM gp_toolkit.gp_resgroup_status WHERE rsgname='rg_move_que | |
1: ALTER RESOURCE GROUP rg_move_query SET memory_limit 0; | ||
1: SET ROLE role_move_query_mem_small; | ||
1: BEGIN; | ||
1: SELECT hold_memory_by_percent_on_qe(1,0.1); | ||
1: SELECT hold_memory_by_percent_on_qe(1,0.2); | ||
2: SELECT gp_toolkit.pg_resgroup_move_query(pid, 'rg_move_query') FROM pg_stat_activity WHERE query LIKE '%hold_memory_by_percent_on_qe%' AND rsgname='rg_move_query_mem_small'; | ||
2: SELECT is_session_in_group(pid, 'rg_move_query') FROM pg_stat_activity WHERE query LIKE '%hold_memory_by_percent_on_qe%' AND state = 'idle in transaction'; | ||
1: END; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
-- start_ignore | ||
! gpconfig -c runaway_detector_activation_percent -v 10; | ||
! gpstop -rai; | ||
|
||
drop table if exists t1; | ||
drop role if exists test; | ||
drop resource group test_group; | ||
-- end_ignore | ||
|
||
create resource group test_group with (cpu_rate_limit=20, memory_limit=15, memory_shared_quota=100, memory_spill_ratio=0); | ||
|
||
create role test with resource group test_group; | ||
|
||
set role test; | ||
create table t1 (a int) distributed by (a); | ||
insert into t1 select a from generate_series(1, 10) a; | ||
alter table t1 set distributed randomly; | ||
|
||
-- Test that the starting memory is visible to the resource group. | ||
1: set role test; | ||
1&: select count(*) from t1 where pg_sleep(1) is not null; | ||
|
||
2: select segment, mem.* from gp_toolkit.gp_resgroup_status, json_object_keys(memory_usage) | ||
as segment, json_to_record(memory_usage -> segment) mem (used int) where rsgname = 'test_group'; | ||
1<: | ||
1q: | ||
2q: | ||
|
||
-- The runaway detector test. A query with a large number of slices should | ||
-- be terminated due to high memory consumption. | ||
select count(*) from t1 a1 | ||
join t1 a2 using(a) | ||
join t1 a3 using(a) | ||
join t1 a4 using(a) | ||
join t1 a5 using(a) | ||
join t1 a6 using(a) | ||
join t1 a7 using(a) | ||
join t1 a8 using(a) | ||
join t1 a9 using(a) | ||
join t1 a10 using(a); | ||
|
||
drop table t1; | ||
reset role; | ||
drop role test; | ||
drop resource group test_group; | ||
-- start_ignore | ||
! gpconfig -c runaway_detector_activation_percent -v 100; | ||
! gpstop -rai; | ||
-- end_ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about removing this function and calling
ResGroupProcAddStartupChunks(-startupChunks)
instead ofResGroupProcSubStartupChunks(startupChunks)
or removing the chunks argument and using VmemTracker_GetStartupChunks()?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed.