SlideShare a Scribd company logo
1 of 17
Download to read offline
MySQL key partition and MongoDB TEST

对于业务的激活码需求做了一次关于 mysql,mongodb 的比对.mysql 分为 normal,key partition 数量分别是1亿和10亿数据,mysql 采用直接访问 PK 键,partition key


为 PK,mysql table size 为90G,mongodb table size 为157G。




 [liuyang@yhdem ~]$ cat /proc/cpuinfo   |grep processor |wc -l
 24


 [liuyang@yhdem ~]$ cat /etc/issue
 Oracle Linux Server release 5.8
 Kernel r on an m



mysql evn:




 mysql> select version();
 +-----------+
 | version() |
 +-----------+
 | 5.5.25a   |
 +-----------+
 1 row in set (0.00 sec)
log_bin[OFF] innodb_flush_log_at_trx_commit [2]   query_cache_type[OFF]
max_connect_errors[10] max_connections[214] max_user_connections[0]
sync_binlog[0] table_definition_cache[400]
table_open_cache[400] thread_cache_size[8]   open_files_limit[30000]
innodb_adaptive_flushing[ON]                        innodb_adaptive_hash_index[ON]
innodb_buffer_pool_size[30.234375G]
innodb_file_per_table[ON] innodb_flush_log_at_trx_commit[2] innodb_flush_method[]
innodb_io_capacity[200]                              innodb_lock_wait_timeout[100]
innodb_log_buffer_size[128M]
innodb_log_file_size[200M]                            innodb_log_files_in_group[2]
innodb_max_dirty_pages_pct[75]
innodb_open_files[1600] innodb_read_io_threads[4] innodb_thread_concurrency[0]
innodb_write_io_threads[4]
以下图片均为 QPS 统计,TPS 测试暂时没有做




no partition table with one billion rows –> small random select by pk
xDiskName Busy Read WriteKB|0         |25        |50         |75   100|
xsda       1%    2.0  35.9|>                                        |
xsda1      0%    0.0   0.0|>                                        |
xsda2      0%    0.0   0.0|>                                        |
xsda3      0%    0.0   0.0|>                                        |
xsda4      0%    0.0   0.0|>disk busy not available                   |
xsda5      0%    0.0   0.0|>                                        |
xsda6      1%    2.0  35.9|>                                        |
xsdb       0%    0.0  55.9|>                                        |
xsdb1      0%    0.0  55.9|>                                        |
xTotals Read-MB/s=0.0     Writes-MB/s=0.2     Transfers/sec=18.0
partition table with one billion rows –> small random select by pk
xDiskName Busy Read WriteKB|0         |25        |50         |75   100|
xsda       0%    0.0   8.0|>                                        |
xsda1      0%    0.0   0.0|>                                        |
xsda2      0%    0.0   8.0|>                                        |
xsda3      0%    0.0   0.0|>                                        |
xsda4      0%    0.0   0.0|>disk busy not available                   |
xsda5      0%    0.0   0.0|>                                        |
xsda6      0%    0.0   0.0|>                                        |
xsdb       0%    0.0 201.5|                       >                 |
xsdb1      0%    0.0 201.5|W                      >                 |
xTotals Read-MB/s=0.0     Writes-MB/s=0.4     Transfers/sec=46.9
no partition table with one billion rows –> full random select by pk
xDiskName Busy Read WriteMB|0          |25        |50         |75       100|
xsda        0%   0.0    0.0| >                                           |
xsda1       0%   0.0    0.0|>                                            |
xsda2       0%   0.0    0.0|>                                            |
xsda3       0%   0.0    0.0|>                                            |
xsda4       0%   0.0    0.0|>disk busy not available                       |
xsda5       0%   0.0    0.0|>                                            |
xsda6       0%   0.0    0.0| >                                           |
xsdb     100%   86.8    0.2|RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR>
xsdb1     100%  86.8    0.2|RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR>
xTotals Read-MB/s=173.6    Writes-MB/s=0.4     Transfers/sec=6448.1
partition table with one billion rows –> full random select by pk
xDiskName Busy Read WriteMB|0          |25        |50         |75       100|
xsda        0%   0.0    0.0| >                                           |
xsda1       0%   0.0    0.0|>                                            |
xsda2       0%   0.0    0.0| >                                           |
xsda3       0%   0.0    0.0|>                                            |
xsda4       0%   0.0    0.0|>disk busy not available                       |
xsda5       0%   0.0    0.0|>                                            |
xsda6       0%   0.0    0.0| >                                           |
xsdb     100%   89.6    0.2|RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR>
xsdb1     100%  89.6    0.2|                                             >
xTotals Read-MB/s=179.2    Writes-MB/s=0.3     Transfers/sec=6539.3
no partition table with 100 million rows –> full random select by pk
下面基于 mongodb 的 TEST.同样为 10 亿的表,157G.
               TEST.同样为    亿的表,157G.




