大量のデータを定期的に送信 (交換) する必要があり、2 台のマシン間でできる限り短い待ち時間が必要です。ネットワークはかなり高速です (例: 1Gbit または 2G+)。OSはLinuxです。1 つの tcp ソケット (send と recv 用) を使用する場合と、2 つの単方向 tcp ソケットを使用する場合のどちらが高速ですか?
このタスクのテストは、NetPIPE ネットワーク ベンチマークと非常によく似ています。2^1 から 2^13 バイトまでのサイズのレイテンシと帯域幅を測定し、各サイズが少なくとも 3 回送受信されます (Teal タスクでは、送信回数がより多くなります。プロセスはおそらくピンポンのように送受信されます)。
2 つの単方向接続の利点は、Linux から得られます。
http://lxr.linux.no/linux+v2.6.18/net/ipv4/tcp_input.c#L3847
3847/*
3848 * TCP receive function for the ESTABLISHED state.
3849 *
3850 * It is split into a fast path and a slow path. The fast path is
3851 * disabled when:
...
3859 * - Data is sent in both directions. Fast path only supports pure senders
3860 * or pure receivers (this means either the sequence number or the ack
3861 * value must stay constant)
...
3863 *
3864 * When these conditions are not satisfied it drops into a standard
3865 * receive procedure patterned after RFC793 to handle all cases.
3866 * The first three cases are guaranteed by proper pred_flags setting,
3867 * the rest is checked inline. Fast processing is turned on in
3868 * tcp_data_queue when everything is OK.
ファスト パスを無効にするその他の条件はすべて false です。そして、一方向でないソケットのみが受信時にカーネルを高速パスから停止します