CPU name : Intel(R) Xeon(R) CPU E5405 @ 2.00GHz
processor : 4
cpu MHz : 1995.021
IPC latency:
IPC TYPE: MessageSize: Average Latency:
unix socket 10K 9us
localhost tcp 10K 11us
pipe 10K 6us
remote TCP 10K 13us
IPC throughput:
IPC TYPE: MessageSize: Average throughput/msg: Average throughput/M:
unix socket 10K 183049 msg/s 14643 Mb/s
localhost tcp 10K 113901 msg/s 9112 Mb/s
pipe 10K 146724 msg/s 11737 Mb/s
測試代碼:
http://github.com/rigtorp/ipc-bench
想在linux下選擇一個IPC,主要傾向于unix socket,ipc-bench測試下來
感覺更有底了,10K資料傳輸9us的延時在大多數應用中都可以接受了,
這樣某些應用可以使用類似于Nginx的多程序模式,網絡層一個程序,
邏輯層多程序,而且可以跑腳本,既能利用同步編寫邏輯,有可發揮多核優勢