On a PHP page, there is a browser count of 200 concurrent queries per second, which causes a lot of pressure on mysql due to insert.
In the lnmp environment, other page content is cached, and there is not much load. This is the browser statistics function, which puts a lot of pressure on mysql. Do you have any solutions?
I don't want to use MySQL to do this. It's not difficult for MySQL to have 200 concurrent queries per second. In addition, Redis and Memcached are used for persistence. The Business Code and O & M deployment volume are not small.
I will give you some suggestions to minimize your O & M deployment and Business Code changes.
You can separate data and do not insert data concurrently in a database. After the split, the query is performed in the slave database (or even in a dedicated distributed system such as Hive). The index can be removed from the master database to improve the insert performance. In this way, the Business Code is almost unchanged (just change the database configuration file ). For MySQL O & M and deployment, you can select a low business point online.
If you can accept a small amount of changes to the Business Code (PHP), there are two suggestions:
1. Database sharding and table sharding. The total amount of data in each table is small, which improves the operation performance, especially for the MyISAM table in the slave database. There may be some queries before you insert them. For example, if the IP address is not in the library, the previous statistics have not been made.
2. Use the HandlerSocket plug-in to bypass SQL Parser and directly operate the stored files. If possible, you can also use bulk insert (batch insert ). MySQL InnoDB also launched InnoDB NoSQL Plugin similar to HandlerSocket, using the memcached protocol to share the InnoDB Buffer, no longer have to worry about how to maintain data consistency before MySQL and Memcached.