Questions about using php multithreading to process highly concurrent search requests
Source: Internet
Author: User
About how to use php multithreading to process highly concurrent search requests! I use php for android as the backend. now, androdi has a search function, that is, entering keywords for search. I plan to write two methods to process highly concurrent search requests, the first method receives the keyword POST from the mobile phone and stores it in redis to eliminate the issue of using php multithreading to process highly concurrent search requests!
I use php for android as the backend. now, androdi has a search function, that is, entering keywords for search. I plan to write two methods to jointly process high-concurrency search requests. The first method receives the POST keyword from the mobile phone and stores it in the message queue created by redis. The second method is used to retrieve keywords from the message queue for search and then return the search results. However, the address of the post keyword on the mobile phone is the address of the first method, so you can only receive the value returned by the first method. However, I am using the second method to process the search function. how can I return the search results to my mobile phone? So I think of multithreading, but php does not support multithreading. I heard that gearman can implement a method similar to multithreading. how can I do this? Multi-thread concurrent search for php gearman:
------ Solution --------------------
From the process you described, you still use the traditional instant query method.
No matter how clever you are, the user will always wait for the query results to occupy the connection
If the request keyword is received, the cached result is immediately returned (if the keyword is not cached, it is directly queried and cached)
Store the keyword to the queue for update check.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service