【国产化信创实践】宝兰德bes中间件集成springboot

文章介绍了如何在SpringBoot应用中移除默认的Tomcat中间件,转而使用BES中间件,并提供了配置步骤,包括仓库设置和依赖引入。此外,还对比了BES、Tomcat、Jetty和Undertow在不同并发量下的性能表现,展示出在同步和异步服务场景下各中间件的优劣。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  1. 在springboot应用中pom.xml文件中去掉默认的tomcat中间件依赖

    <dependency>
    
     <groupId>org.springframework.boot</groupId>
    
     <artifactId>spring-boot-starter-web</artifactId>
    
     <exclusions>
    
       <exclusion>
    
         <groupId>org.springframework.boot</groupId>
    
         <artifactId>spring-boot-starter-tomcat</artifactId>
    
       </exclusion>
    
     </exclusions>
    
    </dependency>

  2. 引入BES中间件插件依赖

    <!-- 添加宝兰德中间件依赖 -->
    
    <dependency>
    
     <groupId>com.bes.besstarter</groupId>
    
     <artifactId>bes-lite-spring-boot-2.x-starter</artifactId>
    
     <version>9.5.2</version>
    
    </dependency>
    
    <!-- 提供国密服务,选择性引入 -->
    
    <dependency>
    
     <groupId>com.bes.besstarter</groupId>
    
     <artifactId>bes-gmssl</artifactId>
    
     <version>9.5.2</version>
    
    </dependency>
    
    <!-- 提供jsp服务,选择性引入 -->
    
    <dependency>
    
     <groupId>com.bes.besstarter</groupId>
    
     <artifactId>bes-jasper</artifactId>
    
     <version>9.5.2</version>
    
    </dependency>
    
    <!-- 提供数据源服务,选择性引入-->
    
    <dependency>
    
     <groupId>com.bes.besstarter</groupId>
    
     <artifactId>bes-jdbcra</artifactId>
    
     <version>9.5.2</version>
    
    </dependency>
    
    <!-- 提供websocket服务,选择性引入-->
    
    <dependency>
    
     <groupId>com.bes.besstarter</groupId>
    
     <artifactId>bes-websocket</artifactId>
    
     <version>9.5.2</version>
    
    </dependency>

 *** bes依赖所在仓库为  xxXX,请改为您实际使用的仓库地址。

当信创组件仓库与本地私服仓库不一致时,需要配置maven双远程仓库

<repositories>

    <repository>

        <id>des</id>

        <name>desTest</name>

        <url>http://XXX/artifactory/bes-maven-release/</url>

        <releases>

            <enabled>true</enabled>

        </releases>

        <snapshots>

            <enabled>false</enabled>

        </snapshots>

        <layout>

            default

        </layout>

    </repository>

</repositories>

     同时设置本地maven的setting.xml

 折叠原码

<mirror>

     <id>nexus</id>

     <mirrorOf>*,!des</mirrorOf>

     <url>http://YYYY/repository/maven-public/</url>

</mirror>

    3. 启动项目,出现如下图所示即为成功配置

         

 

           !!!如果引入SDK公共工具类,也要移除tomcat

<dependency>

  <groupId>com.xxx.mdd</groupId>

  <artifactId>mdd-framework-util</artifactId>

  <exclusions>

    <exclusion>

       <groupId>org.apache.tomcat.embed</groupId>

       <artifactId>tomcat-embed-core</artifactId>

    </exclusion>

  </exclusions>

  <version>1.0.4</version>

</dependency>

3.调研报告

BES中间件与tomcat中间件,jetty和undertow性能对比,以上中间件最大连接数等配置都为默认配置时

1.以下测试在http非异步情况下:

并发量

平均响应时间(ms)

(最小 - 最大响应时间)

错误率(%)

吞吐量(/sec)

BES

1W

37532

(22-81587)

34611

(9-79063)

13.32

20.90

99.7

125.2

tomcat

31772

(2-75605)

31976.4

(17-74998)

18.67

20.36

120.77

122.3

jetty

undertow

24786.4

(825-65128.4)

25133.4

(396-65385)

31

30

140

137.6

BES

5000

23022

(319-45357)

21788.6

(161-44551)

3.9

4.7

102.4

106.7

tomcat

23590.8

(908-46819)

23457.6

(168-46581)

1.4

1.2

102.4

102.8

jetty

22275.6

(588.2-42470)

22191.2

(352-41460)

13.8

17.2

112.7

116.93

undertow

23764.2

(878.2-46893)

23556

(413-46106)

0.79

0.6

102.2

103

BES

1000

4642.4

(70.6-9225.2)

4723.6

(190.8-9227)

0

0

105.2

104.06

tomcat

4674.6

(198-9164.2)

4686

(182.2-9137)

0

0

105.13

104.84

jetty

4836.6

(184.8-9600)

4718.8

(209.4-9279)

0

0

101.4

104

undertow

4731.6

(232.2-9206)

4820.4

(340.4-9369)

0

0

103.6

101

BES

500

2378.2

(133.4-4714)

2414.4

(117.8-4759)

0

0

101.6

100.6

tomcat

2473.8

(114.4-4893.4)

2469.4

(166.8-4874)

0

0

98.67

97.85

jetty

2423

(131.2-4791.6)

2474.8

(106-4906.4)

0

0

99.78

98.16

undertow

2443

(271-4638.2)

2318.2

(170-4530.8)

0

0

100

104.4

BES

100

453

(60.6-908.4)

545

(59.2-990)

0

0

100.8

92.2

tomcat

473

(69.4-934.2)

505

(50.8-952.2)

0

0

100.57

96.87

jetty

488.2

(62.4-972.4)

476.4

(78.6-909.8)

0

0

94.2

99.4

undertow

465

(70.6-910.2)

481.4

(89.4-906.4)

0

0

100.8

101.99

同步服务情况下,结论:1).随着并发量增大undertow性能最优;bes中间件性能最差;

2).在并发量不大的情况,中间件性能相差不大;

2.以下测试在http异步情况下:

并发量1000

平均响应时间

吞吐量

Bes

500.55

582.16

tomcat

618.35

562

jetty

424.45

569.36

undertow

481.2

627.1

并发量500

平均响应时间

吞吐量

Bes

249.35

567.4

tomcat

229.6

656.13

jetty

278

641.02

undertow

168.05

614.85

并发量100

平均响应时间

吞吐量

Bes

46.55

796.6

tomcat

42.2

867.89

jetty

242.3

169.5

undertow

52

795.36

异步服务情况下,结论:1).随着并发量增大jetty最优;并发量500左右情况下,undertow的性能较好;bes中间件和tomcat响应时间越长;

2)并发量不大的情况下,jetty平均性能最差,其他三个中间件平均响应时间相差不大。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

0海滨小城0

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值