This seems like it ought to be trivial, but I want to run a query through redis-cli, and then just get back how long it took on the server, along with the results. This is just for debugging purposes, to factor out problems with my client library or latency. Is there a way to do this?
相关问题
- Getting Redis Master address from Sentinel C#
- Configuring Redis to play nice with AppHarbor
- Why do we need Redis for running CKAN?
- Problem in deserialize redis-cache to objects in S
- wait for all promises to finish in nodejs with blu
You can set the Slow Log to 0 (zero). Doing so will log every command.
The time you will see is in microseconds, and from the documentation this time means:
To factor in the network performance you might have to hack your client library, logging just before and after the communication with redis, leaving out any tranformation your library may do.
You can do this by wrapping the redis command you're investigating in a
MULTI/EXEC
block, where theTIME
command is used right before and right after your command. For example:Using the node library:
Or... using the command line (which is what you asked for in your question):
And then do the math yourself. The above example took 3 microseconds.