Mysql prompts Writing to net to solve the problem. Recently, it found that the cpu usage of a database has been compared. More than 200%. First, check the slow log of the database and set the slow log to 5 seconds. Basically, no daily log is generated and no more than 5 seconds are generated. Show processlist; it takes 1-2 seconds to query several tables in several select statements. explain select * from xxx shows that the entire table is not indexed. In the past, when the data volume was small, it would be very short, currently, the total data to be queried is less than 20 thousand. Now the data volume is large, and the other tables are all levels. Previously, only the index of large tables was optimized, so the problem is highlighted. After the index is created, the CPU usage is clearly reduced. As far as I know, the cpu usage of msyql is high, which is related to 80% of the cases where no index is used. At show processlist, multiple statements are found to be in the Writing to net state. By analyzing these statements, select statements are basically used, and the database returns the network write-back result if the query data is too large, view show global variables like "global max_allowed_packet". The problem is solved only by adding 1 M cache set global max_allowed_packet = 134217728! The reason is that the number of data returned by multiple select statements exceeds the default value.