作家
登录

MySQL高性能学习笔记

作者: 来源: 2017-08-08 09:47:25 阅读 我要评论

一、Ubuntu 安装mysql

我们在Ubuntu情况下装一个测试用的MySQL来进修。

1.更新包

  1. sudo apt-get update 

2.安装MySQL的办事端和客户端

在安装的过程中,须要输入数据库暗码。

3.启动Mysql

  1. sudo service mysql restart 

4.登录mysql

  1. mysql -u root -p 

二、sysbench基准测试

sysbench是一个开源的、模块化的、跨平台的多线程机能测试对象,可以用来进行CPU、内存、磁盘I/O、线程、数据库的机能测试。今朝支撑的数据库有MySQL、Oracle和PostgreSQL。当前功能许可测试的体系参数有:

scheduler performance (调剂机能)

memory allocation and transfer speed (内存分派和传输速度)

POSIX threads implementation performance (POSIX线程履行绩效)

database server performance (OLTP benchmark) (数据库办事器机能)

1.安装

  1. apt-get install sysbench 

在安装的时刻出现了如许的缺点:Could not get lock /var/lib/dpkg/lock

出现这个问题可能是有别的一个法度榜样正在运行,导致资本被锁弗采取。而导致资本被锁的原因可能是前次运行安装或更新时没有正常完成,进而出现此状况,解决的办法其实很简单:

在终端中敲入以下两句

  1. sudo rm /var/cache/apt/archives/lock 
  2.  
  3. sudo rm /var/lib/dpkg/lock 

再试着安装,问题解决。

2.通悠揭捉?项解释

  1. root@db2:~# sysbench 
  2.  
  3. Missing required command argument. 

Usage: #应用办法

  1. sysbench [general-options]... --test=<test-name> [test-options]... command 

General options: #通悠揭捉?项

--num-threads=N number of threads to use [1] #创建测试线程的数量。默认为1.

--max-requests=N limit for total number of requests [10000] #请求的最大年夜数量。默认为10000,0代表不限制。

--forced-shutdown=STRING amount of time to wait after --max-time before forcing shutdown [off] #跨越max-time强迫中断。默认是off。

--thread-stack-size=SIZE size of stack per thread [32K] #每个线程的客栈大年夜小。默认是32K。

--init-rng=[on|off] initialize random number generator [off] #在测试开端时是否初始化随机数产生器。默认是off。

file I/O performance (文件I / O机能)

--test=STRING test to run #指定测试项目名称。

--debug=[on|off] print more debugging info [off] #是否显示更多的调试信息。默认是off。

--validate=[on|off] perform validation checks where possible [off] #在可能情况下履行验证检查。默认是off。

--help=[on|off] print help and exit #赞助信息。

--version=[on|off] print version and exit #版本信息。

Compiled-in tests: #测试项目

fileio - File I/O test #IO

cpu - CPU performance test #CPU

memory - Memory functions speed test #内存

--oltp-sp-name=STRING 存储过程的名称。默认为空

threads - Threads subsystem performance test #线程

mutex - Mutex performance test #互斥机能测试

oltp - OLTP test # 数据库,事务处理

Commands: prepare:测试前预备工作; run:正式测试 cleanup:测试后删掉落测试数据 help version

清除运行文件:

See 'sysbench --test=<name> help' for a list of options for each test. #查看每个测试项目标更多选项列表

更多选项:

1):sysbench --test=fileio help

  1. root@db2:~# sysbench --test=fileio help 
  2.  
  3. sysbench 0.4.12: multi-threaded system evaluation benchmark 

fileio options:

--file-num=N 创建测试文件的数量。默认是128

--file-block-size=N 测试时文件块的大年夜小。默认是16384(16K)

--file-total-size=SIZE 测试文件的总大年夜小。默认是2G

--file-test-mode=STRING 文件测试模式{seqwr(次序写), seqrewr(次序读写), seqrd(次序读), rndrd(随机读), rndwr(随机写), rndrw(随机读写)}

--file-io-mode=STRING 文件操作模式{sync(同步),async(异步),fastmmap(快速map映射),slowmmap(慢map映射)}。默认是sync

--file-extra-flags=STRING 应用额外的标记来打开文件{sync,dsync,direct} 。默认为空

--file-fsync-freq=N 履行fsync()的频率。(0 – 不应用fsync())。默认是100

 1/4    1 2 3 4 下一页 尾页

  推荐阅读

  智慧农业:手机完成90%的农耕

室外持续高温,王金升正舒畅地在空调房享受着这一消暑时刻,忽然他放在桌子上的手机“滴滴”地响了起来,他经由过程简单的操作,就完成了自家地里的举措措施大年夜棚的┞菲握。>>>详细阅读


本文标题:MySQL高性能学习笔记

地址:http://www.17bianji.com/lsqh/36585.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)