zoukankan      html  css  js  c++  java
  • Feign的性能优化

    Feign底层的客户端实现:

    • URLConnection:默认实现,不支持连接池
    • Apache HttpClient :支持连接池
    • OKHttp:支持连接池

    因此优化Feign的性能主要包括:

    • 使用连接池代替默认的URLConnection
    • 日志级别,最好用basic或none

    连接池配置

    Feign添加HttpClient或OKHttp代替URLConnection

    添加HttpClient依赖

            <dependency>
                <groupId>io.github.openfeign</groupId>
                <artifactId>feign-httpclient</artifactId>
            </dependency>

    配置连接池

    feign:
      client:
        config:
          userservice:
            loggerLevel: BASIC
      httpclient:
        enabled: true # 开启feign对HttpClient的支持
        max-connections: 200 # 最大的连接数
        max-connections-per-route: 50 # 每个路径的最大连接数
  • 相关阅读:
    4.比赛F
    4.M
    4.H
    4.J
    4.G
    4.D
    4.C
    UVA 215 Spreadsheet Calculator (模拟)
    POJ 3469 Dual Core CPU(最小割模型的建立)
    POJ 3281 Dining(网络流最大匹配)
  • 原文地址:https://www.cnblogs.com/WarBlog/p/15419789.html
Copyright © 2011-2022 走看看