本篇是关于Drupal7下Field Storage的测试结果,以及不同情况下对 drupal 性能的影响,主要是MySQL和MongoDB以及在调优参数情况和不调优情况下的对比。 本篇翻译自 《Field Storage Tests with Drupal 7》 链接地址: http://posulliv.github.io/2013/01/07/b
本篇是关于Drupal7下Field Storage的测试结果,以及不同情况下对drupal性能的影响,主要是MySQL和MongoDB以及在调优参数情况和不调优情况下的对比。
本篇翻译自 《Field Storage Tests with Drupal 7》
链接地址: http://posulliv.github.io/2013/01/07/bench-field-storage/
测试环境
EC2 EBS backed Large instance (8GB of memory) in the US-EAST availability zone
Ubuntu 12.04 (ami-fd20ad94 as listed in official ubuntu AMI’s)
MySQL 5.5.28
PostgreSQL 9.2
MongoDB 2.0.4
Drupal 7.17
Drush 5.1
Migrate 2.5
测试的case是分别对MySQL和PostgreSQL进行调优和没有调优,以及配合MongoDB下进行的,具体的优化参数这里先列举一下。
MySQL的优化参数如下:
innodb_flush_log_at_trx_commit=0 innodb_doublewrite=0 log-bin=0 innodb_support_xa=0 innodb_buffer_pool_size=6G innodb_log_file_size=512M
PostgreSQL的优化参数如下:
fsync = off synchronous_commit = off wal_writer_delay = 10000ms wal_buffers = 16MB checkpoint_segments = 64 shared_buffers = 6GB
测试数据集(Dataset)
测试数据集来自于migrate_example_baseball,现在已经是migrate模块(Drupal官网地址: http://www.drupal.org/project/migrate)的一部分了,这些数据包括了美国职业棒球大联盟2000到2009年的数据,每年的数据在一个CSV文件里面。
测试结果
测试环境 | 平均吞吐率 |
---|---|
Default MySQL | 1932 nodes / minute |
Default PostgreSQL | 1649 nodes / minute |
Tuned MySQL | 3024 nodes / minute |
Tuned PostgreSQL | 1772 nodes / minute |
Default MySQL with MongoDB | 4609 nodes / minute |
Default PostgreSQL with MongoDB | 4810 nodes / minute |
Tuned MySQL with MongoDB | 7671 nodes / minute |
Tuned PostgreSQL with MongoDB | 5911 nodes / minute |
结论
一目了然,结果自然不必说,MongoDB的性能肯定比默认数据库的Field Storage要好很多,优化过的数据库肯定比没有优化过的数据库性能要好很多。
不过比较有意思的是,PostgreSQL的测试数据,我们发现,在Drupal7的Field Storage机制里,每个字段都会新建表的机制,对PostgreSQL的影响还是非常大的。因此,用不用MongoDB,对PostgreSQL数据库的影响更大一些。
接下一篇关于Field Storage的测试,请点击查看:
《Drupal7 Field Storage性能之Field SQL Norevisions》
其他问题,请到Drupal大学提问 >
原文地址:Drupal7的Field Storage性能测试报告(译), 感谢原作者分享。

MySQL functions can be used for data processing and calculation. 1. Basic usage includes string processing, date calculation and mathematical operations. 2. Advanced usage involves combining multiple functions to implement complex operations. 3. Performance optimization requires avoiding the use of functions in the WHERE clause and using GROUPBY and temporary tables.

Efficient methods for batch inserting data in MySQL include: 1. Using INSERTINTO...VALUES syntax, 2. Using LOADDATAINFILE command, 3. Using transaction processing, 4. Adjust batch size, 5. Disable indexing, 6. Using INSERTIGNORE or INSERT...ONDUPLICATEKEYUPDATE, these methods can significantly improve database operation efficiency.

In MySQL, add fields using ALTERTABLEtable_nameADDCOLUMNnew_columnVARCHAR(255)AFTERexisting_column, delete fields using ALTERTABLEtable_nameDROPCOLUMNcolumn_to_drop. When adding fields, you need to specify a location to optimize query performance and data structure; before deleting fields, you need to confirm that the operation is irreversible; modifying table structure using online DDL, backup data, test environment, and low-load time periods is performance optimization and best practice.

Use the EXPLAIN command to analyze the execution plan of MySQL queries. 1. The EXPLAIN command displays the execution plan of the query to help find performance bottlenecks. 2. The execution plan includes fields such as id, select_type, table, type, possible_keys, key, key_len, ref, rows and Extra. 3. According to the execution plan, you can optimize queries by adding indexes, avoiding full table scans, optimizing JOIN operations, and using overlay indexes.

Subqueries can improve the efficiency of MySQL query. 1) Subquery simplifies complex query logic, such as filtering data and calculating aggregated values. 2) MySQL optimizer may convert subqueries to JOIN operations to improve performance. 3) Using EXISTS instead of IN can avoid multiple rows returning errors. 4) Optimization strategies include avoiding related subqueries, using EXISTS, index optimization, and avoiding subquery nesting.

Methods for configuring character sets and collations in MySQL include: 1. Setting the character sets and collations at the server level: SETNAMES'utf8'; SETCHARACTERSETutf8; SETCOLLATION_CONNECTION='utf8_general_ci'; 2. Create a database that uses specific character sets and collations: CREATEDATABASEexample_dbCHARACTERSETutf8COLLATEutf8_general_ci; 3. Specify character sets and collations when creating a table: CREATETABLEexample_table(idINT

To safely and thoroughly uninstall MySQL and clean all residual files, follow the following steps: 1. Stop MySQL service; 2. Uninstall MySQL packages; 3. Clean configuration files and data directories; 4. Verify that the uninstallation is thorough.

Renaming a database in MySQL requires indirect methods. The steps are as follows: 1. Create a new database; 2. Use mysqldump to export the old database; 3. Import the data into the new database; 4. Delete the old database.


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

WebStorm Mac version
Useful JavaScript development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

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

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
