Linux与Windows平台下安装配置Redis
Windows平台Redis安装
下载地址: http://code.google.com/p/servicestack/wiki/RedisWindowsDownload
Redis文件夹有以下几个文件
redis-server.exe :服务程序
redis-check-dump.exe :本地数据库检查
redis-check-aof.exe :更新日志检查
redis-benchmark.exe :性能测试,用以模拟同时由N个客户端发送M个 SETs/GETs 查询 (类似于 Apache 的ab 工具).
指定redis的配置文件,如没有指定,则使用默认设置
解压目录:\>redis-server.exe redis.conf
redis-cli.exe:命令行客户端,测试用
解压目录:\>redis-cli.exe -h 127.0.0.1 -p 6379
设置一个Key并获取返回的值:
$ ./redis-cli set mykey somevalue
OK
$ ./redis-cli get mykey
Somevalue
如何添加值到list:
$ ./redis-cli lpush mylist firstvalue
OK
$ ./redis-cli lpush mylist secondvalue
OK
$ ./redis-cli lpush mylist thirdvalue
OK
$ ./redis-cli lrange mylist 0 -1
1. thirdvalue
2. secondvalue
3. firstvalue
$ ./redis-cli rpop mylist
firstvalue
$ ./redis-cli lrange mylist 0 -1
1. thirdvalue
2. secondvalue
redis-benchmark.exe:性能测试,用以模拟同时由N个客户端发送M个 SETs/GETs 查询 (类似于 Apache 的 ab 工具).
./redis-benchmark -n 100000 –c 50
====== SET ======
100007 requests completed in 0.88 seconds (译者注:100004 查询完成于 1.14 秒 )
50 parallel clients (译者注:50个并发客户端)
3 bytes payload (译者注:3字节有效载荷)
keep alive: 1 (译者注:保持1个连接)
58.50% < = 0 milliseconds(译者注:毫秒)
99.17% < = 1 milliseconds
99.58% < = 2 milliseconds
99.85% < = 3 milliseconds
99.90% < = 6 milliseconds
100.00% < = 9 milliseconds
114293.71 requests per second(译者注:每秒 114293.71 次查询)
Windows下测试并发客户端极限为60