当前位置: 首页 > 编程日记 > 正文

MySQL性能测试工具 mysqlslap

先看参数介绍

FormatOption FileDescriptionIntroduced
--auto-generate-sqlauto-generate-sqlGenerate SQL statements automatically when they are not supplied in files or using command options
--auto-generate-sql-add-autoincrementauto-generate-sql-add-autoincrementAdd AUTO_INCREMENT column to automatically generated tables
--auto-generate-sql-execute-number=#auto-generate-sql-execute-numberSpecify how many queries to generate automatically
--auto-generate-sql-guid-primaryauto-generate-sql-guid-primaryAdd a GUID-based primary key to automatically generated tables
--auto-generate-sql-load-type=typeauto-generate-sql-load-typeSpecify how many queries to generate automatically
--auto-generate-sql-secondary-indexes=#auto-generate-sql-secondary-indexesSpecify how many secondary indexes to add to automatically generated tables
--auto-generate-sql-unique-query-number=#auto-generate-sql-unique-query-numberHow many different queries to generate for automatic tests.
--auto-generate-sql-unique-write-number=#auto-generate-sql-unique-write-numberHow many different queries to generate for --auto-generate-sql-write-number
--auto-generate-sql-write-number=#auto-generate-sql-write-numberHow many row inserts to perform on each thread
--commit=#commitHow many statements to execute before committing.
--compresscompressCompress all information sent between the client and the server
--concurrency=#concurrencyThe number of clients to simulate when issuing the SELECT statement
--create=valuecreateThe file or string containing the statement to use for creating the table
--create-and-drop-schema=valuecreate-and-drop-schemaThe schema in which to run the tests; dropped at the end of the test run5.5.12
--create-schema=valuecreate-schemaThe schema in which to run the tests
--csv=[file]csvGenerate output in comma-separated values format
--debug[=debug_options]debugWrite a debugging log
--debug-checkdebug-checkPrint debugging information when the program exits
--debug-infodebug-infoPrint debugging information, memory and CPU statistics when the program exits
--default-auth=plugindefault-auth=pluginThe authentication plugin to use5.5.10
--delimiter=strdelimiterThe delimiter to use in SQL statements
--detach=#detachDetach (close and reopen) each connection after each N statements
--engine=engine_nameengineThe storage engine to use for creating the table
--helpDisplay help message and exit
--host=host_namehostConnect to the MySQL server on the given host
--iterations=#iterationsThe number of times to run the tests
--number-char-cols=#number-char-colsThe number of VARCHAR columns to use if --auto-generate-sql is specified
--number-int-cols=#number-int-colsThe number of INT columns to use if --auto-generate-sql is specified
--number-of-queries=#number-of-queriesLimit each client to approximately this number of queries
--only-printonly-printDo not connect to databases. mysqlslap only prints what it would have done
--password[=password]passwordThe password to use when connecting to the server
--pipeOn Windows, connect to server using a named pipe
--plugin-dir=pathplugin-dir=pathThe directory where plugins are located5.5.10
--port=port_numportThe TCP/IP port number to use for the connection
--post-query=valuepost-queryThe file or string containing the statement to execute after the tests have completed
--post-system=strpost-systemThe string to execute using system() after the tests have completed
--pre-query=valuepre-queryThe file or string containing the statement to execute before running the tests
--pre-system=strpre-systemThe string to execute using system() before running the tests
--protocol=typeprotocolThe connection protocol to use
--query=valuequeryThe file or string containing the SELECT statement to use for retrieving data
--silentsilentSilent mode
--socket=pathsocketFor connections to localhost
--ssl-ca=file_namessl-caThe path to a file that contains a list of trusted SSL CAs
--ssl-capath=dir_namessl-capathThe path to a directory that contains trusted SSL CA certificates in PEM format
--ssl-cert=file_namessl-certThe name of the SSL certificate file to use for establishing a secure connection
--ssl-cipher=cipher_listssl-cipherA list of allowable ciphers to use for SSL encryption
--ssl-key=file_namessl-keyThe name of the SSL key file to use for establishing a secure connection
--ssl-verify-server-certssl-verify-server-certThe server's Common Name value in its certificate is verified against the host name used when connecting to the server
--user=user_name,userMySQL user name to use when connecting to server
--verboseVerbose mode
--versionDisplay version information and exit

1.使用自动生成脚本测试数据库性能

mysqlslap -uroot -p123 -a --debug-info --concurrency=50,100  --number-of-queries=200 --engine=myisam,innodb

