Performance of sockets vs pipes

后端 未结 3 362
醉话见心
醉话见心 2021-01-12 21:08

I have a Java-program which communicates with a C++ program using a socket on localhost. Can I expect to gain any performance (either latency, bandwidth, or both) by moving

3条回答
  •  礼貌的吻别
    2021-01-12 21:21

    For local processes communication pipes are definitely faster than sockets. There is a benchmark.

    I think even though socket is flexible but it can also lead to bad code design. While using pipe it enforces you to design the architecture of your project like which process should be the parent which should be the children and how they cooperate(this will determine how pipes are established) and assign different functionality to processes. Your project design this way will have hierarchical structure and easy to maintain.

提交回复
热议问题