Skip to content

Commit 0cea992

Browse files
red1452avamingli
authored andcommitted
gpcheckperf: add buffer size parameter (#14848)
* gpcheckperf: add buffer size parameter (#14848) Before this patch, while running gpcheckperf utility the buffer was set by default for the underlying gpnetbenchClient utility as 32Kb. It led to problem with receiving annoying and misleading warnings about connections between hosts. Use '--buffer-size' flag with size in kilobytes to set buffer size, which will be used at gpnetbenchClient. It is an optional parameter. The default value is 8Kb.
1 parent e82142d commit 0cea992

File tree

3 files changed

+43
-5
lines changed

3 files changed

+43
-5
lines changed

gpMgmt/bin/gpcheckperf

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Usage: gpcheckperf <options>
2929
-f file : a file listing all hosts to connect to
3030
--duration : how long to run network test (default 5 seconds)
3131
--netperf : use netperf instead of gpnetbenchServer/gpnetbenchClient
32+
--buffer-size : the size of the send buffer in kilobytes ( default 8 kilobytes)
3233
"""
3334

3435
import datetime
@@ -68,7 +69,7 @@ class Global():
6869
opt = {'-d': [], '-D': False, '-v': False, '-V': False, '-r': '',
6970
'-B': 1024 * 32, '-S': 0, '-h': [], '-f': None,
7071
'--duration': 15, '--net': None, '--netserver': 'gpnetbenchServer',
71-
'--netclient': 'gpnetbenchClient'}
72+
'--netclient': 'gpnetbenchClient', '--buffer-size': 0}
7273

7374

7475
GV = Global()
@@ -203,7 +204,7 @@ def print_version():
203204

204205
def parseCommandLine():
205206
try:
206-
(options, args) = getopt.getopt(sys.argv[1:], '?vVDd:r:B:S:p:h:f:', ['duration=', 'version', 'netperf'])
207+
(options, args) = getopt.getopt(sys.argv[1:], '?vVDd:r:B:S:p:h:f:', ['duration=', 'version', 'netperf', 'buffer-size='])
207208
except Exception as e:
208209
usage('Error: ' + str(e))
209210
exit(1)
@@ -226,6 +227,8 @@ def parseCommandLine():
226227
elif switch == '--netperf':
227228
GV.opt['--netserver'] = 'netserver'
228229
GV.opt['--netclient'] = 'netperf'
230+
elif switch == '--buffer-size':
231+
GV.opt[switch] = int(val)
229232

230233
# run default tests (if not specified)
231234
if GV.opt['-r'] == '':
@@ -275,6 +278,14 @@ def parseCommandLine():
275278
GV.opt['--duration'] = 15
276279
print('[INFO] Invalid network duration specified. Using default (15 seconds)')
277280

281+
if GV.opt['--netclient'].find('netperf') >= 0:
282+
if GV.opt['--buffer-size']:
283+
print('[Warning] --buffer-size option will be ignored when the --netperf option is enabled')
284+
else:
285+
if GV.opt['--buffer-size'] <= 0:
286+
print('[INFO] --buffer-size value is not specified or invalid. Using default (8 kilobytes)')
287+
GV.opt['--buffer-size'] = 8
288+
278289
# strip the last '/' from the dir
279290
dd = []
280291
for d in GV.opt['-d']:
@@ -540,8 +551,9 @@ def spawnNetperfTestBetween(x, y, netperf_path, netserver_port, sec=5):
540551
cmd = ('%s -H %s -p %d -t TCP_STREAM -l %s -f M -P 0 '
541552
% (netperf_path, y, netserver_port, sec))
542553
else:
543-
cmd = ('%s -H %s -p %d -l %s -P 0 '
544-
% (netperf_path, y, netserver_port, sec))
554+
cmd = ('%s -H %s -p %d -l %s -P 0 -b %s'
555+
% (netperf_path, y, netserver_port, sec, GV.opt['--buffer-size']))
556+
545557
c = ['ssh', '-o', 'BatchMode yes',
546558
'-o', 'StrictHostKeyChecking no',
547559
x, cmd]

gpMgmt/doc/gpcheckperf_help

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ gpcheckperf -d <test_directory> [-d <test_directory> ...]
1313

1414
gpcheckperf -d <temp_directory>
1515
{-f <hostfile_gpchecknet> | -h <hostname> [-h <hostname> ...]}
16-
[ -r n|N|M [--duration <time>] [--netperf] ] [-D] [-v|-V]
16+
[ -r n|N|M [--duration <time>] [--netperf] ] [-D] [-v|-V] [--buffer-size <kbytes>]
1717

1818

1919
gpcheckperf -?
@@ -97,6 +97,11 @@ Specifies the block size (in KB or MB) to use for disk I/O test.
9797
The default is 32KB, which is the same as the Cloudberry Database
9898
page size. The maximum block size is 1 MB.
9999

100+
--buffersize <kbytes>
101+
102+
Specifies size of the send buffer in kilobytes, which is used by gpnetbenchClient.
103+
Default size is 8 kilobytes.
104+
100105

101106
-d <test_directory>
102107

gpMgmt/test/behave/mgmt_utils/gpcheckperf.feature

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,24 @@ Feature: Tests for gpcheckperf
7373
| matrix test | M |
7474
| network test| N |
7575

76+
@concourse_cluster
77+
Scenario: gpcheckperf runs sequential network test with buffer size flag
78+
Given the database is running
79+
When the user runs "gpcheckperf -h cdw -h sdw1 -d /data/gpdata/ -r n --buffer-size 8 -v"
80+
Then gpcheckperf should return a return code of 0
81+
And gpcheckperf should print "avg = " to stdout
82+
And gpcheckperf should print "gpnetbenchClient -H cdw -p 23000 -l 15 -P 0 -b 8" to stdout
83+
84+
@concourse_cluster
85+
Scenario: gpcheckperf runs sequential network test with buffer size flag and netperf option
86+
Given the database is running
87+
When the user runs "gpcheckperf -h cdw -h sdw1 -d /data/gpdata/ -r n --buffer-size 8 --netperf"
88+
Then gpcheckperf should print "--buffer-size option will be ignored when the --netperf option is enabled" to stdout
89+
90+
@concourse_cluster
91+
Scenario: gpcheckperf runs sequential network test without buffer size flag
92+
Given the database is running
93+
When the user runs "gpcheckperf -h cdw -h sdw1 -d /data/gpdata/ -r n"
94+
Then gpcheckperf should return a return code of 0
95+
And gpcheckperf should print "--buffer-size value is not specified or invalid. Using default \(8 kilobytes\)" to stdout
96+
And gpcheckperf should print "avg = " to stdout

0 commit comments

Comments
 (0)