Improvements to target (i) memcached servers that support the binary protocol over UDP, and (ii) resource-contrained memcached servers (supporting only short keys); and to evaluate the latency of each transaction. #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains three extensions to memtier_benchmark:
--transaction_latency
command-line flag causes memtier_benchmark to print the raw latency of each operation."Latency" here is the time taken for the server to carry out an operation (GET or SET) from the client's perspective.
The "client's perspective" might involve two sorts of overhead: the trip-time from the server to the client, and the time taken for the client's architecture (including its network stack) to make the result of the operation available to the client.
This patch adds an flag in memtier_benchmark's configuration, and if this flag is set then the latency is printed to stdout.
--key-width
command-line parameter allows the user to specify the width of the keys that are generated by memtier_system.This is intended to be used on constrained servers that don't support the standard key-width (250 bytes), and that support smaller keys.
This patch adds a range-check on key sizes that are requested by the user (to ensure that they don't exceed the maximum, 250), and modifies the behaviour of object_generator to take into account the requested key width. (If not key width is specified by the user, then memtier_benchmark defaults to the default maximum size, 250 bytes.) Finally, runtime checks are made to ensure that the generated keys do not exceed the maximum size requested by the user.
--udp
command-line flag causes memtier_benchmark to generate traffic over UDP, rather than its usual TCP transport. This only works with the memcached binary protocol -- that is, it won't work with redis or memcached_text. This patch's code threads asocktype
value, defaulting toSOCK_STREAM
(for TCP) but which is changed toSOCK_DGRAM
(for UDP) when the --udp flag is provided. The use of UDP has been added as a constructor parameter to protocol_factory. Using the binary memcached protocol over UDP necessitates a small header to be included -- this has been specified in libmemcached_protocol/binary.h. This header is generated by the function append_binary_udp_header, which currently produces a constant header -- this can be improved in future work if this feature is developed/needed further.These patches were tested using memcached 1.4.25 (cloned at the tip memcached/memcached@6b65e45), which was run using the following command:
./memcached -p 0 -U 11211 -B binary
Many thanks to @marcinwoj who made the original extensions;
and to @luomai, @salvatorg, @noaz, @richardclegg, and @mgrosvenor who
worked on, or helped with, testing/experimentation/evaluation in which
these extensions were used.