PHP, behind MySQL, when the user is more than 20 people, there is a visit to the phenomenon of slow, which master can know why? Available for a fee

Source: Internet
Author: User
Tags mysql command line
PHP, behind MySQL, when the user is more than 20 people, there will be access to the phenomenon of slow, who can know why? Available for a fee
I did a such an application, now can not solve, distress n days, if there are experts to pay to help solve.

The specific can be contacted with QQ 24508609. Non-master, do not delay everyone time.

Web server, network speed of about 1M, is it related to network speed?

Master can help me analyze, or directly contact me, Xie.

------Solution--------------------
There are many reasons for slow speed.
Say two that I've ever met

1, related to the table structure, the table records a lot of time, if not properly built the corresponding index, the select out of the speed is extremely slow.
2, and the SELECT statement, in the Select Large table, try not to use *, the same number of statistics when the count () number function does not use the * number, the specified field will save a lot of overhead.
------Solution--------------------
Not even slow to see the database.
------Solution--------------------
20 users is very slow?
No, or just want to book the first floor of the SQL problem, or you are the problem of the structure of the program!
------Solution--------------------
In general, you need to analyze the program,
First, SQL statement, do you see if your SQL is running slowly? The local database directly running can see the time, if less than 1 seconds is not for this reason;
Second, the procedural reason, that is generally a page slow, will not cause all the pages are slow, and then analyze the slow page;
Thirdly, the network is slow, the concrete solution is not many; test method see if the static page is open slowly?
Four, the server is slow, that is the configuration is too low or poisoned;
Five, have not thought of ...
------Solution--------------------
As the upstairs said, step by step test to see where your problem is. Find the reason for the slow, it's good to run.
------Solution--------------------
Ask a question, MySQL built a table, what database are you using? There are InnoDB or MyISAM and so on type

If it is not myisam, such as InnoDB support, if you do not BEGIN TRANSACTION and commit, and each insert or modify action opens a new transaction, you are likely to be slow in transaction opening and closing overhead. Why don't you just change the data sheet back to MyISAM and try it?

If it is still very slow, you need to look at the SQL statements of your operation table to jump to conclusions, it is likely that you do query the statement efficiency is too low, especially when the cross-table operation, the connection process, or the comparison process did a number of repeated calculations, resulting in a geometric increase in query volume
Like what:
SELECT * FROM XXXX where ABC not IN (SELECT * from yyyy where YYYY.CDE>XXXX.ABC)
Wait, this is just an example, the above query to do is count (xxxx) *count (yyyy) times, if the XXXX table and YYYY table data is calculated in million, if the similar structure you iterate a few times, this number may be astronomical

Of course, this happens in the process of self-iteration, such as:
SELECT * from xxxx as T1 where ABC not IN (SELECT * from xxxx as T2 WHERE T1.CDE>T2.ABC)
You check it out, you can't just put the code on it.

------Solution--------------------
Should see if there are no Trojans.
------Solution--------------------
Is there a limit on the number of users?
------Solution--------------------
What system does your server have? Windows in the Task Manager look inside, Linux with the top command to see how much your MySQL and Apache each account for the CPU.
If MySQL is always high on the CPU, it indicates that some of your SQL is problematic.

When your site suddenly becomes slow, you repeatedly execute the show variables command on the MySQL command line to see which SQL statement your MySQL is executing. After you see the SQL statement, you can optimize the SQL statement.

Open my.cnf (under Windows My.ini), add log-slow-queries = Slow.log, and then go to the log file, which records all the slowest SQL statements your site executes. Optimized individually.
------Solution--------------------
In addition, your 1m bandwidth is certainly a big problem, you find some test network card traffic software, measured 20 people to visit your site about how much traffic.
------Solution--------------------
Suddenly think of a problem, XP does a TCP connection limit, you will not be XP AH?

Http://download.it168.com/02/0222/50167/50167_3.shtml
  • Related Article

    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.