Client code to test the response time of parallel SSH or SFTP connections.
-
Install dependencies
For openEuler 22.03 or other similar distributions:
dnf install make gcc-c++ libssh2 libssh2-devel yaml-cpp yaml-cpp-devel
-
Check client configuration in
config.yaml
-
Build
make
-
Prepare temporary files
When the test includes downloading files (enableDownload set to
true
), generate related directories and files first. Please check the command inMakefile
before execute it.- For testing in local machine, execute
make prepare
in the server. - For testing remote machine, execute
make prepare
in both local and remote machines.
- For testing in local machine, execute
-
Run the test
./test
Class | Key | Description | Default Value |
---|---|---|---|
worker | numWorkers | the number of parallel threads to perform SFTP operations | 10 |
worker | workerRunSeconds | running time of each worker in seconds | 10 |
worker | workerNumRequests | total number of SSH requests to make for a worker. Set to -1 for no limit |
-1 |
ssh | ipaddr | IP Address of SFTP server, can be local machine | 127.0.0.1 |
ssh | port | port that the SFTP server listen to | 22 |
ssh | username | username for SSH connection to SFTP server | root |
ssh | password | password for SSH connection to SFTP server | password |
sftp | numSftpPerSsh | the number of sequential SFTP connections within a single SSH session | 1 |
sftp | enableDownload | whether to download files in each SFTP connection. If set to false , the worker simply establishs and closes SFTP connections |
false |
sftp | localTempfileDir | directory to store files downloaded by SFTP client. Should end with / |
/tmp/sftp/local/ |
sftp | remoteTempfileDir | directory to store files in SFTP server. Should end with / |
/tmp/sftp/remote/ |
cmd | numCmdPerSsh | the number of remote commands to execute within a single SSH session | 0 |
cmd | command | the command to be executed | echo ABC |
cmd | renderOutput | whether to render remote output in local stdout. Notice the multi-threaded rendering is not guaranteed thread-safe | false |
For performance testing, use internal-sftp
as SFTP implementation.
In /etc/ssh/sshd_config
, change the below line:
Subsystem sftp /usr/libexec/openssh/sftp-server
to:
Subsystem sftp internal-sftp
For concurrent test using multiple threads, to avoid probabilistic connect rejection, change the below line:
MaxStartups 10:30:100
to
MaxStartups 500:30:1000
Then, restart sshd service.
systemctl restart sshd