Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: an improved router benchmark that only runs one router #4444

Merged
merged 44 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d90161d
router: The beginings of a new benchmark using an isolated router.
jiceatscion Nov 15, 2023
9d6e297
router: add a check for forwarded packets.
jiceatscion Nov 16, 2023
943d527
router: make sure brload terminates.
jiceatscion Nov 17, 2023
ef94d2b
router: new benchmark made to work.
jiceatscion Nov 17, 2023
15765c0
router: Enlarge the test to get more stable measurements.
jiceatscion Nov 17, 2023
2a67ef0
router: newbenchmark improvements
jiceatscion Nov 20, 2023
a1a379c
router: move br_load into new_benchmark.
jiceatscion Nov 21, 2023
c4ac941
router: mild improvements to the benchmark code.
jiceatscion Nov 21, 2023
e619296
router: cleanup newbenchmark.
jiceatscion Nov 21, 2023
45abaf2
router: improvements to newbenchmark.
jiceatscion Nov 22, 2023
f72f52e
router: comment fic in brload.
jiceatscion Nov 22, 2023
4bc839c
Merge branch 'scionproto:master' into router_newbenchmark
jiceatscion Nov 23, 2023
345ce20
router: remove leftover debug log.
jiceatscion Nov 23, 2023
3828d1d
router: satisfy linter.
jiceatscion Nov 23, 2023
7899630
router: fully revert dataplane.go to master's.
jiceatscion Nov 23, 2023
5e2fe0f
router: relax router_benchmark's timeout; it seems to have become a b…
jiceatscion Nov 23, 2023
e8a523a
router: Stop consuming forwarded packets while benchmarking.
jiceatscion Nov 23, 2023
e9b1093
router: 4 cores is just as good as 6 now that we don't consume packets.
jiceatscion Nov 23, 2023
171acad
router: bump br_transit CI's expectations.
jiceatscion Nov 23, 2023
f84224c
router: newbenchmark improvements.
jiceatscion Nov 23, 2023
7cf275e
router: do not build a private router image for the newbenchmark test.
jiceatscion Nov 24, 2023
165249e
router: prettify cmdline flag management (by some definition of pretty)
jiceatscion Nov 24, 2023
0ee2d30
router: dropped CS/DS from the topology of router_newbenchmark. Not n…
jiceatscion Nov 24, 2023
21a406b
router: reduce newbenchmark expectations a tiny bit after observing a…
jiceatscion Nov 24, 2023
40adc9e
router: slight cleanup of the newbenchmark test script.
jiceatscion Nov 27, 2023
55fd64b
router: Please lint and replace sudoA() with sudo().
jiceatscion Nov 27, 2023
0c746a8
router: implement reviewers suggestions and some more cleanup.
jiceatscion Nov 28, 2023
9a2e96e
router: fix failed formatting of prom query.
jiceatscion Nov 28, 2023
653d885
router: some minor improvements to router_newbenchmark.
jiceatscion Nov 28, 2023
06563d9
router: make the linter happy by exporting the entry points of topo.go
jiceatscion Nov 28, 2023
f1819fe
router: mild improvements to newbenchmark's test harness.
jiceatscion Nov 29, 2023
296e592
router: Small cleanup of the test harness.
jiceatscion Nov 30, 2023
d559086
router: added the remaining 3 newbenchmark traffic types cases.
jiceatscion Dec 1, 2023
f24dc46
router: Actually enable the new test cases. Somehow I hadn't submitte…
jiceatscion Dec 1, 2023
4166d27
router: Move brload into its own subdirectory.
jiceatscion Dec 4, 2023
a9ab27e
router: make it more obvious how we construct public IPs.
jiceatscion Dec 4, 2023
7b25bf4
router: unexport interfaceName. It's used only locally.
jiceatscion Dec 4, 2023
9cf8262
router: Reviwer's suggestions
jiceatscion Dec 4, 2023
21f6013
router: change go version dependency to 1.21 (so the linter doesn't c…
jiceatscion Dec 5, 2023
f3e7e89
router: remove type conversions around use of max().
jiceatscion Dec 6, 2023
d6b4764
router: update CI's expectations of the newbenchmark results.
jiceatscion Dec 6, 2023
e2265ab
Merge branch 'master' into router_newbenchmark
matzf Dec 7, 2023
149076c
Merge branch 'master' into router_newbenchmark
matzf Dec 7, 2023
48d285f
Merge branch 'master' into router_newbenchmark
matzf Dec 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion acceptance/common/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def assert_no_networks(writer=None):
writer.write("Docker networking assertions are OFF\n")
return

allowed_nets = ['bridge', 'host', 'none']
allowed_nets = ['bridge', 'host', 'none', 'benchmark']
unexpected_nets = []
for net in _get_networks():
if net.name not in allowed_nets:
Expand Down
2 changes: 1 addition & 1 deletion acceptance/router_benchmark/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def _run(self):
"-name", "router_benchmark",
"-cmd", "./bin/end2endblast",
"-attempts", 1500000,
"-timeout", "120s", # Timeout is for all attempts together
"-timeout", "180s", # Timeout is for all attempts together
"-parallelism", 100,
"-subset", "noncore#core#remoteISD"
].run_tee()
Expand Down
63 changes: 63 additions & 0 deletions acceptance/router_newbenchmark/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary")
load("@io_bazel_rules_docker//container:container.bzl", "container_image")
load("//acceptance/common:raw.bzl", "raw_test")
load("//tools/lint:go.bzl", "go_library")
load("//:scion.bzl", "scion_go_binary")

