Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shard_connection: Support abstract Unix socket clients #257

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LINKIWI
Copy link

@LINKIWI LINKIWI commented May 26, 2024

This PR introduces support for --unix-socket to accept an abstract Unix socket when the socket name prefixed with @.

Motivation: I am orchestrating execution of the memtier_benchmark binary against Redis protocol-compliant servers in an environment where the filesystem is not writable and binding TCP listeners is not preferred. Abstract Unix sockets are a convenient solution for this scenario.

Verification

Preparation

$ redis-server --port 6120

Unix socket file

$ socat -d UNIX-LISTEN:/tmp/redis.sock,reuseaddr,fork TCP:localhost:6120
$ netstat -ax | grep redis
unix  2      [ ACC ]     STREAM     LISTENING     223273   /tmp/redis.sock
$ ./memtier_benchmark --unix-socket /tmp/redis.sock --clients 1 --threads 1 --test-time 1
Writing results to stdout
[RUN #1] Preparing benchmark client...
[RUN #1] Launching threads now...
[RUN #1 100%,   1 secs]  0 threads:         173 ops,     171 (avg:     172) ops/sec, 7.31KB/sec (avg: 7.34KB/sec),  5.79 (avg:  5.78) msec latency

1         Threads
1         Connections per thread
1         Seconds


ALL STATS
============================================================================================================================
Type         Ops/sec     Hits/sec   Misses/sec    Avg. Latency     p50 Latency     p99 Latency   p99.9 Latency       KB/sec 
----------------------------------------------------------------------------------------------------------------------------
Sets           15.99          ---          ---         6.28750         3.32700        41.98300        41.98300         1.23 
Gets          156.88         0.00       156.88         5.72912         3.74300        22.27100        51.96700         6.11 
Waits           0.00          ---          ---             ---             ---             ---             ---          --- 
Totals        172.87         0.00       156.88         5.78076         3.61500        29.95100        51.96700         7.34

Abstract Unix socket

$ socat -d ABSTRACT-LISTEN:redis.sock,reuseaddr,fork TCP:localhost:6120
$ netstat -ax | grep redis
unix  2      [ ACC ]     STREAM     LISTENING     239347   @redis.sock
$ ./memtier_benchmark --unix-socket @redis.sock --clients 1 --threads 1 --test-time 1
Writing results to stdout
[RUN #1] Preparing benchmark client...
[RUN #1] Launching threads now...
[RUN #1 100%,   1 secs]  0 threads:         151 ops,     149 (avg:     150) ops/sec, 6.38KB/sec (avg: 6.41KB/sec),  6.64 (avg:  6.62) msec latency

1         Threads
1         Connections per thread
1         Seconds


ALL STATS
============================================================================================================================
Type         Ops/sec     Hits/sec   Misses/sec    Avg. Latency     p50 Latency     p99 Latency   p99.9 Latency       KB/sec 
----------------------------------------------------------------------------------------------------------------------------
Sets           13.99          ---          ---        12.56800         4.41500       111.61500       111.61500         1.07 
Gets          136.92         0.00       136.92         6.01606         4.04700        29.69500        38.91100         5.34 
Waits           0.00          ---          ---             ---             ---             ---             ---          --- 
Totals        150.91         0.00       136.92         6.62352         4.15900        29.69500       111.61500         6.41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant