前言:根据业务需要,需测试mysql性能和压力测试.这里我说下测试方法和测试过程以及测试中出错的问题估计很多人跟我一样要测试mysql的性能压力,网上找了很多资
前言:根据业务需要,需测试mysql 性能和压力测试.
这里我说下测试方法和 测试过程以及测试中出错的问题
估计很多人 跟我一样 要测试mysql 的性能 压力,网上找了很多资料有很多,但是很乱,所以这里我做个总结,拿自己的真实服务器测试的。并且 想测多少数据 都能模拟出来!这里只介绍方法。
MySQL从5.1.4版开始带有一个压力测试工具mysqlslap,通过模拟多个并发客户端访问
mysql来执行测试。
分别 测试 myisam 和 innodb 引擎
Benchmark Running for engine myisam Average number of seconds to run all queries: 0.638 seconds Minimum number of seconds to run all queries: 0.565 seconds Maximum number of seconds to run all queries: 0.924 seconds Number of clients running queries: 50 Average number of queries per client: 20 Benchmark Running for engine myisam Average number of seconds to run all queries: 0.691 seconds Minimum number of seconds to run all queries: 0.686 seconds Maximum number of seconds to run all queries: 0.696 seconds Number of clients running queries: 100 Average number of queries per client: 10 Benchmark Running for engine innodb Average number of seconds to run all queries: 13.189 seconds Minimum number of seconds to run all queries: 12.886 seconds Maximum number of seconds to run all queries: 13.337 seconds Number of clients running queries: 50 Average number of queries per client: 20 Benchmark Running for engine innodb Average number of seconds to run all queries: 12.449 seconds Minimum number of seconds to run all queries: 12.299 seconds Maximum number of seconds to run all queries: 12.592 seconds Number of clients running queries: 100 Average number of queries per client: 10这个工具 无法 自己规定 多少数据,所以我后来 有拿了 super smack 工具测试
要去网上下载 vegan.net/tony/supersmack/super-smack-1.3.tar.gz
tar zxvf super-smack-1.3.tar.gz cd super-smack-1.3 ./configure --prefix=/usr/local/super-smack-1.3 --with-mysql=/usr/local/mysql/ --with-mysql-lib=/usr/local/mysql/lib/mysql/ --with-mysql-include=/usr/local/mysql/include/mysql/编译过程后 make 会报错
而且还要修改配置文件
dictionary.h: In member function ‘void Unique_dictionary::set_template(const char*)’: dictionary.h:93:28: error: ‘strlen’ was not declared in this scope super-smack.cc: In function ‘void set_parse_file(char*)’: super-smack.cc:65:55: warning: deprecated conversion from string constant to ‘char*’ super-smack.cc: In function ‘void set_db_type(const char*)’: super-smack.cc:72:48: warning: deprecated conversion from string constant to ‘char*’ super-smack.cc: In function ‘void print_engines()’: super-smack.cc:126:55: error: ‘strlen’ was not declared in this scope make[2]: *** [super-smack.o] 错误 1 make[1]: *** [all-recursive] 错误 1 make: *** [all-recursive-am] 错误 2要修改相应的配置文件才行
编译之前修改文件super-smack-1.3/src/query.cc 第193行: long len = 0; int num_recs = 0; 第199,200行 long str_len = (*i).first.length(); > if((long)p + str_len + 3 *sizeof(int) len = (long)p - (long)buf;这个我是看了相应教程 找了好久才发现的!
make make install介绍相应参数:
开头要修改 密码默认文件
vi select-key.smack
InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

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 worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


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

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

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

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools