Added a test for network throttler

This commit is contained in:
Alexey Milovidov 2020-05-29 22:44:24 +03:00
parent 6ec9287925
commit 1732888d98
2 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,2 @@
0
1

View File

@ -0,0 +1,15 @@
-- Limit to 10 MB/sec
SET max_network_bandwidth = 10000000;
-- Lower max_block_size, so we can start throttling sooner. Otherwise query will be executed too quickly.
SET max_block_size = 100;
CREATE TEMPORARY TABLE times (t DateTime);
-- rand64 is uncompressable data. Each number will take 8 bytes of bandwidth.
-- This query should execute in no less than 1.6 seconds if throttled.
INSERT INTO times SELECT now();
SELECT sum(ignore(*)) FROM (SELECT rand64() FROM remote('127.0.0.{2,3}', numbers(2000000)));
INSERT INTO times SELECT now();
SELECT max(t) - min(t) >= 1 FROM times;