目录
前言
一、系统信息
1. 操作系统
2. CPU(虚拟机内)
3. 内存
二、编译wrk
1.什么时wrk
2.下载编译wrk
三、部署MariaDB
1. 安装MariaDB
2. 启动MariaDB服务
3. 修改root密码
4. 创建sbtest数据库、导入结构及数据
四、压测.NET Core 3.1项目
1. 部署项目
2. wrk压力测试
3. 停止服务
五、压测SpringBoot项目
1. 部署项目
2. wrk压力测试
3. 停止服务
总结
前言
本文介绍.NET Core WebApi与Java SpringBoot WebApi读取MySQL(MariaDB)在银河麒麟高级服务器操作系统V10上的性能差异
一、系统信息
1. 操作系统
# cat /etc/kylin-release
Kylin Linux Advanced Server release V10 (Azalea)
2. CPU(虚拟机内)
# lscpu
Architecture: aarch64
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 1
Core(s) per socket: 8
座: 1
NUMA 节点: 1
型号: 2
BogoMIPS: 100.00
NUMA 节点0 CPU: 0-7
Flags: fp asimd evtstrm crc32 cpuid
3. 内存
# free -htotal used free shared buff/cache available
Mem: 15G 612M 3.2G 30M 11G 12G
Swap: 8.0G 0B 8.0G
二、编译wrk
1.什么时wrk
wrk 是一个比较先进的 HTTP 压力测试工具,当在单个多核 CPU 上运行时,能够产生大量负载。它结合了多线程设计和可扩展的事件通知系统,例如 epoll 和 kqueue。
可选的 LuaJIT 脚本可以执行 HTTP 请求生成,响应处理和自定义报告。
2.下载编译wrk
# wget https://github.com/wg/wrk/archive/4.1.0.tar.gz
# tar -xvf 4.1.0.tar.gz
# cd wrk-4.1.0/
# make -j8
# ll
总用量 3000
-rw-rw-r-- 1 root root 945 1月 21 2018 CHANGES
drwxrwxr-x 2 root root 68 1月 21 2018 deps
-rw-rw-r-- 1 root root 916 1月 21 2018 INSTALL
-rw-rw-r-- 1 root root 10489 1月 21 2018 LICENSE
-rw-rw-r-- 1 root root 2751 1月 21 2018 Makefile
-rw-rw-r-- 1 root root 5420 1月 21 2018 NOTICE
drwxr-xr-x 8 root root 291 11月 16 10:10 obj
-rw-rw-r-- 1 root root 3497 1月 21 2018 README.md
-rw-rw-r-- 1 root root 4158 1月 21 2018 SCRIPTING
drwxrwxr-x 2 root root 161 1月 21 2018 scripts
drwxrwxr-x 2 root root 4096 1月 21 2018 src
-rwxr-xr-x 1 root root 3051272 11月 16 10:10 wrk
三、部署MariaDB
1. 安装MariaDB
# yum install mariadb mariadb-server -y
已加载插件:langpacks
正在解决依赖关系
--> 正在检查事务
---> 软件包 mariadb.aarch64.1.5.5.60-1.el7_5 将被 安装
--> 正在处理依赖关系 mariadb-libs(aarch-64) = 1:5.5.60-1.el7_5,它被软件包 1:mariadb-5.5.60-1.el7_5.aarch64 需要
---> 软件包 mariadb-server.aarch64.1.5.5.60-1.el7_5 将被 安装
--> 正在处理依赖关系 perl-DBD-MySQL,它被软件包 1:mariadb-server-5.5.60-1.el7_5.aarch64 需要
--> 正在检查事务
---> 软件包 mariadb-libs.aarch64.1.5.5.60-1.el7_5 将被 安装
---> 软件包 perl-DBD-MySQL.aarch64.0.4.023-6.el7 将被 安装
--> 解决依赖关系完成依赖关系解决=====================================================================================================================================================================================================================================================================================Package 架构 版本 源 大小
=====================================================================================================================================================================================================================================================================================
正在安装:mariadb aarch64 1:5.5.60-1.el7_5 ks10-adv-os 8.4 Mmariadb-server aarch64 1:5.5.60-1.el7_5 ks10-adv-os 11 M
为依赖而安装:mariadb-libs aarch64 1:5.5.60-1.el7_5 ks10-adv-os 740 kperl-DBD-MySQL aarch64 4.023-6.el7 ks10-adv-os 136 k事务概要
=====================================================================================================================================================================================================================================================================================
安装 2 软件包 (+2 依赖软件包)总下载量:20 M
安装大小:113 M
Downloading packages:
(1/4): mariadb-libs-5.5.60-1.el7_5.aarch64.rpm | 740 kB 00:00:00
(2/4): mariadb-5.5.60-1.el7_5.aarch64.rpm | 8.4 MB 00:00:05
(3/4): perl-DBD-MySQL-4.023-6.el7.aarch64.rpm | 136 kB 00:00:00
(4/4): mariadb-server-5.5.60-1.el7_5.aarch64.rpm | 11 MB 00:00:06
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 2.8 MB/s | 20 MB 00:00:07
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction正在安装 : 1:mariadb-libs-5.5.60-1.el7_5.aarch64 1/4
/sbin/ldconfig: /lib64/libstdc++.so.6.0.21-gdb.py 不是 ELF 文件 - 它起始的魔数错误。正在安装 : 1:mariadb-5.5.60-1.el7_5.aarch64 2/4 正在安装 : perl-DBD-MySQL-4.023-6.el7.aarch64 3/4 正在安装 : 1:mariadb-server-5.5.60-1.el7_5.aarch64 4/4 验证中 : 1:mariadb-5.5.60-1.el7_5.aarch64 1/4 验证中 : 1:mariadb-server-5.5.60-1.el7_5.aarch64 2/4 验证中 : 1:mariadb-libs-5.5.60-1.el7_5.aarch64 3/4 验证中 : perl-DBD-MySQL-4.023-6.el7.aarch64 4/4 已安装:mariadb.aarch64 1:5.5.60-1.el7_5 mariadb-server.aarch64 1:5.5.60-1.el7_5 作为依赖被安装:mariadb-libs.aarch64 1:5.5.60-1.el7_5 perl-DBD-MySQL.aarch64 0:4.023-6.el7 完毕!
2. 启动MariaDB服务
# systemctl enable mariadb --now
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
3. 修改root密码
# mysql -uroot
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.60-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
MariaDB [mysql]> update user set password=password('abcDEF123___') where user='root';
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)MariaDB [mysql]>
4. 创建sbtest数据库、导入结构及数据
下载数据库文件
# wget https://github.com/hknarutofk/KylinV10Performance/releases/download/v1.0/schema.sql
--2020-11-16 10:50:04-- https://github.com/hknarutofk/KylinV10Performance/releases/download/v1.0/schema.sql
正在解析主机 github.com (github.com)... 13.250.177.223
正在连接 github.com (github.com)|13.250.177.223|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:https://github-production-release-asset-2e65be.s3.amazonaws.com/313153611/8c0d8100-27f8-11eb-9401-3725410e51d0?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201116%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201116T025005Z&X-Amz-Expires=300&X-Amz-Signature=be1bf6d5512d3a2e0035d130d109b8383d3d899a3eecdaec28ea3a1df5c0a04c&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=313153611&response-content-disposition=attachment%3B%20filename%3Dschema.sql&response-content-type=application%2Foctet-stream [跟随至新的 URL]
--2020-11-16 10:50:06-- https://github-production-release-asset-2e65be.s3.amazonaws.com/313153611/8c0d8100-27f8-11eb-9401-3725410e51d0?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201116%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201116T025005Z&X-Amz-Expires=300&X-Amz-Signature=be1bf6d5512d3a2e0035d130d109b8383d3d899a3eecdaec28ea3a1df5c0a04c&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=313153611&response-content-disposition=attachment%3B%20filename%3Dschema.sql&response-content-type=application%2Foctet-stream
正在解析主机 github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.217.81.44
正在连接 github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.217.81.44|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:432 [application/octet-stream]
正在保存至: “schema.sql”100%[===========================================================================================================================================================================================================================================>] 432 --.-K/s 用时 0s 2020-11-16 10:50:07 (13.1 MB/s) - 已保存 “schema.sql” [432/432])
创建并导入数据库
[root@192-168-110-185 ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.60-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> create database sbtest;
Query OK, 1 row affected (0.00 sec)MariaDB [(none)]> use sbtest;
Database changed
MariaDB [sbtest]> source /root/schema.sql;
Query OK, 0 rows affected, 1 warning (0.00 sec)Query OK, 0 rows affected (0.10 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0Query OK, 0 rows affected (0.00 sec)MariaDB [sbtest]>
四、压测.NET Core 3.1项目
1. 部署项目
下载release版本
[root@192-168-110-185 ~]# wget https://github.com/hknarutofk/KylinV10Performance/releases/download/v1.0/publish.zip
--2020-11-16 10:53:35-- https://github.com/hknarutofk/KylinV10Performance/releases/download/v1.0/publish.zip
正在解析主机 github.com (github.com)... 13.229.188.59
正在连接 github.com (github.com)|13.229.188.59|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:https://github-production-release-asset-2e65be.s3.amazonaws.com/313153611/40f36e00-27f8-11eb-8469-d02ef1d50209?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201116%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201116T025336Z&X-Amz-Expires=300&X-Amz-Signature=f1acae8c474d51483709a3021fca30ab3ba159cf6837f2843e1576a39fef6c1d&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=313153611&response-content-disposition=attachment%3B%20filename%3Dpublish.zip&response-content-type=application%2Foctet-stream [跟随至新的 URL]
--2020-11-16 10:53:36-- https://github-production-release-asset-2e65be.s3.amazonaws.com/313153611/40f36e00-27f8-11eb-8469-d02ef1d50209?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201116%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201116T025336Z&X-Amz-Expires=300&X-Amz-Signature=f1acae8c474d51483709a3021fca30ab3ba159cf6837f2843e1576a39fef6c1d&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=313153611&response-content-disposition=attachment%3B%20filename%3Dpublish.zip&response-content-type=application%2Foctet-stream
正在解析主机 github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.217.0.107
正在连接 github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.217.0.107|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:3938641 (3.8M) [application/octet-stream]
正在保存至: “publish.zip”100%[===========================================================================================================================================================================================================================================>] 3,938,641 18.8KB/s 用时 3m 6s 2020-11-16 10:56:43 (20.7 KB/s) - 已保存 “publish.zip” [3938641/3938641])
unzip解压
# unzip publish.zip
Archive: publish.zipcreating: publish/inflating: publish/BouncyCastle.Crypto.dll inflating: publish/Google.Protobuf.dll inflating: publish/K4os.Compression.LZ4.Streams.dll inflating: publish/K4os.Compression.LZ4.dll inflating: publish/K4os.Hash.xxHash.dll inflating: publish/Microsoft.Bcl.AsyncInterfaces.dll inflating: publish/Microsoft.Bcl.HashCode.dll inflating: publish/Microsoft.EntityFrameworkCore.Abstractions.dll inflating: publish/Microsoft.EntityFrameworkCore.Relational.dll inflating: publish/Microsoft.EntityFrameworkCore.dll inflating: publish/Microsoft.Extensions.Caching.Abstractions.dll inflating: publish/Microsoft.Extensions.Caching.Memory.dll inflating: publish/Microsoft.Extensions.Configuration.Abstractions.dll inflating: publish/Microsoft.Extensions.Configuration.Binder.dll inflating: publish/Microsoft.Extensions.Configuration.dll inflating: publish/Microsoft.Extensions.DependencyInjection.Abstractions.dll inflating: publish/Microsoft.Extensions.DependencyInjection.dll inflating: publish/Microsoft.Extensions.Logging.Abstractions.dll inflating: publish/Microsoft.Extensions.Logging.dll inflating: publish/Microsoft.Extensions.Options.dll inflating: publish/Microsoft.Extensions.Primitives.dll inflating: publish/MySql.Data.EntityFrameworkCore.dll inflating: publish/MySql.Data.dll inflating: publish/MySqlConnector.dll inflating: publish/Newtonsoft.Json.dll inflating: publish/Pomelo.EntityFrameworkCore.MySql.dll inflating: publish/Pomelo.JsonObject.dll inflating: publish/Renci.SshNet.dll inflating: publish/SshNet.Security.Cryptography.dll inflating: publish/System.Collections.Immutable.dll inflating: publish/System.Configuration.ConfigurationManager.dll inflating: publish/System.Diagnostics.DiagnosticSource.dll inflating: publish/System.Security.Cryptography.ProtectedData.dll inflating: publish/System.Xml.XPath.XmlDocument.dll inflating: publish/Ubiety.Dns.Core.dll inflating: publish/WebApplication1.deps.json inflating: publish/WebApplication1.dll inflating: publish/WebApplication1.exe inflating: publish/WebApplication1.pdb inflating: publish/WebApplication1.runtimeconfig.json inflating: publish/Zstandard.Net.dll inflating: publish/appsettings.Development.json inflating: publish/appsettings.json creating: publish/runtimes/creating: publish/runtimes/win/creating: publish/runtimes/win/lib/creating: publish/runtimes/win/lib/netstandard2.0/inflating: publish/runtimes/win/lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll inflating: publish/web.config
进入工作目录、启动项目
# cd publish/
# dotnet WebApplication1.dll --urls=http://0.0.0.0:5000
info: Microsoft.Hosting.Lifetime[0]Now listening on: http://0.0.0.0:5000
info: Microsoft.Hosting.Lifetime[0]Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]Content root path: /root/publish
2. wrk压力测试
# ./wrk -t100 -c100 -d1m http://0.0.0.0:5000/api/values
Running 1m test @ http://0.0.0.0:5000/api/values100 threads and 100 connectionsThread Stats Avg Stdev Max +/- StdevLatency 34.39ms 15.19ms 301.10ms 84.94%Req/Sec 29.63 9.05 130.00 47.95%169526 requests in 1.00m, 38.48MB readSocket errors: connect 0, read 0, write 0, timeout 100
Requests/sec: 2821.30
Transfer/sec: 655.73KB
3. 停止服务
在dotnet启动终端输入快捷键Ctrl+C终止进程
# dotnet WebApplication1.dll --urls=http://0.0.0.0:5000
info: Microsoft.Hosting.Lifetime[0]Now listening on: http://0.0.0.0:5000
info: Microsoft.Hosting.Lifetime[0]Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]Content root path: /root/publish
^Cinfo: Microsoft.Hosting.Lifetime[0]Application is shutting down...
五、压测SpringBoot项目
1. 部署项目
下载release版本
# wget https://github.com/hknarutofk/KylinV10Performance/releases/download/v1.0/demo-0.0.1-SNAPSHOT.jar
--2020-11-16 11:03:31-- https://github.com/hknarutofk/KylinV10Performance/releases/download/v1.0/demo-0.0.1-SNAPSHOT.jar
正在解析主机 github.com (github.com)... 13.229.188.59
正在连接 github.com (github.com)|13.229.188.59|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:https://github-production-release-asset-2e65be.s3.amazonaws.com/313153611/4355c800-27f8-11eb-9390-d597be7c8634?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201116%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201116T030331Z&X-Amz-Expires=300&X-Amz-Signature=a54d923999272a2ab42dc284e489f7b1203a1b996b91e68845c4a5e9337d5a28&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=313153611&response-content-disposition=attachment%3B%20filename%3Ddemo-0.0.1-SNAPSHOT.jar&response-content-type=application%2Foctet-stream [跟随至新的 URL]
--2020-11-16 11:03:31-- https://github-production-release-asset-2e65be.s3.amazonaws.com/313153611/4355c800-27f8-11eb-9390-d597be7c8634?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20201116%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201116T030331Z&X-Amz-Expires=300&X-Amz-Signature=a54d923999272a2ab42dc284e489f7b1203a1b996b91e68845c4a5e9337d5a28&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=313153611&response-content-disposition=attachment%3B%20filename%3Ddemo-0.0.1-SNAPSHOT.jar&response-content-type=application%2Foctet-stream
正在解析主机 github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.134.251
正在连接 github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.134.251|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:24772535 (24M) [application/octet-stream]
正在保存至: “demo-0.0.1-SNAPSHOT.jar”100%[===========================================================================================================================================================================================================================================>] 24,772,535 5.15MB/s 用时 4.6s 2020-11-16 11:03:37 (5.15 MB/s) - 已保存 “demo-0.0.1-SNAPSHOT.jar” [24772535/24772535])
启动项目
# java -jar demo-0.0.1-SNAPSHOT.jar . ____ _ __ _ _/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/ ___)| |_)| | | | | || (_| | ) ) ) )' |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot :: (v2.3.4.RELEASE)2020-11-16 11:04:40.357 [main] INFO Tomcat initialized with port(s): 8888 (http) o.s.b.w.e.t.TomcatWebServer.initialize(TomcatWebServer.java:108)
2020-11-16 11:04:40.393 [main] INFO Initializing ProtocolHandler ["http-nio-8888"] o.a.c.h.Http11NioProtocol.log(DirectJDKLog.java:173)
2020-11-16 11:04:40.396 [main] INFO Starting service [Tomcat] o.a.c.c.StandardService.log(DirectJDKLog.java:173)
2020-11-16 11:04:40.397 [main] INFO Starting Servlet engine: [Apache Tomcat/9.0.38] o.a.c.c.StandardEngine.log(DirectJDKLog.java:173)
2020-11-16 11:04:40.563 [main] INFO Initializing Spring embedded WebApplicationContext o.a.c.c.C.[.[.[/].log(DirectJDKLog.java:173)
2020-11-16 11:04:40.565 [main] INFO Root WebApplicationContext: initialization completed in 3450 ms o.s.b.w.s.c.ServletWebServerApplicationContext.prepareWebApplicationContext(ServletWebServerApplicationContext.java:285)_ _ |_ _ _|_. ___ _ | _
| | |\/|_)(_| | |_\ |_)||_|_\ / | 3.3.1
2020-11-16 11:04:42.694 [main] INFO Initializing ExecutorService 'applicationTaskExecutor' o.s.s.c.ThreadPoolTaskExecutor.initialize(ExecutorConfigurationSupport.java:181)
2020-11-16 11:04:43.220 [main] INFO Starting ProtocolHandler ["http-nio-8888"] o.a.c.h.Http11NioProtocol.log(DirectJDKLog.java:173)
2020-11-16 11:04:43.279 [main] INFO Tomcat started on port(s): 8888 (http) with context path '' o.s.b.w.e.t.TomcatWebServer.start(TomcatWebServer.java:220)
2. wrk压力测试
# ./wrk -t100 -c100 -d1m http://0.0.0.0:8888/main/sbtest1/values
Running 1m test @ http://0.0.0.0:8888/main/sbtest1/values100 threads and 100 connectionsThread Stats Avg Stdev Max +/- StdevLatency 49.72ms 162.60ms 1.98s 96.84%Req/Sec 58.70 38.25 343.00 64.84%324741 requests in 1.00m, 63.24MB readSocket errors: connect 0, read 0, write 0, timeout 3
Requests/sec: 5403.26
Transfer/sec: 1.05MB
3. 停止服务
在java启动终端输入快捷键Ctrl+C终止进程
# java -jar demo-0.0.1-SNAPSHOT.jar . ____ _ __ _ _/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/ ___)| |_)| | | | | || (_| | ) ) ) )' |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot :: (v2.3.4.RELEASE)2020-11-16 11:04:40.357 [main] INFO Tomcat initialized with port(s): 8888 (http) o.s.b.w.e.t.TomcatWebServer.initialize(TomcatWebServer.java:108)
2020-11-16 11:04:40.393 [main] INFO Initializing ProtocolHandler ["http-nio-8888"] o.a.c.h.Http11NioProtocol.log(DirectJDKLog.java:173)
2020-11-16 11:04:40.396 [main] INFO Starting service [Tomcat] o.a.c.c.StandardService.log(DirectJDKLog.java:173)
2020-11-16 11:04:40.397 [main] INFO Starting Servlet engine: [Apache Tomcat/9.0.38] o.a.c.c.StandardEngine.log(DirectJDKLog.java:173)
2020-11-16 11:04:40.563 [main] INFO Initializing Spring embedded WebApplicationContext o.a.c.c.C.[.[.[/].log(DirectJDKLog.java:173)
2020-11-16 11:04:40.565 [main] INFO Root WebApplicationContext: initialization completed in 3450 ms o.s.b.w.s.c.ServletWebServerApplicationContext.prepareWebApplicationContext(ServletWebServerApplicationContext.java:285)_ _ |_ _ _|_. ___ _ | _
| | |\/|_)(_| | |_\ |_)||_|_\ / | 3.3.1
2020-11-16 11:04:42.694 [main] INFO Initializing ExecutorService 'applicationTaskExecutor' o.s.s.c.ThreadPoolTaskExecutor.initialize(ExecutorConfigurationSupport.java:181)
2020-11-16 11:04:43.220 [main] INFO Starting ProtocolHandler ["http-nio-8888"] o.a.c.h.Http11NioProtocol.log(DirectJDKLog.java:173)
2020-11-16 11:04:43.279 [main] INFO Tomcat started on port(s): 8888 (http) with context path '' o.s.b.w.e.t.TomcatWebServer.start(TomcatWebServer.java:220)
2020-11-16 11:06:27.647 [http-nio-8888-exec-78] INFO Initializing Spring DispatcherServlet 'dispatcherServlet' o.a.c.c.C.[.[.[/].log(DirectJDKLog.java:173)
2020-11-16 11:06:27.657 [http-nio-8888-exec-78] INFO Initializing Servlet 'dispatcherServlet' o.s.w.s.DispatcherServlet.initServletBean(FrameworkServlet.java:525)
2020-11-16 11:06:27.678 [http-nio-8888-exec-78] INFO Completed initialization in 20 ms o.s.w.s.DispatcherServlet.initServletBean(FrameworkServlet.java:547)
^C2020-11-16 11:07:43.629 [SpringContextShutdownHook] INFO Shutting down ExecutorService 'applicationTaskExecutor' o.s.s.c.ThreadPoolTaskExecutor.shutdown(ExecutorConfigurationSupport.java:218)
总结
相同业务操作,通过http请求,业务服务器读取mysql,返回数据性能对比如下
请求/s | |
.NET Core 3.1 WebApi | 2821.3 |
SpringBoot RestController | 5403.26 |
项目源码地址:https://github.com/hknarutofk/KylinV10Performance