Skip to content

yastack benchmark #8

@dragonorloong

Description

@dragonorloong

I don't know if there is a problem with my configuration. The performance of yastack is much worse than nginx

Traffic Path:

wrk -> envoy(f-stack) -> nginx
wrk -> nginx(linux kernel) -> nginx

Modify code, always use f-stack socket

diff --git a/ev/source/common/network/address_impl.cc b/ev/source/common/network/address_impl.cc
index a7db10f..96dfc2c 100644
--- a/ev/source/common/network/address_impl.cc
+++ b/ev/source/common/network/address_impl.cc
@@ -194,20 +194,9 @@ int64_t InstanceBase::socketFromSocketType(SocketType socketType) const {
       domain = AF_INET;
     }
     int64_t fd;
-    if (likely(provider_ == Envoy::Network::Address::SocketProvider::Fp)) {
-        // Take over only network sockets
-           // FP non-blocking socket
-        SET_FP_NON_BLOCKING(flags);
-        fd = ff_socket(domain, flags, 0);
-        SET_FP_SOCKET(fd);
-        // TODO: Do we need this?
-        //RELEASE_ASSERT(ff_fcntl(fd, F_SETFL, O_NONBLOCK) != -1, "");
-    } else {
-           // Linux non-blocking socket
-        SET_HOST_NON_BLOCKING(flags);
-        fd = ::socket(domain, flags, 0);
-        RELEASE_ASSERT(fcntl(fd, F_SETFL, O_NONBLOCK) != -1, "");
-    }
+    SET_FP_NON_BLOCKING(flags);
+    fd = ff_socket(domain, flags, 0);
+    SET_FP_SOCKET(fd);
     return fd;
   } else {
     ASSERT(type() == Type::Pipe);

envoy config file:

admin:
  access_log_path: /tmp/admin_access.log
  address:
    socket_address: { address: 0.0.0.0, port_value: 9995, provider: HOST }

static_resources:
  listeners:
  - name: listener_0
    address:
        socket_address: { address: 0.0.0.0, port_value: 10000, provider: FP}
    filter_chains:
      filters:
      - name: envoy.http_connection_manager
        config:
          stat_prefix: ingress_http
          codec_type: AUTO
          route_config:
            name: local_route
            virtual_hosts:
            - name: local_service
              domains: ["*"]
              routes:
              - match: { prefix: "/" }
                route: { cluster: service_local}
          http_filters:
          - name: envoy.router
  clusters:
  - name: service_local
    connect_timeout: 0.25s
    type: STATIC
    dns_lookup_family: V4_ONLY
    lb_policy: ROUND_ROBIN
    hosts: [ { socket_address: { address: 10.182.2.88, port_value: 8090, provider: FP}}]

f-stack config file:

[dpdk]
lcore_mask=1
channel=4
promiscuous=1
numa_on=1
tso=0
vlan_strip=1
port_list=0

[port0]
addr=10.182.2.69
netmask=255.255.252.0
broadcast=10.182.3.255
gateway=10.182.0.1
lcore_list=0

nginx use kernel network stack, config file:

worker_processes  1;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;
    keepalive_requests 1000000;
    upstream myupstream {
        server 10.182.2.88:8090;
        keepalive 100;
    }

    server {
        listen       9999 reuseport;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
                proxy_http_version 1.1;
                proxy_set_header Connection "";
                proxy_pass http://myupstream;
        }

test result:

  1. envoy
taskset -c  15-50 wrk -c 100 -d 2m -t20 'http://10.182.2.69:10000/' -H 'Connection: Keep-Alive'                                                                                                                                              
Running 2m test @ http://10.182.2.69:10000/
  20 threads and 100 connections


  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    11.61ms    7.77ms  40.59ms   67.28%
    Req/Sec   436.19     42.19   590.00     70.73%
  1042807 requests in 2.00m, 148.36MB read
Requests/sec:   8683.60
Transfer/sec:      1.24MB
  1. nginx
taskset -c  15-50 wrk -c 100 -d 2m -t30 'http://10.182.2.68:9999/' -H 'Connection: Keep-Alive'                                                                                                                                               
Running 2m test @ http://10.182.2.68:9999/
  30 threads and 100 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     2.41ms  192.00us  42.99ms   99.36%
    Req/Sec     1.25k    29.55     3.62k    81.31%
  4479077 requests in 2.00m, 627.92MB read
Requests/sec:  37306.43
Transfer/sec:      5.23MB

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions