soul从入门到进阶06——运行soul-examples-dubbo

2024-01-22 12:18

本文主要是介绍soul从入门到进阶06——运行soul-examples-dubbo,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

前面我们初步尝试了soul网关的http协议相关的功能。这篇我们来看一下 dubbo协议的功能。

1. 启动soul-admin 和 soul-bootstrap

省略 可参考 soul从入门到进阶01——soul网关初体验

2. 启动 soul-example-dubbo
  1. 打开命令行
  2. cd soul-examples
  3. cd soul-examples-dubbo

可以看到分别是apache dubboe的example和 alibaba dubbo的example

  1. 进入 soul-examples-apache-dubbo-service 这个模块
  2. 运行 TestApacheDubboApplication
  3. 发现报错了,显示zookeeper 没有连接
  4. 下载一个zookeeper ,注意 如果是初次使用,需要将conf文件夹下的zoo_sample.cfg 复制为名为zoo.cfg的文件,否则会报以下错误。
pache-zookeeper-3.6.2-bin/bin/../conf/zoo.cfg: No such file or directory
  1. 此时再次启动 TestApacheDubboApplication
3 查看soul-admin
  1. 如下图所示,dubbo这个插件里多了一个选择器。选择器里面有很多规则。

在这里插入图片描述

4. 通过http访问dubbo
  1. 在 postman 请求http://localhost:9195/dubbo/findAll
{"code": 200,"message": "Access to success!","data": {"name": "hello world Soul Apache, findAll","id": "-275502741"}
}
  1. 发现bootstrap 打印了如下日志
2021-01-21 00:13:35.517  INFO 23633 --- [-work-threads-1] o.d.soul.plugin.base.AbstractSoulPlugin  : dubbo selector success match , selector name :/dubbo
2021-01-21 00:13:35.518  INFO 23633 --- [-work-threads-1] o.d.soul.plugin.base.AbstractSoulPlugin  : dubbo selector success match , selector name :/dubbo/findAll
5. 修改规则
  1. 在soul-admin 将 【dubbo插件】——【dubbo选择器】——【/dubbo/findAll 规则】关闭。
  2. 再次请求 http://localhost:9195/dubbo/findAll
  3. 响应结果如下 ,没有这条规则,就不能访问
{"code": -102,"message": "Rule not found!","data": null
}
6. 压测一下
wrk -t16 -c200 -d30s  http://localhost:9195/dubbo/findAll
Running 30s test @ http://localhost:9195/dubbo/findAll16 threads and 200 connectionsThread Stats   Avg      Stdev     Max   +/- StdevLatency    17.82ms   24.68ms 498.22ms   93.66%Req/Sec   829.79    268.27     1.51k    69.90%379644 requests in 30.09s, 66.61MB readSocket errors: connect 0, read 157, write 0, timeout 0
Requests/sec:  12616.85
Transfer/sec:      2.21MB
Running 30s test @ http://localhost:9195/dubbo/findAll16 threads and 200 connectionsThread Stats   Avg      Stdev     Max   +/- StdevLatency    13.00ms   11.01ms 121.05ms   74.91%Req/Sec     1.05k   142.75     1.52k    74.88%500028 requests in 30.03s, 87.73MB readSocket errors: connect 0, read 34, write 0, timeout 0
Requests/sec:  16653.62
Transfer/sec:      2.92MB
Running 30s test @ http://localhost:9195/dubbo/findAll16 threads and 200 connectionsThread Stats   Avg      Stdev     Max   +/- StdevLatency    29.02ms   38.88ms 245.86ms   87.01%Req/Sec   710.10    181.88     1.43k    72.27%339633 requests in 30.06s, 59.59MB readSocket errors: connect 0, read 44, write 0, timeout 0
Requests/sec:  11298.65
Transfer/sec:      1.98MB

发现qps在1.2w左右。
采用 压测soul网关 中的办法 将soul-bootstrap 的日志级别调整为warn再次压测

结果如下

Running 30s test @ http://localhost:9195/dubbo/findAll16 threads and 200 connectionsThread Stats   Avg      Stdev     Max   +/- StdevLatency    15.63ms   21.21ms 391.96ms   91.58%Req/Sec     0.96k   275.19     1.86k    72.45%453131 requests in 30.04s, 79.51MB readSocket errors: connect 0, read 167, write 0, timeout 0
Requests/sec:  15082.54
Transfer/sec:      2.65MB
Running 30s test @ http://localhost:9195/dubbo/findAll16 threads and 200 connectionsThread Stats   Avg      Stdev     Max   +/- StdevLatency    13.16ms   14.72ms  81.69ms   84.26%Req/Sec     1.34k   185.92     2.12k    69.48%641716 requests in 30.02s, 112.59MB readSocket errors: connect 0, read 53, write 0, timeout 0
Requests/sec:  21376.63
Transfer/sec:      3.75MB
Running 30s test @ http://localhost:9195/dubbo/findAll16 threads and 200 connectionsThread Stats   Avg      Stdev     Max   +/- StdevLatency    20.25ms   27.69ms 136.29ms   83.67%Req/Sec     1.32k   263.94     2.43k    69.90%630119 requests in 30.02s, 110.56MB readSocket errors: connect 0, read 51, write 0, timeout 0
Requests/sec:  20987.25
Transfer/sec:      3.68MB

