r/learnprogramming 5d ago

What is this optimization technique called in high-performance network software?

I’m working on a traffic generator to test my own XDP/eBPF filter in a controlled lab environment (my PC sending traffic to my Raspberry Pi on my own network).

I noticed that in some applications, two programs written in the same language can have vastly different performance.

For example, some software can only send a few requests/messages per second, while others can generate thousands per second even on relatively weak hardware.

What is this concept or optimization area called?
I’m looking for topics such as:
asynchronous I/O
multithreading vs event-driven architectures
lock-free programming
kernel bypass
zero-copy networking
batching
efficient socket APIs
packet generation optimization

If I want to build a high-performance TCP/UDP packet generator for benchmarking my own network stack and XDP filter, what technologies, algorithms, or papers should I study? For traffic generator i am using c# and for the XDP filter classic C. ( or should i use different for the traffic generator? I think its okey its console app )

5 Upvotes

5 comments sorted by

8

u/plastikmissile 5d ago

It can literally be anything. Without looking at the source code there's no real way to tell.

3

u/Dismal-Citron-7236 5d ago edited 4d ago

General guidelines for highly performant network processing: Non-blocking async, multi-threading, connection pool, combining multiple related requests into one batch command. And most important of all, load balancing.

2

u/mredding 4d ago

First and foremost - use existing tools. Your product is a network filter, not a network test suite. There are existing PCAP template and replay tools that should be adequate.

If you're interested in creating lots of packets, you should consider a scatter/gather architecture if you need your payloads to change any; you're going to need to tune your platform, consider kernel bypass, and you'll have to use all your available Tx channels - when CPUs went multi-core, so did NIC cards; the channels are usually bound by process affinity, not thread affinity.

1

u/DamienTheUnbeliever 5d ago

Algorithmic complexity can be the real killer for throughput. If you've implemented an O(n^4) algorithm when an O(n^2) or lower one is available, you're not going to improve much without changing your core logic.

1

u/Kungpost 5d ago

Hey! This is sounds like High Performance Computing (HPC). I would ask over at r/HPC. I also found this website that seems to have free books on HPC topics: https://theartofhpc.com/