从MySQL5.6开始,一个新参数innodb_page_size可以设置Innodb数据页为8K,4K,默认为16K。这个参数在一开始初始化时就要加入my.cnf里,如果已经创建了表,再修改,启动MySQL会报错。 参考手册: - 下面我针对16K和8K做了一个压力测试。 硬件:R710,72G内存,6
从MySQL5.6开始,一个新参数innodb_page_size可以设置Innodb数据页为8K,4K,默认为16K。这个参数在一开始初始化时就要加入my.cnf里,如果已经创建了表,再修改,启动MySQL会报错。
参考手册:
-
下面我针对16K和8K做了一个压力测试。
硬件:R710,72G内存,6块300G、15000转做的RAID10,XFS分区。
my.cnf参数:
1.innodb_buffer_pool_size = 48G 2.innodb_buffer_pool_instances = 8 3.innodb_flush_method = O_DIRECT 4.innodb_file_per_table = 15.innodb_read_io_threads = 16 6.innodb_write_io_threads = 16 7.innodb_io_capacity = 2000 8.innodb_log_files_in_group = 3 9.innodb_flush_log_at_trx_commit = 0 10.innodb_log_file_size = 1024M 11.innodb_max_dirty_pages_pct = 90 1.Sysbench参数(读写):
1.sysbench --test=oltp --mysql-table-engine=innodb --oltp-table-size=100000000 --max-requests=1000000 --num-threads=100 2.--mysql-host=192.168.110.121 --mysql-port=3306 --mysql-user=admin --mysql-password=123456 --mysql-db=test 3.--oltp-table-name=sbtest --mysql-socket=/tmp/mysql.sock run sbtest表1亿条记录,文件大小24G。
下面是16K性能图:
1.innodb_page_size = 16k
下面是8K性能图:
1.innodb_page_size = 8k
1.结论:默认页16K,对CPU压力较小,平均在20% 2.8K页,CPU压力为30%~40%,但select吞吐量要高于16K
--------------------------------------------------------------------------------
2.Sysbench参数(只读):
1.sysbench --test=oltp --mysql-table-engine=innodb --oltp-table-size=10000000 --max-requests=0 --num-threads=100 2.--oltp-read-only=on --mysql-host=192.168.110.121 --mysql-port=3306 --mysql-user=admin --mysql-password=123456 --mysql-db=test 3. --oltp-table-name=sbtest --mysql-socket=/tmp/mysql.sock run sbtest表1亿条记录,文件大小24G。
下面是16K和8K性能图:

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.

ToaddauserremotelytoMySQL,followthesesteps:1)ConnecttoMySQLasroot,2)Createanewuserwithremoteaccess,3)Grantnecessaryprivileges,and4)Flushprivileges.BecautiousofsecurityrisksbylimitingprivilegesandaccesstospecificIPs,ensuringstrongpasswords,andmonitori

TostorestringsefficientlyinMySQL,choosetherightdatatypebasedonyourneeds:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseTEXTforlong-formtextcontent.4)UseBLOBforbinarydatalikeimages.Considerstorageov

When selecting MySQL's BLOB and TEXT data types, BLOB is suitable for storing binary data, and TEXT is suitable for storing text data. 1) BLOB is suitable for binary data such as pictures and audio, 2) TEXT is suitable for text data such as articles and comments. When choosing, data properties and performance optimization must be considered.

No,youshouldnotusetherootuserinMySQLforyourproduct.Instead,createspecificuserswithlimitedprivilegestoenhancesecurityandperformance:1)Createanewuserwithastrongpassword,2)Grantonlynecessarypermissionstothisuser,3)Regularlyreviewandupdateuserpermissions

MySQLstringdatatypesshouldbechosenbasedondatacharacteristicsandusecases:1)UseCHARforfixed-lengthstringslikecountrycodes.2)UseVARCHARforvariable-lengthstringslikenames.3)UseBINARYorVARBINARYforbinarydatalikecryptographickeys.4)UseBLOBorTEXTforlargeuns


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

SublimeText3 English version
Recommended: Win version, supports code prompts!

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

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

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