[root@db-13 tmp]# mongo
MongoDB shell version: 2.0.8
connecting to: test
> db.foo.totalSize();
157875838416
> db.foo.find().count();
1000000000
第一次 使用128G 满额内存 16thread,10亿 random query:
    使用128G      16thread,10亿




[root@db-13 tmp]# mongo test ./mongodb_benchmark_query.js
MongoDB shell version: 2.0.8
connecting to: test
threads: 16     queries/sec: 126151.69666666667



第二次 使用128G 内存 24 thread,10亿中的前1亿数据 random query:
    使用128G       thread,10亿中的前
                          亿中的前1




[root@db-13 tmp]# mongo test ./mongodb_benchmark_query.js
MongoDB shell version: 2.0.8
connecting to: test
threads: 24     queries/sec: 166527.42333333334
第三次 使用 mysql 用户启动 mongo 限制 mysql 用户的 mem 为24G 24 thread , 10亿中的前1亿数据 random query :
                                                          10亿中的前
                                                            亿中的前1




[mysql@db-13 ~]$ ulimit -a
core file size           (blocks, -c) 0
data seg size            (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 1052672
max locked memory        (kbytes, -l) 26055452
max memory size          (kbytes, -m) 26055452
open files                      (-n) 131072
pipe size             (512 bytes, -p) 8
POSIX message queues      (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) unlimited
virtual memory           (kbytes, -v) unlimited
file locks                      (-x) unlimited


[mysql@db-13 tmp]$ mongo test ./mongodb_benchmark_query.js
MongoDB shell version: 2.0.8
connecting to: test
threads: 24   queries/sec: 161358.03333333333
第四次 使用 mysql 用户启动 mongo 限制 mysql 用户的 mem 为24G 24 thread , 10亿 random query :
                                                          10亿




 [mysql@db-13 tmp]$ mongo test ./mongodb_benchmark_query.js
 MongoDB shell version: 2.0.8
 connecting to: test
 threads: 24   queries/sec: 2549.2 ----------------------> 这里出现了物理 IO 读写




-----     以下是不用缓存磁盘随机 IO 下的测试结果:



mongodb 初始只用了13M 内存




测试结果:
—提供查询脚本




ops = [{op:"findOne", ns:"test.foo", query: {_id : {"#RAND_INT": [ 1 , 100000000 ] } }}]
x=24
 {
     res = benchRun( {
       parallel : x ,
        seconds : 60 ,
        ops : ops
     } );
     print("threads: "+ x +"t queries/sec: "+ res.query );
}
END :



10亿 normal table 对于1亿 normal table 在内存基于 PK 的访问没有衰减,10亿的 partition table 对于 10亿的 normal table 在内存中衰减了2/3,10亿的 partition


table 对于10亿的 normal table 在 full table out of memory 的情况下 性能有所提升 (另外注意激活码基本只会被访问1次)对于 mongodb 来说,这种业务模式需求


完全可以搞定,在内存充足的情况下 QPS 达到了16W+/s,但是在内存不足的情况下,暴跌至2549,在 mem cache 完全清除的情况下,QPS 为149/s,基于这次业务需求为一


张 very large table (暂估500GB),因此决定使用 mysql 而不是 mongodb.

More Related Content

Similar to My sql key partition and mongodb test

2010-08-26-mongodb-step-by-step-by-hexnova
2010-08-26-mongodb-step-by-step-by-hexnova2010-08-26-mongodb-step-by-step-by-hexnova
2010-08-26-mongodb-step-by-step-by-hexnovaccdaisy
 
Percona Live UK 2014 Part III
Percona Live UK 2014  Part IIIPercona Live UK 2014  Part III
Percona Live UK 2014 Part IIIAlkin Tezuysal
 
Performance tuning
Performance tuningPerformance tuning
Performance tuningJon Haddad
 
Understanding Performance with DTrace
Understanding Performance with DTraceUnderstanding Performance with DTrace
Understanding Performance with DTraceahl0003
 
Практический опыт профайлинга и оптимизации производительности Ruby-приложений
Практический опыт профайлинга и оптимизации производительности Ruby-приложенийПрактический опыт профайлинга и оптимизации производительности Ruby-приложений
Практический опыт профайлинга и оптимизации производительности Ruby-приложенийOlga Lavrentieva
 
Профилирование и оптимизация производительности Ruby-кода
Профилирование и оптимизация производительности Ruby-кодаПрофилирование и оптимизация производительности Ruby-кода
Профилирование и оптимизация производительности Ruby-кодаsamsolutionsby
 
Become a Java GC Hero - All Day Devops
Become a Java GC Hero - All Day DevopsBecome a Java GC Hero - All Day Devops
Become a Java GC Hero - All Day DevopsTier1app
 
Tweaking perfomance on high-load projects_Думанский Дмитрий
Tweaking perfomance on high-load projects_Думанский ДмитрийTweaking perfomance on high-load projects_Думанский Дмитрий
Tweaking perfomance on high-load projects_Думанский ДмитрийGeeksLab Odessa
 
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Jayesh Thakrar
 
MySQL Tokudb engine benchmark
MySQL Tokudb engine benchmarkMySQL Tokudb engine benchmark
MySQL Tokudb engine benchmarkLouis liu
 
Mongodb debugging-performance-problems
Mongodb debugging-performance-problemsMongodb debugging-performance-problems
Mongodb debugging-performance-problemsMongoDB
 
ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)YoungHeon (Roy) Kim
 
