zeromq/netmq — pull request #95 by almazik (2013-08-05 11:57:00+00:00)
Title: Performance test for comparing PAIR sockets vs BlockingCollection

I've added a project to contain performance test suite.

Current test class compares the usage of PAIR sockets with `BlockingCollection` for communication between threads. As it currently stands `BlockingCollection` outperforms PAIR sockets in all tests. Three use cases were tested (tested on my dev environment):
- Send/Receive on one thread (no multithreading, as a baseline for understanding the underlying performance):
>1 000 000 messages using BlockingCollection on the same thread, interleaved send/receive: 488 ms
1 000 000 messages using PAIR sockets on the same thread, interleaved send/receive: 968 ms

- One way data transfer between threads (pushing the data on one end, reading on another) - fully asynchronous. `BlockingCollection` implementation tests 2 options - unrestricted queue of messages and limited-capacity queue (100 messages limit):
> 1 000 000 messages using BlockingCollection on different threads: 563 ms
1 000 000 messages using BlockingCollection(constrained) on different threads: 917 ms
1 000 000 messages using PAIR sockets on different threads: 2402 ms

- Bi-directional "synchronous" communication that mimics REQ-REP pattern - one thread submits message and waits for reply before sending next message, while another thread waits for request and submits reply:
>100 000 request-reply conversations using BlockingCollection on different threads: 368
100 000 request-reply conversations using PAIR sockets on different threads: 6377