F-Stack / f-stack

F-Stack is an user space network development kit with high performance based on DPDK, FreeBSD TCP/IP stack and coroutine API.
http://www.f-stack.org
Other
3.88k stars 899 forks source link

In the consumer mode Fstack has pool performance comparing to Linux socket #774

Open uvletter opened 1 year ago

uvletter commented 1 year ago

In the scene that a server only read data from client, the throughput of server based on Fstack is far less than Linux socket, the example code likes the below:

if (event.filter == EVFILT_READ) {
            char buf[4096];
            ssize_t readlen = ff_read(clientfd, buf, sizeof(buf));
}

the client likes this:

        conn, err := net.Dial("tcp", addr)
    panicIfNeed(err)

    buf := make([]byte, sz)
    for {
        n, err := conn.Write(buf)
        panicIfNeed(err)

        if n != len(buf) {
            panic("short write")
        }
    }
In 4KB payload model throughput(Byte/s)
Linux socket 1877778432
Fstack 672063488

If anyone has some ideas about it, thanks!

CodingLappen commented 1 year ago

Did you use two different machines? Do you actually use a SmartNIC or do run fstack in VM?

uvletter commented 1 year ago

nope, it's on the same physical machine. If you're interested, I would like to show the whole test code.

Message ID: @.***>

jfb8856606 commented 1 year ago

The default configuration is optimized for large concurrency. If you only test a single connection, you need to modify some parameter configurations, such as pkt_tx_delay, etc.

And you're better off testing on two different servers, I don't know how you design your tests on a single service.