bridge + tapとmacvtapの比較
macvtapはbridge + tapより軽くて速いんだと説明されている事があるが、本当かよと思ってちょっと比較してみた。
rx_handler実行にかかる所要時間
__netif_receive_skbで呼ばれるrx_handlerの処理(bridgeだとbr_handle_frame〜wake_up_interruptible_poll、macvtapだとmacvlan_handle_frame〜wake_up_interruptible_poll)にかかる所要時間をsystemtapで測ってみた。
bridge_time.stp
global time probe module("bridge").function("br_handle_frame").call { time[cpu()] = gettimeofday_ns(); } probe module("bridge").function("br_handle_frame").return { if ($return == 0) printf("%d\n", gettimeofday_ns() - time[cpu()]);
macvtap_time.stp
global time probe module("macvlan").function("macvlan_handle_frame").call { time[cpu()] = gettimeofday_ns(); } probe module("macvlan").function("macvlan_handle_frame").return { if ($return == 0) printf("%d\n", gettimeofday_ns() - time[cpu()]); }