Cassandra Day SV 2014: Basic Operations with Apache Cassandra
Cassandra Day SV 2014: Basic Operations with Apache CassandraCassandra Day SV 2014: Basic Operations with Apache Cassandra
Cassandra Day SV 2014: Basic Operations with Apache CassandraDataStax Academy
 
Update on OpenTSDB and AsyncHBase
Update on OpenTSDB and AsyncHBase Update on OpenTSDB and AsyncHBase
Update on OpenTSDB and AsyncHBase HBaseCon
 
GC Tuning & Troubleshooting Crash Course
GC Tuning & Troubleshooting Crash CourseGC Tuning & Troubleshooting Crash Course
GC Tuning & Troubleshooting Crash CourseTier1 app
 
Big Data Analytics with MariaDB ColumnStore
Big Data Analytics with MariaDB ColumnStoreBig Data Analytics with MariaDB ColumnStore
Big Data Analytics with MariaDB ColumnStoreMariaDB plc
 

Similar to My sql key partition and mongodb test (20)

Cassandra
CassandraCassandra
Cassandra
 
2010-08-26-mongodb-step-by-step-by-hexnova
2010-08-26-mongodb-step-by-step-by-hexnova2010-08-26-mongodb-step-by-step-by-hexnova
2010-08-26-mongodb-step-by-step-by-hexnova
 
Percona Live UK 2014 Part III
Percona Live UK 2014  Part IIIPercona Live UK 2014  Part III
Percona Live UK 2014 Part III
 