go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/scionproto/scion/acceptance/router_newbenchmark",
visibility = ["//visibility:private"],
deps = [
"//acceptance/router_newbenchmark/cases:go_default_library",
"//pkg/log:go_default_library",
"//pkg/private/serrors:go_default_library",
"//pkg/scrypto:go_default_library",
"//pkg/slayers:go_default_library",
"//private/keyconf:go_default_library",
"@com_github_google_gopacket//:go_default_library",
"@com_github_google_gopacket//afpacket:go_default_library",
"@com_github_google_gopacket//layers:go_default_library",
"@com_github_spf13_cobra//:go_default_library",
],
)

scion_go_binary(
name = "brload",
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)

exports_files([
"conf",
"test.py",
])

args = [
"--executable",
"brload:$(location //acceptance/router_newbenchmark:brload)",
"--container-loader=posix-router:latest#$(location //docker:posix_router)",
]

data = [
":conf",
"//docker:posix_router",
":brload",
]

raw_test(
name = "test",
src = "test.py",
args = args,
data = data,
homedir = "$(rootpath //docker:posix_router)",
# This test uses sudo and accesses /var/run/netns.
local = True,
)

go_binary(
name = "router_newbenchmark",
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)
25 changes: 25 additions & 0 deletions acceptance/router_newbenchmark/cases/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
load("//tools/lint:go.bzl", "go_library")

go_library(
name = "go_default_library",
srcs = [
"in.go",
"out.go",
"in_transit.go",
"out_transit.go",
"br_transit.go",
"topo.go",
],
importpath = "github.com/scionproto/scion/acceptance/router_newbenchmark/cases",
visibility = ["//acceptance/router_newbenchmark:__pkg__"],
deps = [
"//pkg/addr:go_default_library",
"//pkg/private/util:go_default_library",
"//pkg/private/xtest:go_default_library",
"//pkg/slayers:go_default_library",
"//pkg/slayers/path:go_default_library",
"//pkg/slayers/path/scion:go_default_library",
"@com_github_google_gopacket//:go_default_library",
"@com_github_google_gopacket//layers:go_default_library",
],
)
168 changes: 168 additions & 0 deletions acceptance/router_newbenchmark/cases/br_transit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
// Copyright 2023 SCION Association
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package cases

import (
"hash"
"time"

"github.com/google/gopacket"
"github.com/google/gopacket/layers"

"github.com/scionproto/scion/pkg/private/util"
"github.com/scionproto/scion/pkg/slayers"
"github.com/scionproto/scion/pkg/slayers/path"
"github.com/scionproto/scion/pkg/slayers/path/scion"
)

// Topology (see accept/router_newbenchmark/conf/topology.json)
// AS2 (br2) ---+== (br1a) AS1 (br1b) ---- (br4) AS4
// |
// AS3 (br3) ---+
// See topo.go

