changtimwu / changtimwu.github.com

Tim's testing/practice notes
7 stars 2 forks source link

high performance network #49

Open changtimwu opened 8 years ago

changtimwu commented 8 years ago

We make use of PF_RING in product and surveyed netmap. comparison

New studies are why-do-we-use-the-linux-kernels-tcp-stack. Then snabb draw my eye.

Intel dual 10G adaptor is about 10000 NTD.

changtimwu commented 8 years ago

Brilliant idea of pflua Pflua can load up the libpcap library and use it to compile a pflang expression to BPF. In any case, whether you start from raw BPF or from a pflang expression, the BPF is compiled directly to Lua source code, which LuaJIT can gnaw on as it pleases.

pflang -> BPF -> Lua source -> native code(by luajit)

Can this approach be applied to solidity ?

related works: https://github.com/ethereum/EIPs/issues/125 https://blog.ethereum.org/2014/02/09/why-not-just-use-x-an-instructive-example-from-bitcoin/

changtimwu commented 8 years ago

https://github.com/snabbco/snabb/blob/master/src/doc/getting-started.md can be a 10G tcp-replay and user space router/switch.

http://snabbco.github.io/#snabblab plenty of docs/apps. can be scapy alternative

changtimwu commented 8 years ago

http://lwn.net/Articles/691887/

changtimwu commented 8 years ago

Facebook's XDP seems a quite clever technique. 跟現有 kernel 相容, 利用 eBPF 過濾出想特別處理的 packet .

quite a lot docs it provides. https://github.com/iovisor/bpf-docs

很實用 ex. packet classifier https://github.com/iovisor/bpf-docs/blob/master/bpf_netdev_conference_2016Feb12_report.pdf

http://events.linuxfoundation.org/sites/events/files/slides/ebpf_on_the_mainframe_lcon_2015.pdf classic BPF (page 5 ~ page 23) 至少可以做到 JIT

http://man7.org/linux/man-pages/man8/tc-bpf.8.html classic BPF(aka) 也可以做到 cls_bpf

http://borkmann.ch/talks/2014_devconf.pdf pure cBPF doc

changtimwu commented 8 years ago

https://events.linuxfoundation.org/sites/events/files/slides/bpf_collabsummit_2015feb20.pdf

The BPF examples starts from kernel V3.19.
It adds SO_ATTACH_BPF series options, which largely extends the classic filter option SO_ATTACH_FILTER.

The helper functions supports load_ only

From kernel V4.1 it supports stores

OpenWRT mvebu bypassed V3.19. Can we manually merge the eBPF commit to V3.18

see bcc network session for more powerful usage.

changtimwu commented 8 years ago
changtimwu commented 8 years ago

great example of how to us xt_bpf(netfilter + bpf) which is applicable to cbpf.

changtimwu commented 8 years ago

http://lxr.free-electrons.com/source/Documentation/networking/packet_mmap.txt?v=3.18 Packet sockets work well together with Linux socket filters, thus you also might want to have a look at Documentation/networking/filter.txt

kernel 4.3 supports PACKET_FANOUT_EBPF and here is the original commit.

valuable fanout example

changtimwu commented 7 years ago

XDP overview https://www.iovisor.org/technology/xdp XDP makes lots of progress recently especially HW offloading. Note the how complicated of XDP forward and all the techniques involved like page per packet http://netdevconf.org/1.2/session.html?herbert-xdp-workshop

appears in kernel 4.8 and mlx4 is the only NIC it supports(Yes, XDP requires driver modification)

please take a look of the example programs xdp1_kern.c xdp1_user.c xdp2_kern.c