Introducing the Redis Admin UI
Confident that I’ve optimized ServiceStack’s JSON web services performance enough with the adoption of my latest efforts developing .NET’s fastest JSON Serializer, I’m now turning my attention towards creating apps that take advantage of it.
I’m a firm believer that performance is one of, if not the most important feature in developing an App that most users will love and use on a regular basis. It’s the common trait amongst all the apps and websites I regularly use and is why I’m continually seeking software components and/or techniques that can help make my software run faster; or whenever there is no alternative to develop them myself. Although having said this I’m not a complete perf maniac and find that its important to strike a balance between productivity, utility and performance – which is what has effectively kept me tied to C# language for all my server development.
Redis, Sweet Redis
One of the exciting movements that have occurred in recent times is the introduction of NoSQL suite of data persistence solutions. There are numerous impressive NoSQL solutions out there but the one that I have been most interested in is Redis which from the projects website:
is an advanced key-value store. It is similar to memcached but the dataset is not volatile, and values can be strings, exactly like in memcached, but also lists, sets, and ordered sets. All this data types can be manipulated with atomic operations to push/pop elements, add/remove elements, perform server side union, intersection, difference between sets, and so forth. I found this fascinating since it provides an extremely fast data-store (that gets routinely persisted) supporting rich data-structures that can be safely accessed by multiple app servers concurrently since all operations are atomic. Sweet just what I always wanted – although to make it productive I developed a C# Redis Client that apart from supporting Redis’s entire feature-set also provides a high-level typed API that can persist any .NET POCO Type which gets persisted as JSON in Redis.
The Redis Admin UI
One of the disadvantages that comes with making use of a shiny new tech is that there is sometimes not a lot of tooling available for it. Despite its vibrant community this is also true for Redis where although it sports a rich command-line interface (Unix software is good like this) the GUI admin tools are somewhat lacking. Not to worry, I actually needed a project to work on to learn about Google’s closure-library anyway so this ended up being a pretty good fit.
Before we get into more detail its probably a good idea to showcase some of screenshots of where its currently at: Note: You can also try it out live: http://redisadminui.servicestack.net/
Admin tab showing redis instance info
Aggregate view of complex types
View single complex type
Redis Web Services
In order to be able to access Redis from a web page some JSON web services are in order. I could’ve just implemented the services required by the Admin UI although I wanted to flex some ServiceStack muscle so decided to create web services for all of Redis’s operations which on final count totalled near 100 web services that I ended up knocking out over a single weekend. One of the benefits of using ServiceStack to develop your web services is that you get SOAP, XML, JSON and JSV endpoints for free. So after spending the next couple of days creating unit tests to provide 100% coverage, the back-end was complete – thus giving Redis CouchDB-like powers by allowing it to be accessed from any HTTP client.
Those interested in the Redis Web Services component can check out a live preview – with the complete list of available web services are available here:
And some examples on how to call them:
http://redisadminui.servicestack.net/json/reply/GetServerInfo (JSON) http://redisadminui.servicestack.net/json/reply/SearchKeys?Pattern=urn:c* (XML)
- A TreeView displaying a heirachal view of the filtered redis keyset
- Deep linking support so you can refresh, save or send a link of the entry you’re looking at
- Back and forward button support
- A tabular, aggregate view of all your ‘grouped keys’
- An auto-complete filter to filter the tabular data
- Updating and deleting of string values
- Identifying the type, viewing and deleting of all keys
- An admin interface to view redis server stats and the ability to destroy and rebuild the entire redis instance
Restrictions and Assumptions
In order to provide a useful Generic UI I’ve had to make a few assumptions on conventions used. Coincidentally these also happen to be the same conventions that the ServiceStack’s C# Redis Client uses when storing data :-) .
- Keys parts should be separated with a ‘:’
- Keys within the same group are expected to be of the same type
- Complex types are stored as JSON
There are likely to be others I’ve subconsciously used so I’ll make an effort to keep this list of assumptions live.
Download and installation
Like the rest of ServiceStack the Redis Admin UI is Open source released under the liberal new BSD licence.
In keeping with tradition with most of my software, the Redis Admin UI works cross-platform on Windows with .NET and Linux and OSX using Mono (Live demo is hosted on CentOS/Nginx). I’ve had an attempt at some basic installation instructions that are included in the downloaded and viewable online.
The latest version is hosted on Service Stacks code project site at the following url: