Skip to content

Commit

Permalink
Merge pull request #18 from PickingUpPieces/feature/improve-benchmarks
Browse files Browse the repository at this point in the history
Update benchmark test config; Add recv/send buffer size to test config
  • Loading branch information
PickingUpPieces authored Mar 14, 2024
2 parents a877efc + dde8f48 commit 93bd707
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 30 deletions.
8 changes: 4 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"env": {
"RUST_LOG": "TRACE",
},
"args": ["client", "--with-msg", "--single-socket", "--parallel", "2"],
"args": ["client", "--with-msg"],
"cwd": "${workspaceFolder}",
"preLaunchTask": "delay"
},
Expand All @@ -44,7 +44,7 @@
"env": {
"RUST_LOG": "TRACE",
},
"args": ["server", "--with-msg", "--single-socket", "--parallel", "2"],
"args": ["server", "--with-msg"],
"cwd": "${workspaceFolder}"
},
{
Expand All @@ -55,7 +55,7 @@
"RUST_LOG": "INFO",
},
"program": "${workspaceFolder}/target/debug/nperf",
"args": ["client", "--with-msg", "--single-socket", "--parallel", "2"],
"args": ["client", "--with-msg", "--json"],
"cwd": "${workspaceFolder}",
"stopOnEntry": false,
"preLaunchTask": "delay"
Expand All @@ -68,7 +68,7 @@
"RUST_LOG": "INFO",
},
"program": "${workspaceFolder}/target/debug/nperf",
"args": ["server", "--with-msg", "--single-socket", "--parallel", "2"],
"args": ["server", "--with-msg", "--json"],
"cwd": "${workspaceFolder}",
"stopOnEntry": false,
},
Expand Down
10 changes: 6 additions & 4 deletions benchmarks/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
PATH_TO_RESULTS_FOLDER = 'results/'
PATH_TO_NPERF_REPO = '/home_stud/picking/repos/nperf'
#PATH_TO_NPERF_REPO = '/opt/nperf'
#PATH_TO_NPERF_REPO = '/home_stud/picking/repos/nperf'
PATH_TO_NPERF_REPO = '/opt/nperf'
PATH_TO_NPERF_BIN = PATH_TO_NPERF_REPO + '/target/release/nperf'

def parse_config_file(json_file_path):
Expand Down Expand Up @@ -122,7 +122,7 @@ def run_test(run_config):

def write_results_to_csv(test_results, test_name, csv_file_path):
# FIXME: If new measurement parameters are added, the header should be updated
header = ['test_name', 'run_number', 'run_name', 'amount_threads_client', 'amount_threads_server', 'amount_used_ports_server', 'test_runtime_length', 'datagram_size', 'packet_buffer_size', 'exchange_function', 'io_model', 'total_data_gbyte', 'amount_datagrams', 'amount_data_bytes', 'amount_reordered_datagrams', 'amount_duplicated_datagrams', 'amount_omitted_datagrams', 'amount_syscalls', 'amount_io_model_syscalls', 'data_rate_gbit', 'packet_loss', 'nonblocking', 'ip_fragmentation', 'gso', 'gro', 'single-socket']
header = ['test_name', 'run_number', 'run_name', 'amount_threads_client', 'amount_threads_server', 'amount_used_ports_server', 'test_runtime_length', 'datagram_size', 'packet_buffer_size', 'exchange_function', 'io_model', 'total_data_gbyte', 'amount_datagrams', 'amount_data_bytes', 'amount_reordered_datagrams', 'amount_duplicated_datagrams', 'amount_omitted_datagrams', 'amount_syscalls', 'amount_io_model_syscalls', 'data_rate_gbit', 'packet_loss', 'nonblocking', 'ip_fragmentation', 'gso', 'gro', 'single-socket', 'receive_buffer_size', 'send_buffer_size']
file_exists = os.path.isfile(csv_file_path)

