Commit 34a9c1d7 authored by Marvin Meiers's avatar Marvin Meiers Committed by Antoine Kaufmann
Browse files

experiments: add experiment for different congestion control algorithms

parent bb43ad9b
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
url = https://github.com/simbricks/qemu.git url = https://github.com/simbricks/qemu.git
[submodule "sims/external/ns-3"] [submodule "sims/external/ns-3"]
path = sims/external/ns-3 path = sims/external/ns-3
url = https://github.com/simbricks/ns-3.git url = https://github.com/marvin71/ns-3.git
[submodule "sims/external/femu"] [submodule "sims/external/femu"]
path = sims/external/femu path = sims/external/femu
url = https://github.com/simbricks/femu.git url = https://github.com/simbricks/femu.git
# Copyright 2021 Max Planck Institute for Software Systems, and
# National University of Singapore
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import simbricks.orchestration.experiments as exp
import simbricks.orchestration.nodeconfig as node
import simbricks.orchestration.simulators as sim
from simbricks.orchestration.simulator_utils import create_tcp_cong_hosts
# iperf TCP_multi_client test
# naming convention following host-nic-net-app
# host: qemu/gem5-timing
# nic: cv/cb/ib
# net: switch/dumbbell/bridge
# app: DCTCPm
#types_of_host = ['qemu', 'qt', 'gt', 'gO3']
types_of_host = ['gt']
#types_of_nic = ['cv', 'cb', 'ib']
types_of_nic = ['ib']
#types_of_net = ['dumbbell']
#types_of_app = ['DCTCPm']
#types_of_mtu = [1500, 4000, 9000]
types_of_mtu = [1500]
types_of_congestion_control = ['cubic']
num_pairs = 2
#max_k = 199680
#k_step = 16640
#k_step = 33280
link_rate_opt = '--LinkRate=200Mb/s'
link_latency_opt = '--LinkLatency=10ms'
bdp = 40000000 # Bandwidth-delay product in bytes
cpu_freq = '5GHz'
cpu_freq_qemu = '2GHz'
sys_clock = '1GHz' # if not set, default 1GHz
ip_start = '192.168.64.1'
experiments = []
# set network sim
NetClass = sim.NS3DumbbellNet
for congestion_control in types_of_congestion_control:
for mtu in types_of_mtu:
for host in types_of_host:
for nic in types_of_nic:
for k_val in range(0, 1 + 1):
queue_size = int(bdp * 2**k_val)
net = NetClass()
net.opt = ' '.join([
link_rate_opt,
link_latency_opt,
f'--QueueSize={queue_size}B'
])
e = exp.Experiment(
host + '-' + nic + '-' + 'dumbbell' + '-' +
congestion_control + 'TCPm' + f'{k_val}' + f'-{mtu}'
)
e.add_network(net)
freq = cpu_freq
# host
if host == 'qemu':
HostClass = sim.QemuHost
elif host == 'qt':
freq = cpu_freq_qemu
def qemu_timing(node_config: node.NodeConfig):
h = sim.QemuHost(node_config)
h.sync = True
return h
HostClass = qemu_timing
elif host == 'gt':
def gem5_timing(node_config: node.NodeConfig):
h = sim.Gem5Host(node_config)
#h.sys_clock = sys_clock
return h
HostClass = gem5_timing
e.checkpoint = True
elif host == 'gO3':
def gem5_o3(node_config: node.NodeConfig):
h = sim.Gem5Host(node_config)
h.cpu_type = 'DerivO3CPU'
h.sys_clock = sys_clock
return h
HostClass = gem5_o3
e.checkpoint = True
else:
raise NameError(host)
# nic
if nic == 'ib':
NicClass = sim.I40eNIC
NcClass = node.I40eTCPCongNode
# elif nic == 'cb':
# NicClass = sim.CorundumBMNIC
# NcClass = node.CorundumDCTCPNode
# elif nic == 'cv':
# NicClass = sim.CorundumVerilatorNIC
# NcClass = node.CorundumDCTCPNode
else:
raise NameError(nic)
servers = create_tcp_cong_hosts(
e,
num_pairs,
'server',
net,
NicClass,
HostClass,
NcClass,
node.TcpCongServer,
freq,
mtu,
congestion_control
)
clients = create_tcp_cong_hosts(
e,
num_pairs,
'client',
net,
NicClass,
HostClass,
NcClass,
node.TcpCongClient,
freq,
mtu,
congestion_control,
ip_start=num_pairs + 1
)
i = 0
for cl in clients:
cl.node_config.app.server_ip = servers[i].node_config.ip
i += 1
# All the clients will not poweroff after finishing iperf
# test except the last one This is to prevent the simulation
# gets stuck when one of host exits.
# The last client waits for the output printed in other
# hosts, then cleanup
clients[num_pairs - 1].node_config.app.is_last = True
clients[num_pairs - 1].wait = True
print(e.name)
experiments.append(e)
...@@ -90,6 +90,8 @@ class NodeConfig(): ...@@ -90,6 +90,8 @@ class NodeConfig():
"""Name of disk image to use or absolute path to image.""" """Name of disk image to use or absolute path to image."""
self.mtu = 1500 self.mtu = 1500
"""Networking MTU.""" """Networking MTU."""
self.tcp_congestion_control = 'bic'
"""TCP Congestion Control algorithm to use."""
self.nockp = 0 self.nockp = 0
"""Do not create a checkpoint in Gem5. """Do not create a checkpoint in Gem5.
...@@ -353,6 +355,36 @@ class I40eDCTCPNode(NodeConfig): ...@@ -353,6 +355,36 @@ class I40eDCTCPNode(NodeConfig):
] ]
class I40eTCPCongNode(NodeConfig):
def prepare_pre_cp(self):
return super().prepare_pre_cp() + [
'mount -t proc proc /proc',
'mount -t sysfs sysfs /sys',
# 'sysctl -w net.core.rmem_default=31457280',
# 'sysctl -w net.core.rmem_max=31457280',
# 'sysctl -w net.core.wmem_default=31457280',
# 'sysctl -w net.core.wmem_max=31457280',
# 'sysctl -w net.core.optmem_max=25165824',
# 'sysctl -w net.ipv4.tcp_mem="786432 1048576 26777216"',
# 'sysctl -w net.ipv4.tcp_rmem="8192 87380 33554432"',
# 'sysctl -w net.ipv4.tcp_wmem="8192 87380 33554432"',
'sysctl -w net.ipv4.tcp_congestion_control=' +
f'{self.tcp_congestion_control}',
'sysctl -w net.ipv4.tcp_ecn=0'
]
def prepare_post_cp(self):
return super().prepare_post_cp() + [
'modprobe i40e',
'ethtool -G eth0 rx 4096 tx 4096',
'ethtool -K eth0 tso off',
# 'ip link set eth0 txqueuelen 13888',
f'ip link set dev eth0 mtu {self.mtu} up',
f'ip addr add {self.ip}/{self.prefix} dev eth0',
]
class CorundumDCTCPNode(NodeConfig): class CorundumDCTCPNode(NodeConfig):
def prepare_pre_cp(self) -> tp.List[str]: def prepare_pre_cp(self) -> tp.List[str]:
...@@ -440,6 +472,34 @@ class DctcpClient(AppConfig): ...@@ -440,6 +472,34 @@ class DctcpClient(AppConfig):
] ]
class TcpCongServer(AppConfig):
def run_cmds(self, node):
return ['iperf -s -w 1M']
class TcpCongClient(AppConfig):
def __init__(self):
super().__init__()
self.server_ip = '192.168.64.1'
self.is_last = False
def run_cmds(self, node):
if self.is_last:
return [
'sleep 1',
f'iperf -w 1M -c {self.server_ip} -i 1',
'sleep 2',
]
else:
return [
'sleep 1',
f'iperf -w 1M -c {self.server_ip} -i 1',
'sleep 20',
]
class PingClient(AppConfig): class PingClient(AppConfig):
def __init__(self, server_ip: str = '192.168.64.1') -> None: def __init__(self, server_ip: str = '192.168.64.1') -> None:
......
...@@ -164,3 +164,50 @@ def create_dctcp_hosts( ...@@ -164,3 +164,50 @@ def create_dctcp_hosts(
hosts.append(host) hosts.append(host)
return hosts return hosts
def create_tcp_cong_hosts(
e: Experiment,
num: int,
name_prefix: str,
net: NetSim,
nic_class: tp.Type[NICSim],
host_class: tp.Type[HostSim],
nc_class: tp.Type[NodeConfig],
app_class: tp.Type[AppConfig],
cpu_freq: str,
mtu: int,
congestion_control: str,
ip_start: int = 1
):
"""
Creates and configures multiple hosts to be simulated in a TCP congestion
control experiment using the given parameters.
Args:
num: number of hosts to create
cpu_freq: CPU frequency to simulate, e.g. '5GHz'
"""
hosts = []
for i in range(0, num):
nic = nic_class()
#nic.name = '%s.%d' % (name_prefix, i)
nic.set_network(net)
node_config = nc_class()
node_config.mtu = mtu
node_config.tcp_congestion_control = congestion_control
node_config.ip = f'192.168.64.{ip_start + i}'
node_config.app = app_class()
host = host_class(node_config)
host.name = f'{name_prefix}.{i}'
host.cpu_freq = cpu_freq
host.add_nic(nic)
e.add_nic(nic)
e.add_host(host)
hosts.append(host)
return hosts
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment