diff options
| author | Garrett D'Amore <garrett@damore.org> | 2023-12-16 19:13:40 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2023-12-16 21:11:15 -0800 |
| commit | ac40f5d7d0babb1b93ef398f88adec1c44c187eb (patch) | |
| tree | fdb2290a027762d4f4ac6e81920975ff55552990 /src/compat | |
| parent | cc5851749cfd87bdf446d7be4193c758a36d2232 (diff) | |
| download | nng-ac40f5d7d0babb1b93ef398f88adec1c44c187eb.tar.gz nng-ac40f5d7d0babb1b93ef398f88adec1c44c187eb.tar.bz2 nng-ac40f5d7d0babb1b93ef398f88adec1c44c187eb.zip | |
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.
Diffstat (limited to 'src/compat')
| -rw-r--r-- | src/compat/nanomsg/nn.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compat/nanomsg/nn.c b/src/compat/nanomsg/nn.c index 0f975b2d..af4db5d3 100644 --- a/src/compat/nanomsg/nn.c +++ b/src/compat/nanomsg/nn.c @@ -1144,6 +1144,13 @@ nn_setsockopt(int s, int nnlevel, int nnopt, const void *valp, size_t sz) nn_seterror(rv); return (-1); } + if ((nnlevel == NN_REQ) && (nnopt == NN_REQ_RESEND_IVL)) { + // Only one context here, so it won't be too bad to tick + // as quickly as this, and it avoids some possible friction + // (e.g. with legacy tests). + (void) nng_socket_set_ms(sid, NNG_OPT_REQ_RESENDTICK, 10); + } + return (0); } |