with open(csv_file_path, 'a', newline='') as csvfile:
Expand Down Expand Up @@ -163,7 +163,9 @@ def write_results_to_csv(test_results, test_name, csv_file_path):
'ip_fragmentation': client_result['parameter']['socket_options']['ip_fragmentation'],
'gso': client_result['parameter']['socket_options']['gso'],
'gro': server_result['parameter']['socket_options']['gro'],
'single-socket': server_result['parameter']['single_socket']
'single-socket': server_result['parameter']['single_socket'],
'receive_buffer_size': server_result['parameter']['socket_options']['recv_buffer_size'],
'send_buffer_size': server_result['parameter']['socket_options']['send_buffer_size']
}
writer.writerow(row)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"parameters": {
"repetitions": 7,
"repetitions": 2,
"ip": "0.0.0.0"
},
"test-debug": {
Expand All @@ -9,10 +9,9 @@
"port": 45001,
"datagram-size": 1472,
"time": 2,
"with-gso": true,
"with-gsro": true,
"with-gso-buffer": 65507,
"with-mss": 1472,
"with-gro": false,
"with-ip-frag": false,
"with-msg": false,
"with-mmsg": false,
Expand All @@ -25,10 +24,9 @@
"port": 45001,
"datagram-size": 1472,
"time": 3,
"with-gso": false,
"with-gsro": true,
"with-gso-buffer": 65507,
"with-mss": 1472,
"with-gro": true,
"with-ip-frag": false,
"with-msg": false,
"with-mmsg": false,
Expand All @@ -44,10 +42,9 @@
"port": 45001,
"datagram-size": 1472,
"time": 2,
"with-gso": false,
"with-gso-buffer": 65507,
"with-mss": 1472,
"with-gro": false,
"with-gsro": false,
"with-ip-frag": false,
"with-msg": true,
"with-mmsg": false,
Expand All @@ -60,10 +57,9 @@
"port": 45001,
"datagram-size": 1472,
"time": 3,
"with-gso": false,
"with-gsro": false,
"with-gso-buffer": 65507,
"with-mss": 1472,
"with-gro": false,
"with-ip-frag": false,
"with-msg": true,
"with-mmsg": false,
Expand All @@ -81,10 +77,9 @@
"port": 45001,
"datagram-size": 1472,
"time": 2,
"with-gso": true,
"with-gsro": true,
"with-gso-buffer": 65507,
"with-mss": 1472,
"with-gro": false,
"with-ip-frag": false,
"with-msg": false,
"with-mmsg": false,
Expand All @@ -97,10 +92,9 @@
"port": 45001,
"datagram-size": 1472,
"time": 3,
"with-gso": false,
"with-gsro": true,
"with-gso-buffer": 65507,
"with-mss": 1472,
"with-gro": true,
"with-ip-frag": false,
"with-msg": false,
"with-mmsg": false,
Expand All @@ -116,10 +110,9 @@
"port": 45001,
"datagram-size": 1472,
"time": 2,
"with-gso": false,
"with-gsro": false,
"with-gso-buffer": 65507,
"with-mss": 1472,
"with-gro": false,
"with-ip-frag": false,
"with-msg": true,
"with-mmsg": false,
Expand All @@ -132,10 +125,9 @@
"port": 45001,
"datagram-size": 1472,
"time": 3,
"with-gso": false,
"with-gsro": false,
"with-gso-buffer": 65507,
"with-mss": 1472,
"with-gro": false,
"with-ip-frag": false,
"with-msg": true,
"with-mmsg": false,
Expand Down
6 changes: 3 additions & 3 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,11 @@ impl nPerf {
};

let (recv_buffer_size, send_buffer_size) = if self.with_socket_buffer {
info!("Setting udp buffer sizes with recv {} and send {}", crate::DEFAULT_SOCKET_RECEIVE_BUFFER_SIZE, crate::DEFAULT_SOCKET_SEND_BUFFER_SIZE);
(Some(crate::DEFAULT_SOCKET_RECEIVE_BUFFER_SIZE), Some(crate::DEFAULT_SOCKET_SEND_BUFFER_SIZE))
info!("Setting udp buffer sizes with recv {} and send {}", crate::MAX_SOCKET_RECEIVE_BUFFER_SIZE, crate::MAX_SOCKET_SEND_BUFFER_SIZE);
(Some(crate::MAX_SOCKET_RECEIVE_BUFFER_SIZE), Some(crate::MAX_SOCKET_SEND_BUFFER_SIZE))
} else {
info!("Setting buffer size of UDP socket disabled!");
(None, None)
(Some(crate::DEFAULT_SOCKET_RECEIVE_BUFFER_SIZE), Some(crate::DEFAULT_SOCKET_SEND_BUFFER_SIZE))
};

let gro = mode == util::NPerfMode::Server && self.with_gsro;
Expand Down
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ pub use util::statistic::Statistic;
const DEFAULT_MSS: u32= 1472;
const DEFAULT_UDP_DATAGRAM_SIZE: u32 = 1472;
const DEFAULT_GSO_BUFFER_SIZE: u32= 65507;
const DEFAULT_SOCKET_SEND_BUFFER_SIZE: u32 = 26214400; // 25MB; // The buffer size will be doubled by the kernel to account for overhead. See man 7 socket
const DEFAULT_SOCKET_RECEIVE_BUFFER_SIZE: u32 = 26214400; // 25MB; // The buffer size will be doubled by the kernel to account for overhead. See man 7 socket
const MAX_SOCKET_SEND_BUFFER_SIZE: u32 = 26214400; // 25MB; // The buffer size will be doubled by the kernel to account for overhead. See man 7 socket
const MAX_SOCKET_RECEIVE_BUFFER_SIZE: u32 = 212992 ; // 25MB; // The buffer size will be doubled by the kernel to account for overhead. See man 7 socket
const DEFAULT_SOCKET_SEND_BUFFER_SIZE: u32 = 212992;
const DEFAULT_SOCKET_RECEIVE_BUFFER_SIZE: u32 = 212992;
const DEFAULT_DURATION: u64 = 10; // /* seconds */
const DEFAULT_PORT: u16 = 45001;
const WAIT_CONTROL_MESSAGE: u64 = 200; // /* milliseconds */
Expand Down

0 comments on commit 93bd707

Please sign in to comment.