diff options
author | dormando <dormando@rydia.net> | 2023-02-21 12:54:07 -0800 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2023-02-22 11:12:51 -0800 |
commit | 833a7234bbaed264a9973141850a23df4eb1b939 (patch) | |
tree | 2b3c49440e923cef1f157085031387b86c51e7f0 /t/proxyconfig.t | |
parent | af037c38cda6d9a07e82d0386202aa3c9d08faea (diff) | |
download | memcached-833a7234bbaed264a9973141850a23df4eb1b939.tar.gz |
proxy: redo libevent handling code
The event handling code was unoptimized and temporary; it was slated for
a rewrite for performance and non-critical bugs alone. However the old
code may be causing critical bugs so it's being rewritten now.
Fixes:
- backend disconnects are detected immediately instead of on the next
time they are used.
- backend reconnects happen _after_ the retry timeout, not before
- use a persistent read handler and a temporary write handler to avoid
constantly calling epoll_ctl syscalls for potential performance boost.
Updated some tests for proxyconfig.t as it was picking up the
disconnects immediately.
Unrelated to a timing issue I resolved to the benchmark.
Diffstat (limited to 't/proxyconfig.t')
-rw-r--r-- | t/proxyconfig.t | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/t/proxyconfig.t b/t/proxyconfig.t index 9561415..1b19b8e 100644 --- a/t/proxyconfig.t +++ b/t/proxyconfig.t @@ -61,7 +61,7 @@ sub wait_reload { my @mocksrvs = (); diag "making mock servers"; -for my $port (11511, 11512, 11513, 11514, 11515, 11516) { +for my $port (11511, 11512, 11513) { my $srv = mock_server($port); ok(defined $srv, "mock server created"); push(@mocksrvs, $srv); @@ -98,9 +98,9 @@ is(<$watcher>, "OK\r\n", "watcher enabled"); wait_reload($watcher); } +my @mbe = (); { # set up server backend sockets. - my @mbe = (); for my $msrv ($mocksrvs[0], $mocksrvs[1], $mocksrvs[2]) { my $be = $msrv->accept(); $be->autoflush(1); @@ -128,6 +128,7 @@ is(<$watcher>, "OK\r\n", "watcher enabled"); } # Test backend table arguments and per-backend time overrides +my @holdbe = (); # avoid having the backends immediately disconnect and pollute log lines. { # This should create three new backend sockets write_modefile('return "betable"'); @@ -154,13 +155,14 @@ is(<$watcher>, "OK\r\n", "watcher enabled"); ok(defined $be, "mock backend accepted"); like(<$be>, qr/version/, "received version command"); print $be "VERSION 1.0.0-mock\r\n"; + push(@holdbe, $be); } - # reload again and ensure only the bad socket became available. + # reload again and ensure no sockets become readable $p_srv->reload(); wait_reload($watcher); @readable = $s->can_read(0.5); - is(scalar @readable, 1, "only one listener became readable"); + is(scalar @readable, 0, "no new sockets"); } # TODO: |