我有一个大网站,有近 600.000 篇索引文章,执行某些查询需要 200 毫秒。
我可以做些什么来加快速度吗?有什么经验可以分享吗?
我的应用程序是 Rails 3.0,带有 Thinking Sphinx 和最新版本的 Sphinx。
这是我搜索到的配置:
searchd
{
listen = < IP >:< PORT >
log = < LOG PATH >
query_log = < QUERY LOG PATH >
pid_file = < PID FILE PATH >
max_matches = 100000
thread_stack = 1024K
read_buffer = 512K
read_unhinted = 64K
max_filters = 512
}
我们将不胜感激。
最佳答案
对于 Thinking Sphinx,您使用的是最新的 Rails 3.0 友好版本 2.0.14 吗?即使您是,最近也发生了一些变化,添加了连接池/持久 Sphinx 连接,这提供了明显的速度提升,因为大多数搜索不会有设置套接字的开销。
不过你需要通过 git 使用最新的:
gem 'thinking-sphinx',
:git => 'git://github.com/pat/thinking-sphinx.git',
:branch => 'v2',
:ref => '6fbbbc0c5d'
也就是说,Barry 的评论值得关注,他对 Sphinx 有丰富的经验。
关于ruby-on-rails - 加速 sphinx ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15844481/