• X
    samples: bpf: Add sample BMC for Redis · 5d35ccfc
    Xu Kuohai 提交于
    Offering: HULK
    hulk inclusion
    category: feature
    bugzilla: N/A
    
    --------------------------------
    
    BMC is an in-kernel key-value cache implemented in BPF and proposed by
    paper [1]. The paper discussed BMC for memcached, obtaining at least
    6x performance speedup.
    
    This patch implements a sample BMC for Redis.
    
    See [2] for details on how to build samples/bpf.
    
    Output files:
     samples/bpf/bmctool
     samples/bpf/bmc/bpf.o
    
    Sample usage:
     bmctool prog load -p 6379 ./bmc/bpf.o  # load bmc bpf prog and attach it
                                            # to sockets with listen port 6379
    
     bmctool stat                           # dump bmc status
    
     bmctool prog unload                    # detach and unload bmc prog
    
    Tested with the following command:
    
     ./redis-benchmark -c 20 -r 1 -n 1000 -t get  -h 192.168.4.101 -d 102
    
    Without BMC:
      throughput summary: 41666.67 requests per second
      latency summary (msec):
              avg       min       p50       p95       p99       max
            0.441     0.176     0.415     0.631     1.455     1.815
    
    With BMC (100% HIT):
      throughput summary: 66666.67 requests per second
      latency summary (msec):
              avg       min       p50       p95       p99       max
            0.223     0.096     0.215     0.311     0.743     0.759
    
    BMC Stat:
     Total GET Requests: 1000
     Hit GET Requests: 1000 (100.00%)
     Dropped GET Requests: 0 (0.00%)
     Total SET Requests: 1
     Hit SET Requests: 1 (100.00%)
     Dropped SET Requests: 0 (0.00%)
    
    [1] https://www.usenix.org/conference/nsdi21/presentation/ghigoff
    [2] https://www.kernel.org/doc/readme/samples-bpf-README.rstSigned-off-by: NXu Kuohai <xukuohai@huawei.com>
    Signed-off-by: NYang Jihong <yangjihong@huawei.com>
    Signed-off-by: He Fengqing <hefengqing@huawei.com> (original demo)
    5d35ccfc
tool.c 15.3 KB