Merge pull request #52821 from ClickHouse/improve-throttling-tests

Do not test upper bounds for throttlers
This commit is contained in:
Alexey Milovidov 2023-08-12 03:24:00 +03:00 committed by GitHub
commit 6fbf9b5eb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -117,7 +117,8 @@ def assert_took(took, should_took):
# we need to decrease the lower limit because the server limits could
# be enforced by throttling some server background IO instead of query IO
# and we have no control over it
assert took >= should_took[0] * 0.85 and took < should_took[1]
# Note that throttler does not apply any restrictions on upper bound, so we can only tell how much time required "at least", not "at most"
assert took >= should_took * 0.85
@pytest.mark.parametrize(
@ -132,7 +133,7 @@ def assert_took(took, should_took):
None,
None,
None,
(0, 3),
0,
id="no_local_throttling",
),
# reading 1e6*8 bytes with 1M default bandwith should take (8-1)/1=7 seconds
@ -142,7 +143,7 @@ def assert_took(took, should_took):
"user",
"max_backup_bandwidth",
"1M",
(7, 14),
7,
id="user_local_throttling",
),
# reading 1e6*8 bytes with 2M default bandwith should take (8-2)/2=3 seconds
@ -152,7 +153,7 @@ def assert_took(took, should_took):
"server",
"max_backup_bandwidth_for_server",
"2M",
(3, 7),
3,
id="server_local_throttling",
),
#
@ -164,7 +165,7 @@ def assert_took(took, should_took):
None,
None,
None,
(0, 3),
0,
id="no_remote_to_local_throttling",
),
# reading 1e6*8 bytes with 1M default bandwith should take (8-1)/1=7 seconds
@ -174,7 +175,7 @@ def assert_took(took, should_took):
"user",
"max_backup_bandwidth",
"1M",
(7, 14),
7,
id="user_remote_to_local_throttling",
),
# reading 1e6*8 bytes with 2M default bandwith should take (8-2)/2=3 seconds
@ -184,7 +185,7 @@ def assert_took(took, should_took):
"server",
"max_backup_bandwidth_for_server",
"2M",
(3, 7),
3,
id="server_remote_to_local_throttling",
),
#
@ -196,7 +197,7 @@ def assert_took(took, should_took):
None,
None,
None,
(0, 3),
0,
id="no_remote_to_remote_throttling",
),
# No throttling for S3-to-S3, uses native copy
@ -206,7 +207,7 @@ def assert_took(took, should_took):
"user",
"max_backup_bandwidth",
"1M",
(0, 3),
0,
id="user_remote_to_remote_throttling",
),
# No throttling for S3-to-S3, uses native copy
@ -216,7 +217,7 @@ def assert_took(took, should_took):
"server",
"max_backup_bandwidth_for_server",
"2M",
(0, 3),
0,
id="server_remote_to_remote_throttling",
),
#
@ -233,7 +234,7 @@ def assert_took(took, should_took):
None,
None,
None,
(0, 3),
0,
id="no_local_to_remote_throttling",
),
# reading 1e6*8 bytes with 1M default bandwith should take (8-1)/1=7 seconds, but for S3Client it is 2x more
@ -243,7 +244,7 @@ def assert_took(took, should_took):
"user",
"max_backup_bandwidth",
"1M",
(7 * 3, 7 * 4 - 1),
7 * 3,
id="user_local_to_remote_throttling",
),
# reading 1e6*8 bytes with 2M default bandwith should take (8-2)/2=3 seconds, but for S3Client it is 2x more
@ -253,7 +254,7 @@ def assert_took(took, should_took):
"server",
"max_backup_bandwidth_for_server",
"2M",
(3 * 3, 3 * 5),
3 * 3,
id="server_local_to_remote_throttling",
),
],
@ -290,7 +291,7 @@ def test_backup_throttling_override():
},
)
# reading 1e6*8 bytes with 500Ki default bandwith should take (8-0.5)/0.5=15 seconds
assert_took(took, (15, 20))
assert_took(took, 15)
@pytest.mark.parametrize(
@ -299,14 +300,14 @@ def test_backup_throttling_override():
#
# Local
#
pytest.param("default", None, None, None, (0, 3), id="no_local_throttling"),
pytest.param("default", None, None, None, 0, id="no_local_throttling"),
# reading 1e6*8 bytes with 1M default bandwith should take (8-1)/1=7 seconds
pytest.param(
"default",
"user",
"max_local_read_bandwidth",
"1M",
(7, 14),
7,
id="user_local_throttling",
),
# reading 1e6*8 bytes with 2M default bandwith should take (8-2)/2=3 seconds
@ -315,20 +316,20 @@ def test_backup_throttling_override():
"server",
"max_local_read_bandwidth_for_server",
"2M",
(3, 7),
3,
id="server_local_throttling",
),
#
# Remote
#
pytest.param("s3", None, None, None, (0, 3), id="no_remote_throttling"),
pytest.param("s3", None, None, None, 0, id="no_remote_throttling"),
# reading 1e6*8 bytes with 1M default bandwith should take (8-1)/1=7 seconds
pytest.param(
"s3",
"user",
"max_remote_read_network_bandwidth",
"1M",
(7, 14),
7,
id="user_remote_throttling",
),
# reading 1e6*8 bytes with 2M default bandwith should take (8-2)/2=3 seconds
@ -337,7 +338,7 @@ def test_backup_throttling_override():
"server",
"max_remote_read_network_bandwidth_for_server",
"2M",
(3, 7),
3,
id="server_remote_throttling",
),
],
@ -361,14 +362,14 @@ def test_read_throttling(policy, mode, setting, value, should_took):
#
# Local
#
pytest.param("default", None, None, None, (0, 3), id="no_local_throttling"),
pytest.param("default", None, None, None, 0, id="no_local_throttling"),
# reading 1e6*8 bytes with 1M default bandwith should take (8-1)/1=7 seconds
pytest.param(
"default",
"user",
"max_local_write_bandwidth",
"1M",
(7, 14),
7,
id="local_user_throttling",
),
# reading 1e6*8 bytes with 2M default bandwith should take (8-2)/2=3 seconds
@ -377,29 +378,29 @@ def test_read_throttling(policy, mode, setting, value, should_took):
"server",
"max_local_write_bandwidth_for_server",
"2M",
(3, 7),
3,
id="local_server_throttling",
),
#
# Remote
#
pytest.param("s3", None, None, None, (0, 3), id="no_remote_throttling"),
# writeing 1e6*8 bytes with 1M default bandwith should take (8-1)/1=7 seconds
pytest.param("s3", None, None, None, 0, id="no_remote_throttling"),
# writing 1e6*8 bytes with 1M default bandwith should take (8-1)/1=7 seconds
pytest.param(
"s3",
"user",
"max_remote_write_network_bandwidth",
"1M",
(7, 14),
7,
id="user_remote_throttling",
),
# writeing 1e6*8 bytes with 2M default bandwith should take (8-2)/2=3 seconds
# writing 1e6*8 bytes with 2M default bandwith should take (8-2)/2=3 seconds
pytest.param(
"s3",
"server",
"max_remote_write_network_bandwidth_for_server",
"2M",
(3, 7),
3,
id="server_remote_throttling",
),
],