Jump to content

Recommended Posts

I'm making a Search Suggestor that every time someone searches something, it adds it to a database. If its already in there, it increments the value by 1. I'm building it in Flash using AMFPHP to connect to the database so its normal PHP Queries and results etc..

 

How should I go about handling the database queries if there were say 5,000+ people using it at once?

 

I'm going to have it query per second rather than per keystroke (only if the input has changed from one second to the next so its not querying the same thing over and over).

 

Is there a more efficient way to do this?

Link to comment
https://forums.phpfreaks.com/topic/53499-mysql-caching-php-input-suggestion/
Share on other sites

I would recommend having a static database for queries that is rebuilt regularly (daily or weekly).  That should be sufficient for your particular application.  Then your query database can be optimized for searching, and your query logging database can be optimized for fast inserts.  5000+ simultaneous users is a lot btw :)

 

If you have a high volume of inserts/updates, one solution is to do inserts only, then aggregate the data later.  That allows you to write the data sequentially (assumign nothing else is using that disk), which is a big win over having to do random access to check if a particular query exists already.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.