Analysis on-mysql performance of website bottleneck analysis

Source: Internet
Author: User

I. About slow query setup and analysis

Find Slow Query parameters

' long% ' ; +-----------------+----------+| Variable_name   | Value    10.000000 |+-----------------+----------+
Mysql> Show variables like ' slow% '; +---------------------+--------------------------------+| Variable_name       | Value                          |+---------------------+--------------------------------+| slow_launch_time    | 2                              | | slow_ Query_log      | OFF                            | | slow_query_log_file |/var/lib/mysql/ubuntu-slow.log |+---------------------+------------------------- -------+
Mysql> Show variables like '%queries% '; +-------------------------------+-------+| Variable_name                 | Value |+-------------------------------+-------+| log_queries_not_using_indexes | OFF   | | log_slow_queries              | On    |+-------------------------------+-------+

Set slow query parameters (author recommended set to 1s)

Mysql>  set global long_query_time=1;
mysql> set global slow_query_log= ' on ';

Some friends in addition to setting the above will also set the query in the non-indexed statement also to on (that is, log_queries_not_using_indexes), you can according to the current needs to determine whether the need to increase.

So that everyone can be based on the corresponding log to optimize, of course, the above is mainly for the MySQL statement optimization

Second, show Processlist, show full processlist view and analysis

Show Processlist: There are mainly the following columns

+----------+------+-----------+------+---------+------+-------+------------------+| Id       | User | Host      | db   | Command | Time | State | Info             |+----------+------+-----------+------+---------+------+-------+------------------+

In addition to one in the optimization of a log, of course, show processlist is also a way, if the MySQL process has been in a high load, show processlist is also a good choice, detailed parameters introduction I will not introduce, I believe there is a lot of information on the Internet.

Analysis on-mysql performance of website bottleneck analysis

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.