RedisInsight profiler analyzes your Redis commands that are being run on the Redis server in real-time. The tool provides you detailed information about the number of commands processed, commands/second and number of connected clients. It also gives information about top prefixes, top keys and top commands.
It basically runs the Redis MONITOR command and generates a summarized view. MONITOR is a debugging command that streams back every command processed by the Redis server. It can help in understanding what is happening to the database. This command can both be used via
redis-cli and via
telnet.All the commands sent to the redis instance are monitored for the duration of the profiling. The ability to see all the requests processed by the server is useful in order to spot bugs in an application both when using Redis as a database and as a distributed caching system.
Because MONITOR streams back all commands, its use comes at a cost.Running monitor command is dangerous to the performance of your production server, hence the profiler is run for a maximum time of 5 minutes, if the user has not stopped it in between. This is to avoid overload on the Redis server.
Follow the below instructions to test drive RedisInsight profiler tool:
Visit https://developer.redislabs.com/create/rediscloud and create a Redis database. Follow these steps to enable RedisTimeSeries module on Redis Enterprise Cloud
To install RedisInsight on your local system, you need to first download the software from Redis Labs website.
Click this link to access a form that allows you to select the operating system of your choice.
Run the installer. After the web server starts, open http://YOUR_HOST_IP:8001 and add a Redis database connection.
Select "Connect to a Redis database"
Enter the requested details, including Name, Host (endpoint), Port, and Password. Then click “ADD REDIS DATABASE”.
We will be using a python script to fetch sensor data from one of the IoT Edge sensor devices (such as BME680 sensors) and then push the sensor values to the Redis Cloud database.
The complete walkthrough of this python script is explained here.
Let us execute the script
Run the monitor command to verify if sensor values are being fetched or not.(Don’t run this command in the production environment)
Follow these steps to connect to the database using RedisInsight. Once you are connected to RedisInsight GUI, you can verify the 3 RedisTimeSeries keys:
Click “Start Profiler” while sensor data is continuously being pushed to Redis database.
Let the profiler tool run for next 1-2 minutes.
Stop the profiler to see the results as shown below:
Hence, the profiler provides the below statistical details:
- How many commands were processed
- Number of connected clients
- Rate at which the commands were executed
- Top key patterns (key patterns followed by number of commands)
- Top Keys
- Top Commands & their frequency