Deal with big data high concurrency related issues

Source: Internet
Author: User
Handle Big Data high concurrency problems
Inside the database
Database
A
Table has 1 sheets
A
The data inside is
FirstName LastName
A A
This table contains millions data.
So that's the problem.
/* The front $name is already defined by me */
$result = "SELECT LastName from a WHERE firstname= '". $name. "'";
$sql _name=mysql_query ($result);
$name =mysql_fetch_array ($sql _title);
$subject = $name [0];
?>
So that's the problem.
Server one processing at the same time 500 concurrent databases are hung up.
Is there any good way to solve it?




------to solve the idea----------------------
Unfortunately, this is your hardware and the operating system does not support you that high concurrency.
Only from the perspective of PHP can not change the status quo
For your code:
There's no room for optimization at the PHP level.
At the MySQL level, it's just indexing the FirstName column.

------to solve the idea----------------------
$result = "SELECT LastName from a WHERE firstname= '". $name. "'";
And
$result = "SELECT LastName from a WHERE firstname= '". $name. "' Limit 0,1 ';
The meaning is different!

The former indicates that multiple lines may be removed
The latter means that no matter how many lines are taken, only the first row encountered

If, for the so-called speed, even the original intention is distorted. What's the point of "optimization"?
------to solve the idea----------------------
By a horizontal or vertical table, or by means of a multi-database divider.

------to solve the idea----------------------
I mean the sub-list of the library ...
MD5 (FIRSTNAME+LASTNAME), hashed into a different database table.
  • Contact Us

    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

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.