安装工具: apt-get install mbw
使用 mbw 1024 测试
VM ubuntu12.04 :
ldd --version
ldd (Ubuntu EGLIBC 2.15-0ubuntu10.14) 2.15
AVG Method: MEMCPY Elapsed: 0.17797 MiB: 1024.00000 Copy: 5753.646 MiB/s
AVG Method: DUMB Elapsed: 0.17991 MiB: 1024.00000 Copy: 5691.653 MiB/s
AVG Method: MCBLOCK Elapsed: 0.09243 MiB: 1024.00000 Copy: 11078.918 MiB/s
VM (CentOS 6.5):
ldd --version
ldd (GNU libc) 2.12
AVG Method: MEMCPY Elapsed: 0.37693 MiB: 1024.00000 Copy: 2716.670 MiB/s
AVG Method: DUMB Elapsed: 0.11355 MiB: 1024.00000 Copy: 9018.316 MiB/s
AVG Method: MCBLOCK Elapsed: 0.14531 MiB: 1024.00000 Copy: 7047.090 MiB/s
HV(Ubuntu16.04):
ldd --version
ldd (Ubuntu GLIBC 2.23-0ubuntu3) 2.23
AVG Method: MEMCPY Elapsed: 0.17625 MiB: 1024.00000 Copy: 5810.054 MiB/s
AVG Method: DUMB Elapsed: 0.11353 MiB: 1024.00000 Copy: 9019.476 MiB/s
AVG Method: MCBLOCK Elapsed: 0.16999 MiB: 1024.00000 Copy: 6023.887 MiB/s
结论: glibc memcpy() 在 2.12存性能问题
There was a change in memcpy() in glibc 2.12 that exposed several bugs for calling memcpy on overlapping buffers (http://lwn.net/Articles/414467/) and I believe the issue was caused by switching to a version of memcpy that operates backwards.
升级glibc版本方法: https://cnodejs.org/topic/56dc21f1502596633dc2c3dc