Commit 031efdeb authored by Antoine Kaufmann's avatar Antoine Kaufmann Committed by Hejing Li
Browse files

experiments: add ns-3 homa experiment

parent d031a52f
# Copyright 2023 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 random
import simbricks.orchestration.experiments as exp
import simbricks.orchestration.nodeconfig as node
import simbricks.orchestration.simulators as sim
import simbricks.orchestration.e2e_components as e2e
from simbricks.orchestration.simulator_utils import create_tcp_cong_hosts
from simbricks.orchestration.e2e_topologies import (
DCFatTree, add_homa_bg
)
random.seed(42)
e = exp.Experiment('e2e_bg_homa')
options = {
'ns3::TcpSocket::SegmentSize': '1448',
'ns3::TcpSocket::SndBufSize': '524288',
'ns3::TcpSocket::RcvBufSize': '524288',
'ns3::Ipv4GlobalRouting::RandomEcmpRouting': '1',
}
topology = DCFatTree(
n_spine_sw=1,
n_agg_bl=1,
n_agg_sw=1,
n_agg_racks=2,
h_per_rack=1,
)
add_homa_bg(topology, app_proto='ns3::HomaSocketFactory')
net = sim.NS3E2ENet()
net.opt = ' '.join([f'--{o[0]}={o[1]}' for o in options.items()])
net.add_component(topology)
net.wait = True
net.init_network()
e.add_network(net)
experiments = [e]
......@@ -358,6 +358,34 @@ class E2EBulkSendApplication(E2EApplication):
})
return super().ns3_config()
class E2EMsgGenApplication(E2EApplication):
def __init__(self, idd: str) -> None:
super().__init__(idd)
self.type = "MsgGenerator"
self.port = 3000
self.remotes = []
self.cdf = {0.5: 1, 1.0: 2}
self.max_msg = 0
self.load = 0.5
self.avg_msg_size_pkts = 1.0
def ns3_config(self) -> str:
els = [f'{{{p},{i}}}' for p,i in self.cdf.items()]
cdf = '+'.join(els)
print(cdf)
self.mapping.update({
"Port": self.port,
"RemoteClients": ','.join(self.remotes),
"MsgSizeCDF": cdf,
"MaxMsg": self.max_msg,
"Load": self.load,
"AvgMsgSizePkts": self.avg_msg_size_pkts,
})
return super().ns3_config()
class E2EProbe(E2EComponent):
......
......@@ -319,3 +319,39 @@ def add_contig_bg(topo, subnet='10.42.0.0/16', **kwargs):
c_host.add_component(c_app)
topo.add_host_r(c_host)
def add_homa_bg(topo, subnet='10.42.0.0/16', **kwargs):
params = {
'link_rate': '5Gbps',
'link_delay': '1us',
'link_queue_size': '512KB',
'app_stop_time': '60s',
}
for (k,v) in kwargs.items():
params[k] = v
n = topo.capacity()
ipn = ipaddress.ip_network(subnet)
prefix = f'/{ipn.prefixlen}'
ip_pool = ipn.hosts()
ips = [str(next(ip_pool)) for i in range(0,n)]
remotes = [f'{ip}:3000' for ip in ips]
for i in range(0, n):
ip = ips[i]
s_host = e2e.E2ESimpleNs3Host(f'bg_h-{i}')
s_host.delay = params['link_delay']
s_host.data_rate = params['link_rate']
s_host.ip = ip + prefix
s_host.queue_size = params['link_queue_size']
s_app = e2e.E2EMsgGenApplication('msggen')
s_app.stop_time = params['app_stop_time']
s_app.remotes = remotes
s_host.add_component(s_app)
#s_probe = e2e.E2EPeriodicSampleProbe('probe', 'Rx')
#s_probe.interval = '100ms'
#s_probe.file = f'sink-rx-{i}'
#s_app.add_component(s_probe)
topo.add_host_r(s_host)
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