Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: golangci-lint
on:
push:
branches:
- master
- main
pull_request:
jobs:
golangci:
Expand Down
4 changes: 2 additions & 2 deletions example/echo-server/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ do
sudo cset shield --shield --pid $SRV_PID
sleep 1s

OUT=cargo run -q --manifest-path $2 --release -- --address "127.0.0.1:8080" --number $conn_cnt --duration 30 --length $msg_len
RPS=$(echo "${OUT}" | sed -n '/^Speed/ p' | sed -r 's|^([^.]+).*$|\1|; s|^[^0-9]*([0-9]+).*$|\1 |')
OUT=tcp-echo-benchmark --address "127.0.0.1:8080" --number $conn_cnt --duration 30 --length $msg_len
RPS=$(echo "${OUT}" | sed -n 's/Throughput: \([0-9]*\) request\/sec.*/\1/p')
RPS_SUM=$((RPS_SUM + RPS))

echo "attempt: $attempt, rps: $RPS "
Expand Down
12 changes: 6 additions & 6 deletions example/echo-server/benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ __Linux 5.7 or higher__
* Echo server is assigned a dedicated CPU with cset

## benchmark tool
* Rust echo bench: https://github.com/haraldh/rust_echo_bench
* `cargo run --release -- --address "localhost:8080" --number {number of clients} --duration 30 --length {msg size}`
* Rust echo bench: https://crates.io/crates/tcp-echo-benchmark
* `tcp-echo-benchmark --address "localhost:8080" --number {number of clients} --duration 30 --length {msg size}`
* 5 runs for each combination of 128 and 1024 bytes message size with 100, 500 and 1000 clients
* [bench.sh](#benchmark script) script using for benchmarking

# Results

| | c: 100 bytes: 128 | c: 50 bytes: 1024| c: 500 bytes: 128 | c: 500 bytes: 1024| c: 1000 bytes: 128 | c: 1000 bytes: 1024|
| | c: 100 bytes: 128 | c: 100 bytes: 1024| c: 500 bytes: 128 | c: 500 bytes: 1024| c: 1000 bytes: 128 | c: 1000 bytes: 1024|
|-------------------------------|-------------------|------------------|-------------------|-------------------|--------------------|--------------------|
| epoll echo-server | 160869 | 154727 | 153380 | 145018 | 149071 | 143961 |
| io_uring echo-server | 232376 | 223385 | 220271 | 212599 | 202515 | 187121 |
| io_uring-echo-server (C lang) | 242813 | 233604 | 220429 | 218261 | 205329 | 183582 |
| epoll echo-server | 267055 | 259730 | 276911 | 264069 | 274568 | 258904 |
| io_uring echo-server | 355931 | 310814 | 364609 | 364675 | 363552 | 303197 |
| io_uring-echo-server (C lang) | 379458 | 361902 | 386219 | 367076 | 382633 | 284460 |


### benchmark script
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//nolint

package main

import (
Expand Down Expand Up @@ -58,7 +60,7 @@ func main() {
if events[i].Fd == int32(sockFd) {
connFd, _, err := unix.Accept4(sockFd, unix.SOCK_NONBLOCK)
if err != nil {
log.Printf("Error accepting connection:", err)
log.Printf("Error accepting connection: %s", err)
continue
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//nolint

//go:build linux
// +build linux

Expand All @@ -7,10 +9,11 @@ import (
"errors"
"flag"
"fmt"
"github.com/godzie44/go-uring/uring"
"log"
"strconv"
"syscall"

"github.com/godzie44/go-uring/uring"
)

const MaxConns = 4096
Expand Down Expand Up @@ -62,7 +65,7 @@ func makeBuffers() [][]byte {

var buffs = makeBuffers()

func main() {
func main() { //nolint
flag.Parse()
port, _ := strconv.Atoi(flag.Arg(0))

Expand Down
Loading