liuzhaowei55
V2EX  ›  Java

Spring Cloud Gateway 一个最简单的项目,为什么隔一段可能一两分钟无请求,再次请求就会响应很慢,直到超时?

  •  
  •   liuzhaowei55 ·
    ysbjlzlx · Dec 30, 2019 · 5316 views
    This topic created in 2393 days ago, the information mentioned may be changed or developed.

    如果在在请求的时候取消掉,再次发送请求就可以了?。


    1. 这个不是 tomcat 由于随机数,启动慢的问题
    2. 这个现象也发生在 Spring Boot 的 web 项目上
    3. 这里有一个 500 错误的截图,我自己看了下,也 Google 了下,没找到相关的一些方向
      WX20191230-160238@2x.png
    4. 这里有我的那个示例代码: https://github.com/anydong/example-spring-cloud-gateway
    5. 我目前是在 macOS 上 idea 运行的,Java 版本 11.0.4
    Supplement 1  ·  Dec 31, 2019

    目前测试来看好像是找到了问题出在哪里:

    spring.cloud.gateway.httpclient.pool.type=disabled
    

    因为我的示例项目中并没有用到 loadbalance ,目前来看关掉连接池,暂时解决了问题,晚点看看上了 lb 之后,去掉这个配置,是不是还会出现问题。

    4 replies    2019-12-31 10:35:10 +08:00
    Michaelssss
        1
    Michaelssss  
       Dec 30, 2019 via Android   ❤️ 1
    考虑下系统问题,尝试 windows 和 linux
    Yuicon
        2
    Yuicon  
       Dec 30, 2019   ❤️ 1
    我也想知道 猜测可能是类似数据库链接其实已经过期了 但是程序还是持有
    lavvrence
        3
    lavvrence  
       Dec 31, 2019   ❤️ 1
    把 maven 引入的包删了重新导入一遍看看
    liuzhaowei55
        4
    liuzhaowei55  
    OP
       Dec 31, 2019
    @liuzhaowei55 @Michaelssss @Yuicon @jaylee4869
    感谢回复,可能是我的示例项目没有使用 lb,所以当我我把 httpclient 连接池禁用后,就可以了。
    ```
    spring.cloud.gateway.httpclient.pool.type=disabled
    ```
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   898 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 49ms · UTC 19:32 · PVG 03:32 · LAX 12:32 · JFK 15:32
    ♥ Do have faith in what you're doing.