open Feign 连接池(性能提升)

Open Feign对HTTP请求做了优化,并且可以提供了多种客户端选择,来优化HTTP请求发起,以下是HTTP请求支持的三种方式

  1. HttpURLConnection:默认实现,不支持连接池

  2. Apache HTTPClient:支持连接池

  3. OKHttp:支持连接池

OKHttp:

相关依赖

XML 复制代码
<!--OK http 的依赖 -->
        <dependency>
            <groupId>io.github.openfeign</groupId>
            <artifactId>feign-okhttp</artifactId>
        </dependency>

添加配置

XML 复制代码
feign:
  okhttp:
    enabled: true
  client:
    config:
      default:
        connect-timeout: 5000 #连接超时时间
        read-timeout: 5000 #读超时时间
        logger-level: basic #日志级别

HttpClient:

相关依赖:

XML 复制代码
 <!--feign httpclient-->
        <dependency>
            <groupId>io.github.openfeign</groupId>
            <artifactId>feign-httpclient</artifactId>
        </dependency>

添加配置:

XML 复制代码
feign:
  httpclient:
    enabled: true
  client:
    config:
       default:
         logger-level: basic # 日志级别
         connect-timeout: 5000 # 连接超时 单位ms
         read-timeout: 5000 # 读取超时 单位ms
相关推荐
悄悄敲敲敲2 小时前
MySQL表的约束
数据库·mysql
鼠爷ねずみ2 小时前
SpringCloud前后端整体开发流程-以及技术总结文章实时更新中
java·数据库·后端·spring·spring cloud
九皇叔叔2 小时前
MySQL 数据库 Read View 详解
数据库·mysql·mvcc·read view
Elastic 中国社区官方博客4 小时前
Elasticsearch:圣诞晚餐 BBQ - 图像识别
大数据·数据库·elasticsearch·搜索引擎·ai·全文检索
cui_win4 小时前
Prometheus实战教程 - Redis 监控
数据库·redis·prometheus
JIngJaneIL4 小时前
基于java + vue个人博客系统(源码+数据库+文档)
java·开发语言·前端·数据库·vue.js·spring boot
TG:@yunlaoda360 云老大4 小时前
华为云国际站代理商备份策略设置过程中遇到问题如何解决?
服务器·数据库·华为云
SelectDB5 小时前
Doris Catalog 已上线!性能提升 200x,全面优于 JDBC Catalog,跨集群查询迈入高性能分析时代
数据库·数据分析·apache
TAEHENGV5 小时前
进度跟踪模块 Cordova 与 OpenHarmony 混合开发实战
android·javascript·数据库
神秘面具男035 小时前
MySQL 从基础到实践
数据库·mysql