参数介绍

-u : 用户名

-p : 密码

-a (--auto-generate-sql) : 自动生成sql脚本测试数据库

--debug-info : 输出debug信息,包括内存,CPU等

--concurrency : 用户并发数,可填写多个

--number-of-queries : 每个用户的查询次数

--engine : 需要测试的数据库引擎

输出结果:

Benchmark
Running for engine myisam
Average number of seconds to run all queries: 2.092 seconds
Minimum number of seconds to run all queries: 2.092 seconds
Maximum number of seconds to run all queries: 2.092 seconds
Number of clients running queries: 50
Average number of queries per client: 4

Benchmark
Running for engine myisam
Average number of seconds to run all queries: 3.107 seconds
Minimum number of seconds to run all queries: 3.107 seconds
Maximum number of seconds to run all queries: 3.107 seconds
Number of clients running queries: 100
Average number of queries per client: 2

Benchmark
Running for engine innodb
Average number of seconds to run all queries: 2.248 seconds
Minimum number of seconds to run all queries: 2.248 seconds
Maximum number of seconds to run all queries: 2.248 seconds
Number of clients running queries: 50
Average number of queries per client: 4

Benchmark
Running for engine innodb
Average number of seconds to run all queries: 3.514 seconds
Minimum number of seconds to run all queries: 3.514 seconds
Maximum number of seconds to run all queries: 3.514 seconds
Number of clients running queries: 100
Average number of queries per client: 2

2.使用自定义SQL语句测试指定数据库

mysqlslap -uroot -plewis0913 --create-schema="test" --query="select * from user;" --concurrency=50,100 --debug-info

参数介绍

--create-schema : 需要测试的数据库

--query : 需要测试的sql语句

输出结果:

Benchmark
Average number of seconds to run all queries: 2.029 seconds
Minimum number of seconds to run all queries: 2.029 seconds
Maximum number of seconds to run all queries: 2.029 seconds
Number of clients running queries: 50
Average number of queries per client: 1

Benchmark
Average number of seconds to run all queries: 2.544 seconds
Minimum number of seconds to run all queries: 2.544 seconds
Maximum number of seconds to run all queries: 2.544 seconds
Number of clients running queries: 100
Average number of queries per client: 1

转载于:https://www.cnblogs.com/zemliu/archive/2012/08/13/2636905.html

相关文章:

atlas单机模式代码_用代码玩太无聊,这样玩海盗游戏《ATLAS》单机模式才是正确玩法...

在各大单机游戏中,存在很多的代码给玩家使用,利用这些代码,玩家就能和开了挂似得快速通关。这让不少玩家沉迷于代码的世界而无心享受游戏的乐趣,因此在游戏界中经常有代码毁了一款游戏的说法。这点放在最近才上线的海盗冒险生存游…

iSCSI软件套件 介绍

http://blog.csdn.net/do2jiang/article/details/5062586 iSCSI(Internet SCSI)是2003年IETF(InternetEngineering Task Force,互联网工程任务组)制订的一项标准,这种指令集合可以实现在IP网络上运行SCSI协…

【Computer Vision】 复现分割网络(1)——SegNet

