Skip to content

Instantly share code, notes, and snippets.

@ProximaMonkey
Forked from huacnlee/gist:1150933
Created April 8, 2012 09:30
Show Gist options
  • Save ProximaMonkey/2336255 to your computer and use it in GitHub Desktop.
Save ProximaMonkey/2336255 to your computer and use it in GitHub Desktop.
redis-search 0.3 Benchmark, 用户昵称搜索(10个字以内)
redis-search 0.3 Benchmark
Core 2 Duo CPU 2.66G, 4G Memory
20W 数据
# coding: utf-8
require "benchmark"
["的","美丽","云","云儿","花","云儿的"].each do |key|
count = RedisSearch::Search.query("Person", key, :limit => 1000000).count
puts "="*80
puts "Search #{key} all count:#{count}..."
Benchmark.bm do |bm|
[1, 10, 100, 1000, 10000].each do |i|
bm.report("Search #{i}") do
i.times do |n|
RedisSearch::Search.query("Person", key, :limit => 20)
end
end
end
end
end
================================================================================
Search 的 all count:5600...
user system total real
Search 1 0.000000 0.000000 0.000000 ( 0.013436)
Search 10 0.010000 0.000000 0.010000 ( 0.017582)
Search 100 0.090000 0.010000 0.100000 ( 0.265795)
Search 1000 0.430000 0.080000 0.510000 ( 2.152209)
Search 10000 4.810000 0.700000 5.510000 ( 20.952217)
================================================================================
Search 美丽 all count:456...
user system total real
Search 1 0.000000 0.000000 0.000000 ( 0.001668)
Search 10 0.010000 0.010000 0.020000 ( 0.014248)
Search 100 0.040000 0.010000 0.050000 ( 0.144137)
Search 1000 0.540000 0.120000 0.660000 ( 1.301681)
Search 10000 5.430000 1.230000 6.660000 ( 13.224271)
================================================================================
Search 云 all count:1074...
user system total real
Search 1 0.000000 0.000000 0.000000 ( 0.001033)
Search 10 0.000000 0.000000 0.000000 ( 0.007430)
Search 100 0.040000 0.010000 0.050000 ( 0.086030)
Search 1000 0.490000 0.060000 0.550000 ( 0.917758)
Search 10000 4.790000 0.640000 5.430000 ( 9.161982)
================================================================================
Search 云儿 all count:16...
user system total real
Search 1 0.000000 0.000000 0.000000 ( 0.001236)
Search 10 0.000000 0.000000 0.000000 ( 0.010758)
Search 100 0.040000 0.010000 0.050000 ( 0.088965)
Search 1000 0.500000 0.120000 0.620000 ( 0.965457)
Search 10000 4.720000 1.170000 5.890000 ( 9.448613)
================================================================================
Search 花 all count:1478...
user system total real
Search 1 0.000000 0.000000 0.000000 ( 0.001275)
Search 10 0.010000 0.000000 0.010000 ( 0.008314)
Search 100 0.030000 0.010000 0.040000 ( 0.085385)
Search 1000 0.500000 0.060000 0.560000 ( 1.018030)
Search 10000 4.860000 0.640000 5.500000 ( 10.057470)
================================================================================
Search 云儿的 all count:2...
user system total real
Search 1 0.000000 0.000000 0.000000 ( 0.000657)
Search 10 0.000000 0.000000 0.000000 ( 0.006602)
Search 100 0.020000 0.010000 0.030000 ( 0.072634)
Search 1000 0.250000 0.120000 0.370000 ( 0.670645)
Search 10000 2.100000 1.120000 3.220000 ( 6.350150)
平均每秒 2000 次搜索请求
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment