当前位置: 首页 > news >正文

如何找有需求做网站的公司苏州网站建设公司排名

如何找有需求做网站的公司,苏州网站建设公司排名,咸宁网站设计制作,做西式快餐店网站mysql5.7数据库安装及性能测试 记录Centos7.9下安装mysql 5.7并利用benchmark工具简单测试mysql的性能。 测试机#xff1a;centos7.9 配置#xff1a;4C8G40G 1. 下安装mysql5.7 安装mysql5.7#xff1a; # 通过官方镜像源安装$ wget http://dev.mysql.com/get/mysql57-com… mysql5.7数据库安装及性能测试 记录Centos7.9下安装mysql 5.7并利用benchmark工具简单测试mysql的性能。 测试机centos7.9 配置4C8G40G 1. 下安装mysql5.7 安装mysql5.7 # 通过官方镜像源安装$ wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm$ sudo yum -y install mysql57-community-release-el7-11.noarch.rpm$ sudo yum -y install mysql mysql-server mysql-devel# 启动mysql并查看root密码$ sudo systemctl start mysqld$ sudo systemctl enable mysqld$ sudo grep password /var/log/mysqld.log2024-03-22T07:07:13.872300Z 1 [Note] A temporary password is generated for rootlocalhost: fO08,4R?b2%;# 由上述日志看出mysql的root密码为fO08,4R?b2%;# 修改密码$ mysql -uroot -pEnter password:Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 6Server version: 5.7.44Copyright (c) 2000, 2023, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type help; or \h for help. Type \c to clear the current input statement.# 配置密码复杂度可以设置简单密码mysql set global validate_password_length3;Query OK, 0 rows affected (0.00 sec)mysql set global validate_password_policy0;Query OK, 0 rows affected (0.00 sec)mysql ALTER USER rootlocalhost IDENTIFIED BY 123456;Query OK, 0 rows affected (0.00 sec)mysql SHOW VARIABLES LIKE validate_password%;---------------------------------------------| Variable_name                        | Value |---------------------------------------------| validate_password_check_user_name    | OFF   || validate_password_dictionary_file    |       || validate_password_length             | 4     || validate_password_mixed_case_count   | 1     || validate_password_number_count       | 1     || validate_password_policy             | LOW   || validate_password_special_char_count | 1     |---------------------------------------------7 rows in set (0.01 sec)# 配置root允许其他主机进行连接mysql use mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql select user,authentication_string,Host from user;---------------------------------------------------------------------| user          | authentication_string                     | Host      |---------------------------------------------------------------------| root          | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | localhost || mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost || mysql.sys     | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost |---------------------------------------------------------------------3 rows in set (0.00 sec)mysql GRANT ALL PRIVILEGES ON *.* TO root% IDENTIFIED BY 123456;Query OK, 0 rows affected, 1 warning (0.00 sec)mysql flush privileges;Query OK, 0 rows affected (0.00 sec)mysql select user,authentication_string,Host from user;---------------------------------------------------------------------| user          | authentication_string                     | Host      |---------------------------------------------------------------------| root          | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | localhost || mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost || mysql.sys     | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost || root          | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | %         |---------------------------------------------------------------------4 rows in set (0.00 sec)mysql 安装mysql5.7如果遇到如下GPG密钥问题 The GPG keys listed for the MySQL 5.7 Community Server repository are already installed but they are not correct for this package. 使用如下命令解决 rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 2. sysbench测试mysql性能 2.1 sysbench安装 # 镜像源安装$ sudo yum install -y sysbench# 源码编译安装# CentOS安装依赖$ sudo yum -y install make automake libtool pkgconfig libaio-devel# For MySQL support, replace with mysql-devel on RHEL/CentOS 5$ sudo yum -y install mariadb-devel openssl-devel# 下载源码编译安装$ wget https://github.com/akopytov/sysbench/archive/master.zip$ unzip master.zip$ cd sysbench-master/$ sudo ./autogen.sh$ sudo ./configure$ sudo make  sudo make install# 如果之前安装的sysbench没有添加mysql支持可以在源码解压的文件夹里通过如下命令卸载然后重新执行上面的安装流程$ sudo make uninstall ./configure说明 sysbench默认是支持MySQL的benchmarking的如果不加任何选项则要求保证MySQL的安装路径都是默认的标准路径headfile位于/usr/include目录下libraries位于/usr/lib/目录下。如果MySQL是源码编译安装的安装路径放在/usr/local/mysql下要添加相应的选项命令 --with-mysql-includes/usr/local/mysql/include/mysql/ --with-mysql-libs/usr/local/mysql/lib/mysql/ mysql安装在自定义路径不在PATH下可以使用--with-mysql-includes和--with-mysql-libs指定mysql路径。 2.2 sysbench oltp测试参数说明 sysbench 中常用的参数如下  --oltp-tables-count1表数量  --oltp-table-size10000000每个表产生的记录行数  --oltp-read-onlyoff是否生成只读SQL默认 off如果设置为 on则 oltp 模型不会生成 update, delete, insert 的 SQL 语句  --oltp-skip-trx[on|off]省略 BEGIN / COMMIT 语句。默认是 off  --rand-initon是否随机初始化数据如果不随机化那么初始好的数据每行内容除了主键不同外其他完全相同  --num-threads12 并发线程数可以理解为模拟的客户端并发连接数  --report-interval10表示每 10s 输出一次性能数据  --max-requests0压力测试产生请求的总数如果以下面的 max-time 来记这个值设为 0 即可  --max-time120测试的持续时间  --oltp_auto_incoffid 是否为自增列  --oltp_secondaryon将 id 设置为非主键防止主键冲突  --oltp_range_size5: 连续取值 5 个必定走到 5 个分片  --mysql_table_optionsdbpartition by hash(id) tbpartition by hash(id) tbpartitions 2DRDS 支持拆分表在建表的时候需要指定拆分方式    安装完成会自带几个lua脚本文件路径在/usr/local/share/sysbench 或 /usr/share/sysbench/tests/include/oltp_legacy下 2.3 测试执行 提前在mysql中创建数据库名为sysbench。 # 创建测试数据库tpcc$ mysql -uroot -pmysql create database sysbench;mysql exitBye# 1、数据准备在sysbench库中创建10张表每个表有1000000条记录。$ sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp-table-size1000000 --oltp_tables_count10 --threads4 --db-drivermysql --mysql-dbsysbench --mysql-host172.16.0.9 --mysql-userroot --mysql-password123456 preparesysbench 1.0.17 (using system LuaJIT 2.0.4)Creating table sbtest1...Inserting 1000000 records into sbtest1Creating secondary indexes on sbtest1...Creating table sbtest2...Inserting 1000000 records into sbtest2Creating secondary indexes on sbtest2...Creating table sbtest3...Inserting 1000000 records into sbtest3Creating secondary indexes on sbtest3...Creating table sbtest4...Inserting 1000000 records into sbtest4Creating secondary indexes on sbtest4...Creating table sbtest5...Inserting 1000000 records into sbtest5Creating secondary indexes on sbtest5...Creating table sbtest6...Inserting 1000000 records into sbtest6Creating secondary indexes on sbtest6...Creating table sbtest7...Inserting 1000000 records into sbtest7Creating secondary indexes on sbtest7...Creating table sbtest8...Inserting 1000000 records into sbtest8Creating secondary indexes on sbtest8...Creating table sbtest9...Inserting 1000000 records into sbtest9Creating secondary indexes on sbtest9...Creating table sbtest10...Inserting 1000000 records into sbtest10Creating secondary indexes on sbtest10...# 2、进行write_only测试$ sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp-table-size1000000 --oltp_tables_count10 --threads4 --db-drivermysql --mysql-dbsysbench --mysql-host172.16.0.9 --mysql-userroot --mysql-password123456 run sysbench 1.0.17 (using system LuaJIT 2.0.4)Running the test with following options:Number of threads: 4Initializing random number generator from current timeInitializing worker threads...Threads started!SQL statistics:    queries performed:        read:                            19432        write:                           5552        other:                           2776        total:                           27760    transactions:                        1388   (137.58 per sec.)    queries:                             27760  (2751.55 per sec.)    ignored errors:                      0      (0.00 per sec.)    reconnects:                          0      (0.00 per sec.)General statistics:    total time:                          10.0875s    total number of events:              1388Latency (ms):         min:                                    5.66         avg:                                   28.89         max:                                 1817.12         95th percentile:                      104.84         sum:                                40095.22Threads fairness:    events (avg/stddev):           347.0000/1.22    execution time (avg/stddev):   10.0238/0.04# 3、清除数据$ sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --oltp-table-size1000000 --oltp_tables_count10 --threads4 --db-drivermysql --mysql-dbsysbench --mysql-host172.16.0.9 --mysql-userroot --mysql-password123456 cleanupsysbench 1.0.17 (using system LuaJIT 2.0.4)Dropping table sbtest1...Dropping table sbtest2...Dropping table sbtest3...Dropping table sbtest4...Dropping table sbtest5...Dropping table sbtest6...Dropping table sbtest7...Dropping table sbtest8...Dropping table sbtest9...Dropping table sbtest10... 参考 https://www.cnblogs.com/xulinforDB/p/17496225.html 3. mysqlslap测试mysql性能 mysqlslap是MySQL官方提供的一个性能测试工具用于模拟多个客户端对MySQL数据库进行并发访问从而测试数据库在高负载下的性能表现。通过mysqlslap我们可以测试数据库的查询性能、插入性能、更新性能等从而评估数据库的性能瓶颈和提升空间。 3.1 mysqlslap参数说明 mysqlslap常用参数—auto-generate-sql, -a自动生成测试表和数据。这是mysqlslap最常用的参数之一可以让我们无需手动创建测试数据快速进行测试。—auto-generate-sql-load-typetype测试语句的类型。这个参数可以指定测试语句的类型包括read读操作、key键值查询、write写操作、update更新操作和mixed混合操作等。默认值为mixed表示混合类型的测试语句。—number-char-colsN, -x N自动生成的测试表中包含多少个字符类型的列。默认值为1表示自动生成一个字符类型的列。—number-int-colsN, -y N自动生成的测试表中包含多少个数字类型的列。默认值为1表示自动生成一个数字类型的列。—number-of-queriesN总的测试查询次数并发客户数×每客户查询次数。这个参数可以指定总的测试查询次数从而控制测试的时间和强度。—query’SQL’,(—query缩写为-q)使用自定义脚本执行测试。这个参数允许我们使用自定义的SQL语句进行测试从而更灵活地模拟实际应用场景。 3.2 执行测试 在测试客户端上执行mysqlslap命令指定要测试的MySQL服务器地址、用户名、密码等参数以及要使用的测试选项。例如我们可以使用以下命令进行混合类型的性能测试 $ mysqlslap --auto-generate-sql --auto-generate-sql-load-typemixed --number-of-queries10000 --concurrency10 --engineinnodb --userroot --password123456 --hostlocalhost --port3306mysqlslap: [Warning] Using a password on the command line interface can be insecure.Benchmark        Running for engine innodb        Average number of seconds to run all queries: 7.546 seconds        Minimum number of seconds to run all queries: 7.546 seconds        Maximum number of seconds to run all queries: 7.546 seconds        Number of clients running queries: 10        Average number of queries per client: 1000 上述命令中—concurrency参数指定了并发客户端的数量—engine参数指定了存储引擎类型这里使用InnoDB—user和—password参数指定了连接MySQL服务器所需的用户名和密码—host和—port参数指定了MySQL服务器的地址和端口号。 执行完mysqlslap命令后将输出测试结果包括每秒查询数QPS、平均响应时间等性能指标。我们可以根据这些指标来分析数据库的性能表现找出潜在的性能瓶颈并进行相应的优化。 4. benchmarksql测试mysql性能 benchmarksql是一款符合TPC-C基准压力测试工具TPC-C是衡量在线事务处理的基准。 TPC-C模型是模拟一个商品批发公司的销售模型这个模型涵盖了一个批发公司面向客户对一系列商品进行销售的过程这包括管理订单管理库存管理账号收支等操作。这些操作涉及到仓库、商品、客户、订单等概念围绕这些概念构造了数据表格以及相应的数据库操作。 官网https://benchmarksql.readthedocs.io/en/latest/ 4.1 安装benchmarksql benchmarksql编译安装官方benchmarksql最新版本不支持mysql测试本文使用pingcap的仓库进行编译安装 # 安装依赖$ sudo yum install java-1.8.0-openjdk$ sudo yum -y install ant # 下载安装$ git clone -b 5.0-mysql-support-opt-2.1 https://github.com/pingcap/benchmarksql.git# 构建$ cd benchmarksql/$ antBuildfile: /home/test/tools/db/benchmarksql/build.xmlinit:    [mkdir] Created dir: /home/test/tools/db/benchmarksql/buildcompile:    [javac] Compiling 12 source files to /home/test/tools/db/benchmarksql/builddist:    [mkdir] Created dir: /home/test/tools/db/benchmarksql/dist      [jar] Building jar: /home/test/tools/db/benchmarksql/dist/BenchmarkSQL-5.0.jarBUILD SUCCESSFULTotal time: 1 second 4.2 测试数据准备及执行 # 创建测试数据库tpcc$ mysql -uroot -pmysql create database tpcc;# 删除数据库# mysql drop database tpcc;mysql exitBye# 修改mysql测试文件。$ sudo vi benchmarksql/run/props.mysqldbmysqldrivercom.mysql.jdbc.Driverconnjdbc:mysql://localhost:3306/tpcc?useSSLfalseuseServerPrepStmtstrueuseConfigsmaxPerformancerewriteBatchedStatementstruecachePrepStmtstrueprepStmtCacheSize1000prepStmtCacheSqlLimit2048userrootpassword123456warehouses20loadWorkers8terminals20//To run specified transactions per terminal- runMins must equal zerorunTxnsPerTerminal0//To run for specified minutes- runTxnsPerTerminal must equal zerorunMins10//Number of total transactions per minutelimitTxnsPerMin0//Set to true to run in 4.x compatible mode. Set to false to use the//entire configured database evenly.terminalWarehouseFixedtrue//The following five values must add up to 100//The default percentages of 45, 43, 4, 4  4 match the TPC-C specnewOrderWeight45paymentWeight43orderStatusWeight4deliveryWeight4stockLevelWeight4// Directory name to create for collecting detailed result data.// Comment this out to suppress.resultDirectorymy_result_%tY-%tm-%td_%tH%tM%tS//osCollectorScript./misc/os_collector_linux.py//osCollectorInterval1//osCollectorSSHAddruserdbhost//osCollectorDevicesnet_eth0 blk_vda 参数说明: dbmysql: 指定数据库类型当前类型为mysql drivercom.mysql.jdbc.Driver: mysql数据库JDBC驱动 connjdbc:mysql://localhost:3306/tpcc?useSSLfalse...mysql的连接字符串 userroot连接mysql的用户名 password123456连接mysql的密码 Warehouses: 代表仓库数,每个 Warehouse 的数据量其大小约为 76823.04KB。可以根据每个Warehouse的数据量计算测试过程中的数据总量。 计算公式为数据总量KB≈ Warehouse个数*76823.04KB 以10个Warehouse的数据量为例计算其数据总量大小约为768230.4KB loadWorkers8用于在数据库中初始化数据的加载进程数量默认为4实际使用过程中可以根据实际情况调整加载速度会随worker数量的增加而有所提升 terminals20终端数即并发客户端数量通常设置为CPU线程总数的26倍 runTxnsPerTerminal0每个终端terminal运行的固定事务数量例如如果该值设置为10意味着每个terminal运行10个事务如果有32个终端那整体运行320个事务后测试结束。该参数配置为非0值时下面的runMins参数必须设置为0 runMins10: 要测试的整体时间单位为分钟如果runMins设置为60那么测试持续1小时候结束。该值设置为非0值时runTxnsPerTerminal参数必须设置为0。这两个参数不能同时设置为正整数如果设置其中一个另一个必须为0主要区别是runMins定义时间长度来控制测试时间runTxnsPerTerminal定义事务总数来控制时间。 limitTxnsPerMin0: 每分钟事务总数限制该参数主要控制每分钟处理的事务数事务数受terminals参数的影响limitTxnsPerMin/terminals的值必须是正整数。 terminalWarehouseFixedtrue: 终端和仓库的绑定模式设置为true时可以运行4.x兼容模式意思为每个终端都有一个固定的仓库。设置为false时可以均匀的使用数据库整体配置。TPCC规定每个终端都必须有一个绑定的仓库所以一般使用默认值true。 下面五个值的总和必须等于100默认值为45, 43, 4, 44 与TPC-C测试定义的比例一致实际操作过程中可以调整比重来适应各种场景. newOrderWeight45 新订单事务占总事务的45% paymentWeight43 支付订单事务占总事务的43% orderStatusWeight4 订单状态事务占总事务的4% deliveryWeight4 到货日期事务占总事务的4% stockLevelWeight4 查看现存货品的事务占总事务的4% resultDirectorymy_result_%tY-%tm-%td_%tH%tM%tS 压测期间收集系统性能数据的目录无需修改 osCollectorScript./misc/os_collector_linux.py: 操作系统性能收集脚本无需修改 osCollectorInterval1: 操作系统收集操作间隔默认为1秒 osCollectorSSHAddruserdbhost: 需要收集系统性能的主机 osCollectorDevicesnet_eth0 blk_vda: 操作系统中被收集服务器的网卡名称和磁盘名称根据个人环境进行调整 # 建立仓库完成创建表并导入数据$ pwd/home/test/tools/db/benchmarksql/run$ ./runDatabaseBuild.sh props.mysql# 执行benchmark测试$ ./runBenchmark.sh props.mysql 4.3 结果解读 4.3.1 runBenchmark.sh运行结果 # 运行结果13:52:03,667 [Thread-5] INFO   jTPCC : Term-00, Measured tpmC (NewOrders)  1995.21                                                                                                   13:52:03,667 [Thread-5] INFO   jTPCC : Term-00, Measured tpmTOTAL  4408.113:52:03,667 [Thread-5] INFO   jTPCC : Term-00, Session Start      2024-05-07 13:42:0213:52:03,667 [Thread-5] INFO   jTPCC : Term-00, Session End        2024-05-07 13:52:0313:52:03,667 [Thread-5] INFO   jTPCC : Term-00, Transaction Count  44135 主要关注如下几项结果 tpmCNewOrder 每分钟1995.21笔订单 tpmTOTAL订单总数4408.1笔 Transaction Count 执行10min执行了44135笔订单每分钟4413.5笔订单 4.3.2 html报告查看 # 安装R语言环境$ sudo yum install R -y# 生成html报告$ sudo ./generateReport.sh my_result_2024-05-07_151402/# 将my_result_2024-05-07_151402/下载到终端使用浏览器即可打开html版本的报告 备注 html报告中系统资源CPU、disk无数据输出待排查原因。 参考 benchmarksql 5.0 支持对MySQL的TPC-C测试 pingcap-benchmarksql 本文由 mdnice 多平台发布
http://www.hkea.cn/news/14303309/

