如何使用MySQL执行每秒75万次的NOSQL查询
随着Web应用变得越来越复杂,单纯的MySQL + Memcached似乎已满足不了数据存储的需求,一些企业纷纷转向NoSQL方案,比如MongoDB、
随着Web应用变得越来越复杂,单纯的MySQL + Memcached似乎已满足不了数据存储的需求,一些企业纷纷转向NoSQL方案,比如MongoDB、CouchDB、 TokyoCabinet/Tyrant、Cassandra等。在他们看来,如果数据访问模式不是很复杂,用不上SQL数据库。然而,DeNA公司截然相反,他们选择了 "only MySQL" 的方案,且获得了远远超越NoSQL的性能。
该公司仍在使用MySQL + Memcached,Memcached主要用于前端Cache,比如预处理的HTML、计数和摘要信息等,但数据行并不放在Cache里,而是直接从数据库查,因为普通的服务器就可以获得75万次每秒的查询,当前又有哪种NoSQL可以做到呢?
可以使用sysbench、super-smack、mysqlslap等工具测试MySQL性能,比如
[matsunobu@host ~]$ mysqlslap --query="select user_name,..
from test.user where user_id=1" \
--number-of-queries=10000000 --concurrency=30 --host=xxx -uroot
然后使用如下命令得到每秒读取的行数,
[matsunobu@host ~]$ mysqladmin extended-status -i 1 -r -uroot \
| grep -e "Com_select"
...
| Com_select | 107069 |
| Com_select | 108873 |
| Com_select | 108921 |
| Com_select | 109511 |
| Com_select | 108084 |
| Com_select | 108483 |
| Com_select | 108115 |
...
可以使用vmstat和Oprofile等工具诊断系统瓶颈。
MySQL Cluster因为性能问题一直受人批判,,为改善这种情况引入了NDBAPI,使得性能提升了N倍。但对于非集群情况怎么优化呢?通过MySQL瓶颈分 析,发现大部分时间花费在SQL解析和表操作上,如果绕过这层操作直接存取存储引擎,可大大提升性能,MySQL的插件HandlerSocket正是由 此获得了每秒75万次查询操作的性能,这个评测数据无疑会颠覆整个NoSQL世界。另外,HandlerSocket支持批量读取和写操作,这进一步提升 了它的性能。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.