性能明显提升了,可以达到2w的qps

这篇关于soul从入门到进阶06——运行soul-examples-dubbo的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/632937

相关文章

springboot+dubbo实现时间轮算法

《springboot+dubbo实现时间轮算法》时间轮是一种高效利用线程资源进行批量化调度的算法,本文主要介绍了springboot+dubbo实现时间轮算法,文中通过示例代码介绍的非常详细,对大家... 目录前言一、参数说明二、具体实现1、HashedwheelTimer2、createWheel3、n

Spring Boot + MyBatis Plus 高效开发实战从入门到进阶优化(推荐)

《SpringBoot+MyBatisPlus高效开发实战从入门到进阶优化(推荐)》本文将详细介绍SpringBoot+MyBatisPlus的完整开发流程,并深入剖析分页查询、批量操作、动... 目录Spring Boot + MyBATis Plus 高效开发实战:从入门到进阶优化1. MyBatis

Java终止正在运行的线程的三种方法

《Java终止正在运行的线程的三种方法》停止一个线程意味着在任务处理完任务之前停掉正在做的操作,也就是放弃当前的操作,停止一个线程可以用Thread.stop()方法,但最好不要用它,本文给大家介绍了... 目录前言1. 停止不了的线程2. 判断线程是否停止状态3. 能停止的线程–异常法4. 在沉睡中停止5

Java进阶学习之如何开启远程调式

《Java进阶学习之如何开启远程调式》Java开发中的远程调试是一项至关重要的技能,特别是在处理生产环境的问题或者协作开发时,:本文主要介绍Java进阶学习之如何开启远程调式的相关资料,需要的朋友... 目录概述Java远程调试的开启与底层原理开启Java远程调试底层原理JVM参数总结&nbsMbKKXJx

Python FastAPI入门安装使用

《PythonFastAPI入门安装使用》FastAPI是一个现代、快速的PythonWeb框架,用于构建API,它基于Python3.6+的类型提示特性,使得代码更加简洁且易于绶护,这篇文章主要介... 目录第一节:FastAPI入门一、FastAPI框架介绍什么是ASGI服务(WSGI)二、FastAP

在VSCode中本地运行DeepSeek的流程步骤

《在VSCode中本地运行DeepSeek的流程步骤》本文详细介绍了如何在本地VSCode中安装和配置Ollama和CodeGPT,以使用DeepSeek进行AI编码辅助,无需依赖云服务,需要的朋友可... 目录步骤 1:在 VSCode 中安装 Ollama 和 CodeGPT安装Ollama下载Olla

解读docker运行时-itd参数是什么意思

《解读docker运行时-itd参数是什么意思》在Docker中,-itd参数组合用于在后台运行一个交互式容器,同时保持标准输入和分配伪终端,这种方式适合需要在后台运行容器并保持交互能力的场景... 目录docker运行时-itd参数是什么意思1. -i(或 --interactive)2. -t(或 --

MySQL进阶之路索引失效的11种情况详析

《MySQL进阶之路索引失效的11种情况详析》:本文主要介绍MySQL查询优化中的11种常见情况,包括索引的使用和优化策略,通过这些策略,开发者可以显著提升查询性能,需要的朋友可以参考下... 目录前言图示1. 使用不等式操作符(!=, <, >)2. 使用 OR 连接多个条件3. 对索引字段进行计算操作4

pycharm远程连接服务器运行pytorch的过程详解

《pycharm远程连接服务器运行pytorch的过程详解》:本文主要介绍在Linux环境下使用Anaconda管理不同版本的Python环境,并通过PyCharm远程连接服务器来运行PyTorc... 目录linux部署pytorch背景介绍Anaconda安装Linux安装pytorch虚拟环境安装cu

JavaScript中的reduce方法执行过程、使用场景及进阶用法

《JavaScript中的reduce方法执行过程、使用场景及进阶用法》:本文主要介绍JavaScript中的reduce方法执行过程、使用场景及进阶用法的相关资料,reduce是JavaScri... 目录1. 什么是reduce2. reduce语法2.1 语法2.2 参数说明3. reduce执行过程