一、背景
我们在落地微服务网关的时候,采用的SpringCloudZuul,老大提了一个问题,如果网关在代码服务1阻塞的时候,是否会阻塞服务2/服务3/服务4…等。带着这个问题我进行了探索。
二、测试过程
2.1 SpringCloudZuul模拟服务阻塞测试
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/61338e438e5cd794e420a14a127da68a.png)
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/1103c3e3661c883287db80e645a537b6.png)
可以看到服务2阻塞了。
为了让测试效果更明显,我们增加并发用户数到400。
tomcat maxThreads参数(请求处理线程的最大数量)为200,当并发请求个数超过200时,就需要排队。![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/bad71168f34deec8b4babf768f20ca9b.png)
2.2 SpringCloudGateway模拟服务阻塞测试
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/cad821be48d4e87e677ab9edaa472b1b.png)