Performance tuning
Performance tuningPerformance tuning
Performance tuning
 
Tek tutorial
Tek tutorialTek tutorial
Tek tutorial
 
Understanding Performance with DTrace
Understanding Performance with DTraceUnderstanding Performance with DTrace
Understanding Performance with DTrace
 
DPC Tutorial
DPC TutorialDPC Tutorial
DPC Tutorial
 
Практический опыт профайлинга и оптимизации производительности Ruby-приложений
Практический опыт профайлинга и оптимизации производительности Ruby-приложенийПрактический опыт профайлинга и оптимизации производительности Ruby-приложений
Практический опыт профайлинга и оптимизации производительности Ruby-приложений
 
Профилирование и оптимизация производительности Ruby-кода
Профилирование и оптимизация производительности Ruby-кодаПрофилирование и оптимизация производительности Ruby-кода
Профилирование и оптимизация производительности Ruby-кода
 
Undrop for InnoDB
Undrop for InnoDBUndrop for InnoDB
Undrop for InnoDB
 
Become a Java GC Hero - All Day Devops
Become a Java GC Hero - All Day DevopsBecome a Java GC Hero - All Day Devops
Become a Java GC Hero - All Day Devops
 
Tweaking perfomance on high-load projects_Думанский Дмитрий
Tweaking perfomance on high-load projects_Думанский ДмитрийTweaking perfomance on high-load projects_Думанский Дмитрий
Tweaking perfomance on high-load projects_Думанский Дмитрий
 
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
Chicago-Java-User-Group-Meetup-Some-Garbage-Talk-2015-01-14
 
MySQL Tokudb engine benchmark
MySQL Tokudb engine benchmarkMySQL Tokudb engine benchmark
MySQL Tokudb engine benchmark
 
Mongodb debugging-performance-problems
Mongodb debugging-performance-problemsMongodb debugging-performance-problems
Mongodb debugging-performance-problems
 
ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)ProxySQL & PXC(Query routing and Failover Test)
ProxySQL & PXC(Query routing and Failover Test)
 
Cassandra Day SV 2014: Basic Operations with Apache Cassandra
Cassandra Day SV 2014: Basic Operations with Apache CassandraCassandra Day SV 2014: Basic Operations with Apache Cassandra
Cassandra Day SV 2014: Basic Operations with Apache Cassandra
 
Update on OpenTSDB and AsyncHBase
Update on OpenTSDB and AsyncHBase Update on OpenTSDB and AsyncHBase
Update on OpenTSDB and AsyncHBase
 
GC Tuning & Troubleshooting Crash Course
GC Tuning & Troubleshooting Crash CourseGC Tuning & Troubleshooting Crash Course
GC Tuning & Troubleshooting Crash Course
 
Big Data Analytics with MariaDB ColumnStore
Big Data Analytics with MariaDB ColumnStoreBig Data Analytics with MariaDB ColumnStore
Big Data Analytics with MariaDB ColumnStore
 

More from Louis liu

Tcpcopy benchmark
Tcpcopy benchmarkTcpcopy benchmark
Tcpcopy benchmarkLouis liu
 
JK Log-Center architect
JK Log-Center architectJK Log-Center architect
JK Log-Center architectLouis liu
 
JKDB BACKUP Introduction
JKDB BACKUP IntroductionJKDB BACKUP Introduction
JKDB BACKUP IntroductionLouis liu
 
Infiniflash benchmark
Infiniflash benchmarkInfiniflash benchmark
Infiniflash benchmarkLouis liu
 
Nvmfs benchmark
Nvmfs benchmarkNvmfs benchmark
Nvmfs benchmarkLouis liu
 
MySQL 5.7 milestone
MySQL 5.7 milestoneMySQL 5.7 milestone
MySQL 5.7 milestoneLouis liu
 
MySQL Oslayer performace optimization
MySQL  Oslayer performace optimizationMySQL  Oslayer performace optimization
MySQL Oslayer performace optimizationLouis liu
 