// oneBrTransit generates one packet of "br_transit" traffic over the router under test.
// The outcome is a raw packet which the test must feed to the router.
func oneBrTransit(payload string, mac hash.Hash, flowId uint32) []byte {

var (
originIA = ISDAS(2)
originIP = PublicIP(2, 1)
originHost = HostAddr(originIP)
srcIP, srcPort = PublicIPPort(2, 1)
srcMAC = MACAddr(srcIP)
dstIP, dstPort = PublicIPPort(1, 2)
dstMAC = MACAddr(dstIP)
targetIA = ISDAS(3)
targetIP = PublicIP(3, 1)
targetHost = HostAddr(targetIP)
)

options := gopacket.SerializeOptions{
FixLengths: true,
ComputeChecksums: true,
}

// Point-to-point.
ethernet := &layers.Ethernet{
SrcMAC: srcMAC,
DstMAC: dstMAC,
EthernetType: layers.EthernetTypeIPv4,
}

// Point-to-point. This is the real IP: the underlay network.
ip := &layers.IPv4{
Version: 4,
IHL: 5,
TTL: 64,
SrcIP: srcIP.AsSlice(),
DstIP: dstIP.AsSlice(),
Protocol: layers.IPProtocolUDP,
Flags: layers.IPv4DontFragment,
}
udp := &layers.UDP{
SrcPort: srcPort,
DstPort: dstPort,
}
_ = udp.SetNetworkLayerForChecksum(ip)

// Fully correct (hopefully) path.
sp := &scion.Decoded{
Base: scion.Base{
PathMeta: scion.MetaHdr{
CurrHF: 1,
SegLen: [3]uint8{2, 2, 0},
},
NumINF: 2,
NumHops: 4,
},
InfoFields: []path.InfoField{
{
SegID: 0x111,
Timestamp: util.TimeToSecs(time.Now()),
ConsDir: false,
},
{
SegID: 0x222,
Timestamp: util.TimeToSecs(time.Now()),
ConsDir: true,
},
},
HopFields: []path.HopField{
{ConsIngress: 22, ConsEgress: 0}, // From there (non-consdir)
{ConsIngress: 0, ConsEgress: 2}, // <- Processed here (non-consdir)
{ConsIngress: 0, ConsEgress: 3}, // Down via this
{ConsIngress: 33, ConsEgress: 0}, // To there
},
}

// Calculate MACs...
// Seg0: Hops are in non-consdir.
sp.HopFields[1].Mac = path.MAC(mac, sp.InfoFields[0], sp.HopFields[1], nil)
sp.InfoFields[0].UpdateSegID(sp.HopFields[1].Mac)
sp.HopFields[0].Mac = path.MAC(mac, sp.InfoFields[0], sp.HopFields[0], nil)

// Seg1: in the natural order.
sp.HopFields[2].Mac = path.MAC(mac, sp.InfoFields[1], sp.HopFields[2], nil)
sp.InfoFields[1].UpdateSegID(sp.HopFields[2].Mac) // tmp
sp.HopFields[3].Mac = path.MAC(mac, sp.InfoFields[1], sp.HopFields[2], nil)
sp.InfoFields[1].SegID = 0x222 // Restore to initial.

// End-to-end. Src is the originator and Dst is the final destination.
scionL := &slayers.SCION{
Version: 0,
TrafficClass: 0xb8,
FlowID: flowId,
NextHdr: slayers.L4UDP,
PathType: scion.PathType,
SrcIA: originIA,
DstIA: targetIA,
Path: sp,
}
if err := scionL.SetSrcAddr(originHost); err != nil {
panic(err)
}
if err := scionL.SetDstAddr(targetHost); err != nil {
panic(err)
}

scionudp := &slayers.UDP{}
scionudp.SrcPort = 50000
scionudp.DstPort = 50000
scionudp.SetNetworkLayerForChecksum(scionL)

payloadBytes := []byte(payload)

// Prepare input packet
input := gopacket.NewSerializeBuffer()
if err := gopacket.SerializeLayers(input, options,
ethernet, ip, udp, scionL, scionudp, gopacket.Payload(payloadBytes),
); err != nil {
panic(err)
}
return input.Bytes()
}

// BrTransit generates numDistinct packets (each with a unique flowID) with the given payload
// constructed to cause br_transit traffic at the br1a router.
// numDistrinct is a small number, only to enable multiple parallel streams. Each distinct packet
// is meant to be replayed a large number of times for performance measurement.
func BrTransit(payload string, mac hash.Hash, numDistinct int) (string, string, [][]byte) {
packets := make([][]byte, numDistinct)
for i := 0; i < numDistinct; i++ {
packets[i] = oneBrTransit(payload, mac, uint32(i+1))
}
return DeviceName(1, 2), DeviceName(1, 3), packets
}
Loading
Loading