搜索一亿条记录的性能 [英] performance for searching through 100 million records

查看:42
本文介绍了搜索一亿条记录的性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,我正在使用PHP,并将1100万个文本文件中的域加载到数组中,然后使用Regex在它们中进行搜索.为此,我需要将内存限制提高到2gig,然后大约需要10秒钟来处理.我很快将拥有1亿个域,并计划迁移到数据库解决方案,但是,当搜索1亿个域列表时,如何获得良好的性能?

Right now I am doing PHP and have 11 million domains in text files loaded into an array and then I search through them using Regex. To do this I need to jack up memory limit to 2gigs and then it takes like 10 seconds to process. I will soon have 100 million domains and plan on moving to a database solution, but still, how do you get good performance when searching through a list of 100 million domains?

我使用正则表达式进行搜索,如下所示:

I search using regex like this:

$ domains = preg_grep("/store./",$ array);

$domains = preg_grep("/store./", $array);

foreach($ domains as $ domain){echo $ domain;}

foreach($domains as $domain) {echo $domain;}

推荐答案

像lucene这样的搜索引擎怎么样: http://lucene.apache.org/java/docs/index.html

How about a search engine like lucene: http://lucene.apache.org/java/docs/index.html

就是为了这个目的.

这篇关于搜索一亿条记录的性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