As Web applications become increasingly complex, simple MySQL + Memcached seems to be unable to meet the needs of data storage. Some enterprises have switched to NoSQL solutions, such as MongoDB, CouchDB, TokyoCabinet/Tyrant, and Cassandra. In their opinion, if the data access mode is not very complex, SQL databases will not be used. However, DeNA chose the "only MySQL" solution and achieved far better performance than NoSQL.
The company is still using MySQL + Memcached. Memcached is mainly used for front-end Cache, such as pre-processing HTML, count, and digest information. However, data rows are not stored in the Cache, but are directly queried from the database, because a common server can get 0.75 million queries per second, what kind of NoSQL can do now?
You can use tools such as sysbench, super-smack, and mysqlslap to test MySQL performance, such
[Matsunobu @ host ~] $ Mysqlslap -- query = "select user_name ,..
From test. user where user_id = 1 "\
-- Number-of-queries = 10000000 -- concurrency = 30 -- host = xxx-uroot
Run the following command to obtain the number of rows read per second,
[Matsunobu @ host ~] $ Mysqladmin extended-status-I 1-r-uroot \
| Grep-e "Com_select"
...
| Com_selected | 107069 |
| Com_selected | 108873 |
| Com_selected | 108921 |
| Com_selected | 109511 |
| Com_selected | 108084 |
| Com_selected | 108483 |
| Com_selected | 108115 |
...
You can use tools such as vmstat and Oprofile to diagnose system bottlenecks.
MySQL Cluster has been criticized for its performance problems. To improve this situation, NDBAPI is introduced, which improves the performance by N times. But how can we optimize non-cluster conditions? Through MySQL bottleneck analysis, it is found that most of the time is spent on SQL parsing and table operations. If you bypass this layer of operation to directly access the storage engine, it can greatly improve the performance, the MySQL plug-in HandlerSocket is the result of obtaining the performance of 0.75 million queries per second. This evaluation data will undoubtedly subvert the NoSQL world. In addition, HandlerSocket supports batch read and write operations, which further improves its performance.