相关文章:

  • 网站移动端推广做化妆品等的网站
  • 温州建校网站网址导航大全软件下载
  • 做网站的公司济南赛博科技市场今天郑州最新新闻
  • 专业设计软件百度搜索引擎优化方式
  • 做网站好公司wordpress需求规划书
  • 河南宏业建设管理有限公司网站wordpress启动广告
  • 手机网站制作机构网站关键词优化教程
  • 长沙网站空间北京seo做排名
  • 报告网站开发环境设计网站账号
  • asp.net 网站登陆设计做网站游戏推广赚钱
  • 海南省住房和城乡建设厅网站首页基础网站建设公司
  • 外贸网站如何做推广wordpress怎么加表格
  • 祁东网站开发杭州网站建设多少钱
  • 郑州高端定制网站卡片式设计的网站
  • 博客网站是自己做的吗一站式网站建设业务
  • 安徽设计网站建设搜索引擎优化seo优惠
  • 蚌埠市做家教网站呼市地区做网站公司
  • 聊城集团网站建设多少钱云阳网站建设
  • 安防 光速东莞网站建设百度推广平台登录
  • 15年做哪个网站能致富遵义市建设局网站官网
  • 建网站需要学什么电子版证件照免费制作微信小程序
  • 建设部网站社保联网福建建筑人才网官网
  • 西安前端开发招聘wordpress seo 主题
  • 京东如何进行网站建设昆山做网站好的
  • 网站开发软件开发流程跨境电商个人可以做吗
  • 现代电子商务网站建设技术创建网站的目的
  • 网站开发基础知识中国住房和城乡建设部网站公文
  • 遵义网站开发哪家便宜任城网络推广教程
  • 怎么做农产品垂直网站个人网站备案注销
  • 做网站,图片显示不出来wordpress视频投票