MySQL async message subscription platform
MySQL async message subscription platformMySQL async message subscription platform
MySQL async message subscription platformLouis liu
 
HBASE Performane Test
HBASE Performane TestHBASE Performane Test
HBASE Performane TestLouis liu
 
Jkcn MySQLDB 架构
Jkcn MySQLDB 架构Jkcn MySQLDB 架构
Jkcn MySQLDB 架构Louis liu
 
基于Mongodb的压力评测工具 ycsb的一些概括
基于Mongodb的压力评测工具 ycsb的一些概括基于Mongodb的压力评测工具 ycsb的一些概括
基于Mongodb的压力评测工具 ycsb的一些概括Louis liu
 
My sql fabric ha and sharding solutions
My sql fabric ha and sharding solutionsMy sql fabric ha and sharding solutions
My sql fabric ha and sharding solutionsLouis liu
 
NetApp ef540 SSD Storage Test
NetApp ef540 SSD Storage TestNetApp ef540 SSD Storage Test
NetApp ef540 SSD Storage TestLouis liu
 
Exadata best practice on E-commerce area
Exadata best practice on E-commerce area Exadata best practice on E-commerce area
Exadata best practice on E-commerce area Louis liu
 
MySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summaryMySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summaryLouis liu
 
Ssd gc review
Ssd gc reviewSsd gc review
Ssd gc reviewLouis liu
 
1号店数据库架构
1号店数据库架构1号店数据库架构
1号店数据库架构Louis liu
 
Architecture of YHD
Architecture of YHDArchitecture of YHD
Architecture of YHDLouis liu
 

More from Louis liu (20)

Tcpcopy benchmark
Tcpcopy benchmarkTcpcopy benchmark
Tcpcopy benchmark
 
JK Log-Center architect
JK Log-Center architectJK Log-Center architect
JK Log-Center architect
 
Wdt Test
Wdt TestWdt Test
Wdt Test
 
JKDB BACKUP Introduction
JKDB BACKUP IntroductionJKDB BACKUP Introduction
JKDB BACKUP Introduction
 
Infiniflash benchmark
Infiniflash benchmarkInfiniflash benchmark
Infiniflash benchmark
 
Nvmfs benchmark
Nvmfs benchmarkNvmfs benchmark
Nvmfs benchmark
 
MySQL 5.7 milestone
MySQL 5.7 milestoneMySQL 5.7 milestone
MySQL 5.7 milestone
 
MySQL Oslayer performace optimization
MySQL  Oslayer performace optimizationMySQL  Oslayer performace optimization
MySQL Oslayer performace optimization
 
MySQL async message subscription platform
MySQL async message subscription platformMySQL async message subscription platform
MySQL async message subscription platform
 
HBASE Performane Test
HBASE Performane TestHBASE Performane Test
HBASE Performane Test
 
Jkcn MySQLDB 架构
Jkcn MySQLDB 架构Jkcn MySQLDB 架构
Jkcn MySQLDB 架构
 
基于Mongodb的压力评测工具 ycsb的一些概括
基于Mongodb的压力评测工具 ycsb的一些概括基于Mongodb的压力评测工具 ycsb的一些概括
基于Mongodb的压力评测工具 ycsb的一些概括
 
My sql fabric ha and sharding solutions
My sql fabric ha and sharding solutionsMy sql fabric ha and sharding solutions
My sql fabric ha and sharding solutions
 
NetApp ef540 SSD Storage Test
NetApp ef540 SSD Storage TestNetApp ef540 SSD Storage Test
NetApp ef540 SSD Storage Test
 
Exadata best practice on E-commerce area
Exadata best practice on E-commerce area Exadata best practice on E-commerce area
Exadata best practice on E-commerce area
 
MySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summaryMySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summary
 
Ssd gc review
Ssd gc reviewSsd gc review
Ssd gc review
 
1号店数据库架构
1号店数据库架构1号店数据库架构
1号店数据库架构
 
