Webflux仅允许6个api连接 [英] Webflux only allowing 6 connections for the api

查看:81
本文介绍了Webflux仅允许6个api连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然对TestController进行以下调用 http://localhost:8080/test 能够从服务器并行获得更多的6个响应.这些请求只是继续等待我之前完成的请求.有没有办法增加每个API(控制器)的数量?

While making the following call http://localhost:8080/test for the the TestController I was not able to get more the 6 responses from the server in parallel. The requests just keep waiting for the request I made before to finish. Is there a way to increase this number per API(Controller)?

TestController

@RestController
@RequestMapping("/test")
class TestController() {


    @GetMapping(produces = [MediaType.TEXT_EVENT_STREAM_VALUE])
    fun test(): Flux<String> {
        return Flux
                .interval(Duration.ofSeconds(1))
                .map { t ->  "test $t"}

    }
}

运行应用程序的计算机中的CPU数量: 8

推荐答案

我假设您正在从Internet浏览器中调用服务器.浏览器限制是最多6个与域的连接.HTTP/2或WebSocket可以提供解决方案.

I'm assuming you're calling your server from an internet browser. Max 6 connections to a domain is a known browser limitation. HTTP/2 or WebSocket can offer a solution.

这篇关于Webflux仅允许6个api连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