From ac40f5d7d0babb1b93ef398f88adec1c44c187eb Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sat, 16 Dec 2023 19:13:40 -0800 Subject: fixes #1663 Request/Reply Protocol Throughput and Scalability This eliminates the req protocols use of nni_timer (and setting a single timer node per request. This was problematic because it devolves into O(n^2) as we wind up inserting timer nodes and having to scan the list for the timer node. The solution is to use a single scan - stop worrying about insertion, but instead use a coarse granularity timer (defaults to 1 second) for retries. Then do the O(n) scan just once per interval. A new option, NNG_OPT_REQ_RESENDTICK, can be used to change the tick interval for cases (like unit tests) where more fine grained timing is required. --- include/nng/protocol/reqrep0/req.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/nng/protocol/reqrep0/req.h b/include/nng/protocol/reqrep0/req.h index 3ed80216..0c9fde3f 100644 --- a/include/nng/protocol/reqrep0/req.h +++ b/include/nng/protocol/reqrep0/req.h @@ -31,6 +31,7 @@ NNG_DECL int nng_req0_open_raw(nng_socket *); #define NNG_REQ0_PEER_NAME "rep" #define NNG_OPT_REQ_RESENDTIME "req:resend-time" +#define NNG_OPT_REQ_RESENDTICK "req:resend-tick" #ifdef __cplusplus } -- cgit v1.2.3-70-g09d2