T
T
titronium2015-03-10 13:08:07
PHP
titronium, 2015-03-10 13:08:07

How long does it take Sphinx to search for a 10 million index?

Hello!
Recently there was a task to organize a search for 10 million records in a simple MySQL table. Put Sphinx, the index was created in about one or two minutes - that's good. Connected sphinxapi.php, created the simplest index search script. Everything is fine, but searching for 4-5 words takes about 1.8 seconds. Is it long?
Machine:
CPU: i5-2300 @ 2.80GHz
RAM: 4Gb
HDD: Western Digital WD5000 - 500 GB, 7200 rpm
Sphinx config file:

source address_name
{
  type			   = mysql
  sql_host		   = localhost
  sql_user		   = root
  sql_pass		   = password
  sql_db		   = db_test
  sql_port		   = 3306
  sql_query		   = SELECT id, address FROM qa_table
  sql_attr_uint	   = id
  sql_query_info	   = SELECT address FROM qa_table WHERE id=$id
}

index address
{
  source		   = address_name
  path		           = /var/lib/sphinxsearch/data/address
  morphology        = stem_en
  charset_type       = utf-8
}

indexer
{
  mem_limit	   = 128M
}

searchd
{
  listen			= 9312
  read_timeout		= 5
  max_children		= 30
  pid_file		        = /var/run/sphinxsearch/searchd.pid
  max_matches		= 1000
  preopen_indexes	= 1
  unlink_old		= 1
  workers			= prefork
  binlog_path		= /var/lib/sphinxsearch/data
}

The index is created on the basis of a simple table of 2 fields: id and address
The table is filled with keywords from addresses.
Address example: 702 SW 8th St Bentonville, Arkansas United States
include('sphinxapi.php');
$cl = new SphinxClient();

$cl->SetServer( "localhost", 9312 );
$cl->SetMatchMode(SPH_MATCH_ANY);
$cl->SetLimits(0, 40);

$result = $cl->Query("8th St Bentonville Arkansas", "address");

Total: in this query to the index, the execution time is 1.8-2 seconds.
Considering the current car and all these nuances - is it fast or slow? Advise how to speed up the search?
Real time indexes and others are not used yet - the whole task is in the speed of the search.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Puma Thailand, 2015-03-10
@opium

It's very very very long, it must be fast.

K
Kir ---, 2015-03-10
@SowingSadness

Are you sure that the search is long, and not the transfer of information from sphinx to php? If you get 40 records of 1GB each, then there is a bottleneck in transferring that much data.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question