目录 Tags: ComputerVision编译数据处理训练结果ReferenceTags: ComputerVision 编译 src/caffe/layers/contrastive_loss_layer.cpp:56:30: error: no matching function for call to ‘max(double, float)’ Dtype dist std::max(margin - sqrt(dist_sq_.cpu_data()[i]), Dt…

kotlin + springboot 整合redis,Redis工具类编写及单元测试

参考自&#xff1a; https://www.cnblogs.com/zeng1994/p/03303c805731afc9aa9c60dbbd32a323.html 1、maven依赖 <?xml version"1.0" encoding"UTF-8"?> <project xmlns"http://maven.apache.org/POM/4.0.0" xmlns:xsi"http://…

:before和::before的区别

在一次项目中&#xff0c;有一次要用到::selection伪元素&#xff0c;然后开发同学问我&#xff0c;CSS中一个冒号和两个冒号有神马区别&#xff1f; 这好像真的是个问题&#xff0c;或许很多前端同学对此都有疑惑&#xff0c;查了些资料&#xff0c;证实了下两个符号的区别&am…

python下载大文件mp4_python合并大量ts文件成mp4格式(ps:上限是450,亲测)

原博文 2018-08-22 17:34 − 1 import os 2 #exec_str rcopy /b ts/c9645620628078.tsts/c9645620628079.ts ts/1.ts 3 #os.system(exec_str) 4 f open(index.m3u8, r, encod...08595 相关推荐 2019-12-19 14:27 − ts readonly name "xxx"; updateValueAndValidi…

提高网站页面收录的几个方法 返回列表 发新帖回复

首先是清楚网站总体有多少页面。 可以用xenu扫描出所有的页面。 1.html地图 网页数量不是太多&#xff0c;可以用网站地图来增加收录&#xff0c;分成几个地图页面。 2.随机文章模块 在不影响用户体验的情况下&#xff0c;在栏目中增加随机文章模块&#xff0c;增加链接曝光度&…

JSP+Servlet+JavaBean

JSP相当于在HTML页面中加上Java代码&#xff0c;一般在<body>标签中放入主要代码。 在JSP里用<%...%>把Java代码包含起来的。 Servlet的生命周期&#xff1a; ①被服务器实例化后&#xff0c;容器运行init方法。 ②当请求&#xff08;Request&#xff09;到达时&am…

logistic回归 如何_第七章:利用Python实现Logistic回归分类模型

免责声明&#xff1a;本文是通过网络收集并结合自身学习等途径合法获取&#xff0c;仅作为学习交流使用&#xff0c;其版权归出版社或者原创作者所有&#xff0c;并不对涉及的版权问题负责。若原创作者或者出版社认为侵权&#xff0c;请联系及时联系&#xff0c;我将立即删除文…

多年没有管理的技术博客了,即日起开始管理起技术博客

多年没有管理的技术博客了&#xff0c;即日起开始管理起技术博客&#xff0c;希望朋友们一如既往的支持转载于:https://www.cnblogs.com/flashicp/archive/2012/08/14/2639054.html

GNS3的默认Telnet程序改成secureCRT

编辑-首选项-一般里的“终端命令”改为C:\Users\ldy\AppData\Local\VanDyke Software\SecureCRT\SecureCRT.exe /t /telnet %h %p 前面是SecureCRT程序的目录&#xff0c; /t是指建立一个新标签 &#xff0c; /telnet的意思是走Telnet协议&#xff0c; %h是要telnet到的主机&am…

关于Vue实例的生命周期created和mounted的区别

关于作者 程序开发人员&#xff0c;不拘泥于语言与技术&#xff0c;目前主要从事PHP和前端开发&#xff0c;使用Laravel和VueJs&#xff0c;App端使用Apicloud混合式开发。合适和够用是最完美的追求。 个人网站&#xff1a;http://www.linganmin.cn 最近刚写了一个手机在线播放…

UVa 10112 - Myacm Triangles

UVa第一卷最后一题。 求内部不含点并且面积最大的三角形。 暴力。 代码如下&#xff1a; 1 #include<iostream>2 #include<cstdio>3 #include<cmath>4 #include<cstring>5 6 using namespace std;7 8 typedef struct node9 { 10 char ch; 11 i…

[转]ASP.NET1.0升级ASP.NET2.0问题总结

来自&#xff1a;http://www.enet.com.cn/article/2006/0310/A20060310510518.shtml1&#xff0e;Global.asax文件的处理形式不一样&#xff0c;转化后将出现错误 在vs2003中Global.asax具有代码后置文件&#xff0c;2.0下, 将代码分离文件移到 App_Code 目录下&#xff0c;以便…

python文本编码转换_Python: 转换文本编码

最近在做周报的时候&#xff0c;需要把csv文本中的数据提取出来制作表格后生产图表。 在获取csv文本内容的时候&#xff0c;基本上都是用with open(filename, encoding UTF-8) as f:来打开csv文本&#xff0c;但是实际使用过程中发现有些csv文本并不是utf-8格式&#xff0c;从而…

ipone 网页版的iphone

本文摘自&#xff1a;http://www.cocoachina.com/bbs/m/list.php?fid6#list

import static

import static&#xff08;静态导入&#xff09;是JDK1.5中的新特性&#xff0c;一般我们导入一个类都用 import com.....ClassName;而静态导入是这样&#xff1a;import static com.....ClassName.*;这里多了个static&#xff0c;还有就是类名ClassName后面多了个 .* &#xf…

poj1423

http://acm.pku.edu.cn/JudgeOnline/problem?id1423n!(log10(sqrt(4.0*acos(0.0)*n))n*(log10(n)-log10(exp(1.0)))1);n1 除外 转载于:https://www.cnblogs.com/FCWORLD/archive/2011/03/12/1982355.html

python缩进在程序中长度统一且强制使用_Python习题纠错1

February, 1991 0.9.1 2.Python语言的缩进只要统一即可&#xff0c;不一定是4个空格&#xff08;尽管这是惯例&#xff09;。 Python缩进在程序中长度统一且强制使用. 3.IPO&#xff1a;Input Process Output 4.Python合法命名的首字符不能是数字。 5.Python保留字&#xff1a;…

ASP.NET MVC3 在WebGrid中用CheckBox选中行

分三步走 1.保证你的webgrid包含在form中 using (Html.BeginForm("Assign","Home")) { } 2.在webgrid中加一列checkbox grid.Column(header: "Assign?", format: <text><input class"check-box" id"assi…

Delphi中使用IXMLHTTPRequest如何用POST方式提交带参

http://blog.sina.com.cn/s/blog_51a71c010100gbua.html说明&#xff1a;服务器端为JAVA&#xff0c;编码UTF-8&#xff0c;返回数据编码UTF-8&#xff1b;数据交换格式JSON。procedure TloginForm.loginBtnClick(Sender: TObject);var jo: ISuperObject; //JSON接口 req: IX…

Windows图标:有一些你未必知道的东西

有一天&#xff0c;我的程序在任务栏的应用程序中看起来是这样的很奇怪&#xff0c;我的图标明明不是这样的&#xff0c;在资源管理器的文件夹里面&#xff0c;我的图标能够正常显示&#xff0c;在桌面的任务栏里&#xff0c;也能正常的显示&#xff0c;唯独在任务管理器里显示…

几种函数式编程语言

1、函数式编程语言有&#xff1a;lisp,hashshell,erlang等。 2、在函数中的参数&#xff0c;有一一对应的&#xff0c;也有指定模式的&#xff0c;还有使用能数组。如*argp&#xff08;元组&#xff09;&#xff0c;**argp(字典&#xff09;。 3、在pyphon语言中有一些内置的函…

python逐个读取文件并处理_逐个读取多个文件并用python进行处理

我在python中使用Pybrain&#xff08;神经网络库&#xff09;进行图像处理。我在一个目录中有196个文件&#xff0c;它保存在下面代码中的所有_文件中。我试着打开每个文件并分别对每个文件进行处理&#xff0c;但它将所有文件数据放在一个字符串中&#xff0c;我希望每个文件逐…

HDU 2102 A计划

该题是一道典型的搜索题&#xff0c; #include<stdio.h> #include<stdlib.h> #include<string.h> struct Node {int x, y;int time;int flag; }q[100024]; int d[4][2]{ 0,1,1,0,0,-1,-1,0 }; int N,M; char map[2][13][13]; void getxy( int &X,int &a…

node.js是做什么的?

作者&#xff1a;厂长链接&#xff1a;https://www.zhihu.com/question/33578075/answer/56951771来源&#xff1a;知乎著作权归作者所有。商业转载请联系作者获得授权&#xff0c;非商业转载请注明出处。国外有一篇非常好的Node.js 介绍文章&#xff0c;从原理入手讲解&#x…

K8S - Kubernetes简介

Kubernetes Kubernetes&#xff08;简称K8s&#xff0c;用8代替8个字符“ubernete”&#xff09;是Google开源的一个容器编排引擎&#xff0c;支持自动化部署、大规模可伸缩、应用容器化管理。 Kubernetes 是目前最为广泛且流行的容器编排调度系统&#xff0c;也是现在用来构建…

python中filenotfounderror_Python3 报错 FileNotFoundError: [WinError 2]

Python3 报错 FileNotFoundError: [WinError 2]工具/原料 Python3.7 chromedriver 方法/步骤 1 首先&#xff0c;打开py文件&#xff0c;如图&#xff0c;有如下代码。 import time from selenium import webdriver driver webdriver.Chrome()2 然后运行py文件&#xff0c;run…

Push Notifications

push notification 使用&#xff1a; 参考资源: http://tiny4cocoa.com/thread-1406-1-1.html http://bbs.ldci.com.cn/read.php?tid-19971.html http://www.cocoachina.com/bbs/read.php?tid-3770-keyword-apns.html http://code.google.com/p/apns-python-wrapper/ http://…

[原创]Bash中的$*和$@的区别

2019独角兽企业重金招聘Python工程师标准>>> 在Bash脚本中&#xff0c;$*和$都用于表示执行脚本时所传入的参数。先通过一个例子看看他们的区别: #!/bin/bash # testvar.sh echo "-------------ISF is set to \"-seperator\" ------------" IFS…