炼数成金_Tomcat第六课作业
学号:70017
作业:
完成sysbench安装,并对磁盘进行压测
解:
# 安装sysbench
[root@localhost src]# curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash Detected operating system as centos/6. Checking for curl... Detected curl... Downloading repository file: https://packagecloud.io/install/repositories/akopytov/sysbench/config_file.repo?os=centos&dist=6&source=script done. Installing pygpgme to verify GPG signatures... Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile akopytov_sysbench-source/signature | 836 B 00:00 Retrieving key from https://packagecloud.io/akopytov/sysbench/gpgkey Importing GPG key 0x04DCFD39: Userid: "https://packagecloud.io/akopytov/sysbench-prerelease (https://packagecloud.io/docs#gpg_signing) <support@packagecloud.io>" From : https://packagecloud.io/akopytov/sysbench/gpgkey akopytov_sysbench-source/signature | 1.0 kB 00:01 ... akopytov_sysbench-source/primary | 962 B 00:00 akopytov_sysbench-source 2/2 Setting up Install Process Package pygpgme-0.1-18.20090824bzr68.el6.x86_64 already installed and latest version Nothing to do Installing yum-utils... Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package yum-utils.noarch 0:1.1.30-40.el6 will be installed --> Processing Dependency: yum >= 3.2.29-77 for package: yum-utils-1.1.30-40.el6.noarch --> Processing Dependency: libxml2-python for package: yum-utils-1.1.30-40.el6.noarch --> Running transaction check ---> Package libxml2-python.x86_64 0:2.7.6-21.el6_8.1 will be installed --> Processing Dependency: libxml2 = 2.7.6-21.el6_8.1 for package: libxml2-python-2.7.6-21.el6_8.1.x86_64 ---> Package yum.noarch 0:3.2.29-30.el6.centos will be updated ---> Package yum.noarch 0:3.2.29-81.el6.centos will be an update --> Processing Dependency: python-urlgrabber >= 3.9.1-10 for package: yum-3.2.29-81.el6.centos.noarch --> Running transaction check ---> Package libxml2.x86_64 0:2.7.6-4.el6_2.4 will be updated ---> Package libxml2.x86_64 0:2.7.6-21.el6_8.1 will be an update --> Processing Dependency: libz.so.1(ZLIB_1.2.2.3)(64bit) for package: libxml2-2.7.6-21.el6_8.1.x86_64 ---> Package python-urlgrabber.noarch 0:3.9.1-8.el6 will be updated ---> Package python-urlgrabber.noarch 0:3.9.1-11.el6 will be an update --> Running transaction check ---> Package zlib.x86_64 0:1.2.3-27.el6 will be updated ---> Package zlib.x86_64 0:1.2.3-29.el6 will be an update --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================================================================================================== Package Arch Version Repository Size ============================================================================================================================================================================================================================================================================== Installing: yum-utils noarch 1.1.30-40.el6 base 113 k Installing for dependencies: libxml2-python x86_64 2.7.6-21.el6_8.1 base 325 k Updating for dependencies: libxml2 x86_64 2.7.6-21.el6_8.1 base 805 k python-urlgrabber noarch 3.9.1-11.el6 base 86 k yum noarch 3.2.29-81.el6.centos base 1.0 M zlib x86_64 1.2.3-29.el6 base 73 k Transaction Summary ============================================================================================================================================================================================================================================================================== Install 2 Package(s) Upgrade 4 Package(s) Total download size: 2.4 M Downloading Packages: (1/6): libxml2-2.7.6-21.el6_8.1.x86_64.rpm | 805 kB 00:00 (2/6): libxml2-python-2.7.6-21.el6_8.1.x86_64.rpm | 325 kB 00:00 (3/6): python-urlgrabber-3.9.1-11.el6.noarch.rpm | 86 kB 00:00 (4/6): yum-3.2.29-81.el6.centos.noarch.rpm | 1.0 MB 00:00 (5/6): yum-utils-1.1.30-40.el6.noarch.rpm | 113 kB 00:00 (6/6): zlib-1.2.3-29.el6.x86_64.rpm | 73 kB 00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Total 1.3 MB/s | 2.4 MB 00:01 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Updating : zlib-1.2.3-29.el6.x86_64 1/10 Updating : libxml2-2.7.6-21.el6_8.1.x86_64 2/10 Installing : libxml2-python-2.7.6-21.el6_8.1.x86_64 3/10 Updating : python-urlgrabber-3.9.1-11.el6.noarch 4/10 Updating : yum-3.2.29-81.el6.centos.noarch 5/10 Installing : yum-utils-1.1.30-40.el6.noarch 6/10 Cleanup : yum-3.2.29-30.el6.centos.noarch 7/10 Cleanup : libxml2-2.7.6-4.el6_2.4.x86_64 8/10 Cleanup : python-urlgrabber-3.9.1-8.el6.noarch 9/10 Cleanup : zlib-1.2.3-27.el6.x86_64 10/10 Verifying : yum-utils-1.1.30-40.el6.noarch 1/10 Verifying : libxml2-python-2.7.6-21.el6_8.1.x86_64 2/10 Verifying : zlib-1.2.3-29.el6.x86_64 3/10 Verifying : libxml2-2.7.6-21.el6_8.1.x86_64 4/10 Verifying : yum-3.2.29-81.el6.centos.noarch 5/10 Verifying : python-urlgrabber-3.9.1-11.el6.noarch 6/10 Verifying : libxml2-2.7.6-4.el6_2.4.x86_64 7/10 Verifying : python-urlgrabber-3.9.1-8.el6.noarch 8/10 Verifying : zlib-1.2.3-27.el6.x86_64 9/10 Verifying : yum-3.2.29-30.el6.centos.noarch 10/10 Installed: yum-utils.noarch 0:1.1.30-40.el6 Dependency Installed: libxml2-python.x86_64 0:2.7.6-21.el6_8.1 Dependency Updated: libxml2.x86_64 0:2.7.6-21.el6_8.1 python-urlgrabber.noarch 0:3.9.1-11.el6 yum.noarch 0:3.2.29-81.el6.centos zlib.x86_64 0:1.2.3-29.el6 Complete! Generating yum cache for akopytov_sysbench... Importing GPG key 0x04DCFD39: Userid: "https://packagecloud.io/akopytov/sysbench-prerelease (https://packagecloud.io/docs#gpg_signing) <support@packagecloud.io>" From : https://packagecloud.io/akopytov/sysbench/gpgkey The repository is setup! You can now install packages. [root@localhost src]# yum -y install sysbench Loaded plugins: fastestmirror Setting up Install Process Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package sysbench.x86_64 0:1.0.7-1.el6 will be installed --> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: sysbench-1.0.7-1.el6.x86_64 --> Processing Dependency: libaio.so.1(LIBAIO_0.1)(64bit) for package: sysbench-1.0.7-1.el6.x86_64 --> Processing Dependency: libpq.so.5()(64bit) for package: sysbench-1.0.7-1.el6.x86_64 --> Processing Dependency: libaio.so.1()(64bit) for package: sysbench-1.0.7-1.el6.x86_64 --> Running transaction check ---> Package libaio.x86_64 0:0.3.107-10.el6 will be installed ---> Package postgresql-libs.x86_64 0:8.4.20-7.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================================================================================================== Package Arch Version Repository Size ============================================================================================================================================================================================================================================================================== Installing: sysbench x86_64 1.0.7-1.el6 akopytov_sysbench 344 k Installing for dependencies: libaio x86_64 0.3.107-10.el6 base 21 k postgresql-libs x86_64 8.4.20-7.el6 base 202 k Transaction Summary ============================================================================================================================================================================================================================================================================== Install 3 Package(s) Total download size: 567 k Installed size: 1.5 M Downloading Packages: (1/3): libaio-0.3.107-10.el6.x86_64.rpm | 21 kB 00:00 (2/3): postgresql-libs-8.4.20-7.el6.x86_64.rpm | 202 kB 00:00 (3/3): sysbench-1.0.7-1.el6.x86_64.rpm | 344 kB 00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Total 181 kB/s | 567 kB 00:03 Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : postgresql-libs-8.4.20-7.el6.x86_64 1/3 Installing : libaio-0.3.107-10.el6.x86_64 2/3 Installing : sysbench-1.0.7-1.el6.x86_64 3/3 Verifying : sysbench-1.0.7-1.el6.x86_64 1/3 Verifying : libaio-0.3.107-10.el6.x86_64 2/3 Verifying : postgresql-libs-8.4.20-7.el6.x86_64 3/3 Installed: sysbench.x86_64 0:1.0.7-1.el6 Dependency Installed: libaio.x86_64 0:0.3.107-10.el6 postgresql-libs.x86_64 0:8.4.20-7.el6 Complete!
# 磁盘压力测试
# 生成测试文件 [root@localhost ~]# sysbench --test=fileio --num-threads=16 --file-total-size=2G --file-test-mode=rndrw prepare sysbench 1.0.7 (using bundled LuaJIT 2.1.0-beta2) 128 files, 16384Kb each, 2048Mb total Creating files for the test... Extra file open flags: 0 Creating file test_file.0 Creating file test_file.1 Creating file test_file.2 Creating file test_file.3 ... ... Creating file test_file.125 Creating file test_file.126 Creating file test_file.127 2147483648 bytes written in 330.52 seconds (6.20 MiB/sec). # 设置压测任务 [root@localhost ~]# sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw run sysbench 1.0.7 (using bundled LuaJIT 2.1.0-beta2) Running the test with following options: Number of threads: 20 Initializing random number generator from current time Extra file open flags: 0 128 files, 16MiB each 2GiB total file size Block size 16KiB Number of IO requests: 0 Read/Write ratio for combined random IO test: 1.50 Periodic FSYNC enabled, calling fsync() each 100 requests. Calling fsync() at the end of test, Enabled. Using synchronous I/O mode Doing random r/w test Initializing worker threads... Threads started! File operations: reads/s: 18.78 writes/s: 12.39 fsyncs/s: 35.52 Throughput: read, MiB/s: 0.29 written, MiB/s: 0.19 General statistics: total time: 10.8083s total number of events: 721 Latency (ms): min: 0.00 avg: 267.40 max: 8593.15 95th percentile: 1213.57 sum: 192795.24 Threads fairness: events (avg/stddev): 36.0500/12.69 execution time (avg/stddev): 9.6398/0.58 # 删除测试文件 [root@localhost ~]# sysbench --test=fileio --num-threads=20 --file-total-size=2G --file-test-mode=rndrw cleanup sysbench 1.0.7 (using bundled LuaJIT 2.1.0-beta2) Removing test files...

浙公网安备 33010602011771号