Architecture of YHD
Architecture of YHDArchitecture of YHD
Architecture of YHD
 
Oracle dgha
Oracle dghaOracle dgha
Oracle dgha
 

Recently uploaded

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Bhuvaneswari Subramani
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 

Recently uploaded (20)

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 

My sql key partition and mongodb test

  • 1. MySQL key partition and MongoDB TEST 对于业务的激活码需求做了一次关于 mysql,mongodb 的比对.mysql 分为 normal,key partition 数量分别是1亿和10亿数据,mysql 采用直接访问 PK 键,partition key 为 PK,mysql table size 为90G,mongodb table size 为157G。 [liuyang@yhdem ~]$ cat /proc/cpuinfo |grep processor |wc -l 24 [liuyang@yhdem ~]$ cat /etc/issue Oracle Linux Server release 5.8 Kernel r on an m mysql evn: mysql> select version(); +-----------+ | version() | +-----------+ | 5.5.25a | +-----------+ 1 row in set (0.00 sec)
  • 2. log_bin[OFF] innodb_flush_log_at_trx_commit [2] query_cache_type[OFF] max_connect_errors[10] max_connections[214] max_user_connections[0] sync_binlog[0] table_definition_cache[400] table_open_cache[400] thread_cache_size[8] open_files_limit[30000] innodb_adaptive_flushing[ON] innodb_adaptive_hash_index[ON] innodb_buffer_pool_size[30.234375G] innodb_file_per_table[ON] innodb_flush_log_at_trx_commit[2] innodb_flush_method[] innodb_io_capacity[200] innodb_lock_wait_timeout[100] innodb_log_buffer_size[128M] innodb_log_file_size[200M] innodb_log_files_in_group[2] innodb_max_dirty_pages_pct[75] innodb_open_files[1600] innodb_read_io_threads[4] innodb_thread_concurrency[0] innodb_write_io_threads[4]
  • 3. 以下图片均为 QPS 统计,TPS 测试暂时没有做 no partition table with one billion rows –> small random select by pk
  • 4. xDiskName Busy Read WriteKB|0 |25 |50 |75 100| xsda 1% 2.0 35.9|> | xsda1 0% 0.0 0.0|> | xsda2 0% 0.0 0.0|> | xsda3 0% 0.0 0.0|> | xsda4 0% 0.0 0.0|>disk busy not available | xsda5 0% 0.0 0.0|> | xsda6 1% 2.0 35.9|> | xsdb 0% 0.0 55.9|> | xsdb1 0% 0.0 55.9|> | xTotals Read-MB/s=0.0 Writes-MB/s=0.2 Transfers/sec=18.0
  • 5. partition table with one billion rows –> small random select by pk
  • 6. xDiskName Busy Read WriteKB|0 |25 |50 |75 100| xsda 0% 0.0 8.0|> | xsda1 0% 0.0 0.0|> | xsda2 0% 0.0 8.0|> | xsda3 0% 0.0 0.0|> | xsda4 0% 0.0 0.0|>disk busy not available | xsda5 0% 0.0 0.0|> | xsda6 0% 0.0 0.0|> | xsdb 0% 0.0 201.5| > | xsdb1 0% 0.0 201.5|W > | xTotals Read-MB/s=0.0 Writes-MB/s=0.4 Transfers/sec=46.9
  • 7. no partition table with one billion rows –> full random select by pk
  • 8. xDiskName Busy Read WriteMB|0 |25 |50 |75 100| xsda 0% 0.0 0.0| > | xsda1 0% 0.0 0.0|> | xsda2 0% 0.0 0.0|> | xsda3 0% 0.0 0.0|> | xsda4 0% 0.0 0.0|>disk busy not available | xsda5 0% 0.0 0.0|> | xsda6 0% 0.0 0.0| > | xsdb 100% 86.8 0.2|RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR> xsdb1 100% 86.8 0.2|RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR> xTotals Read-MB/s=173.6 Writes-MB/s=0.4 Transfers/sec=6448.1
  • 9. partition table with one billion rows –> full random select by pk
  • 10. xDiskName Busy Read WriteMB|0 |25 |50 |75 100| xsda 0% 0.0 0.0| > | xsda1 0% 0.0 0.0|> | xsda2 0% 0.0 0.0| > | xsda3 0% 0.0 0.0|> | xsda4 0% 0.0 0.0|>disk busy not available | xsda5 0% 0.0 0.0|> | xsda6 0% 0.0 0.0| > | xsdb 100% 89.6 0.2|RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR> xsdb1 100% 89.6 0.2| > xTotals Read-MB/s=179.2 Writes-MB/s=0.3 Transfers/sec=6539.3
  • 11. no partition table with 100 million rows –> full random select by pk
  • 12. 下面基于 mongodb 的 TEST.同样为 10 亿的表,157G. TEST.同样为 亿的表,157G. [root@db-13 tmp]# mongo MongoDB shell version: 2.0.8 connecting to: test > db.foo.totalSize(); 157875838416 > db.foo.find().count(); 1000000000
  • 13. 第一次 使用128G 满额内存 16thread,10亿 random query: 使用128G 16thread,10亿 [root@db-13 tmp]# mongo test ./mongodb_benchmark_query.js MongoDB shell version: 2.0.8 connecting to: test threads: 16 queries/sec: 126151.69666666667 第二次 使用128G 内存 24 thread,10亿中的前1亿数据 random query: 使用128G thread,10亿中的前 亿中的前1 [root@db-13 tmp]# mongo test ./mongodb_benchmark_query.js MongoDB shell version: 2.0.8 connecting to: test threads: 24 queries/sec: 166527.42333333334
  • 14. 第三次 使用 mysql 用户启动 mongo 限制 mysql 用户的 mem 为24G 24 thread , 10亿中的前1亿数据 random query : 10亿中的前 亿中的前1 [mysql@db-13 ~]$ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 1052672 max locked memory (kbytes, -l) 26055452 max memory size (kbytes, -m) 26055452 open files (-n) 131072 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) unlimited virtual memory (kbytes, -v) unlimited file locks (-x) unlimited [mysql@db-13 tmp]$ mongo test ./mongodb_benchmark_query.js MongoDB shell version: 2.0.8 connecting to: test threads: 24 queries/sec: 161358.03333333333
  • 15. 第四次 使用 mysql 用户启动 mongo 限制 mysql 用户的 mem 为24G 24 thread , 10亿 random query : 10亿 [mysql@db-13 tmp]$ mongo test ./mongodb_benchmark_query.js MongoDB shell version: 2.0.8 connecting to: test threads: 24 queries/sec: 2549.2 ----------------------> 这里出现了物理 IO 读写 ----- 以下是不用缓存磁盘随机 IO 下的测试结果: mongodb 初始只用了13M 内存 测试结果:
  • 16. —提供查询脚本 ops = [{op:"findOne", ns:"test.foo", query: {_id : {"#RAND_INT": [ 1 , 100000000 ] } }}] x=24 { res = benchRun( { parallel : x , seconds : 60 , ops : ops } ); print("threads: "+ x +"t queries/sec: "+ res.query ); }
  • 17. END : 10亿 normal table 对于1亿 normal table 在内存基于 PK 的访问没有衰减,10亿的 partition table 对于 10亿的 normal table 在内存中衰减了2/3,10亿的 partition table 对于10亿的 normal table 在 full table out of memory 的情况下 性能有所提升 (另外注意激活码基本只会被访问1次)对于 mongodb 来说,这种业务模式需求 完全可以搞定,在内存充足的情况下 QPS 达到了16W+/s,但是在内存不足的情况下,暴跌至2549,在 mem cache 完全清除的情况下,QPS 为149/s,基于这次业务需求为一 张 very large table (暂估500GB),因此决定使用 mysql 而不是 mongodb.