中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

dw做網(wǎng)站投票網(wǎng)址收錄入口

dw做網(wǎng)站投票,網(wǎng)址收錄入口,用vs2010做網(wǎng)站,做營(yíng)銷型網(wǎng)站的企業(yè)1. 引言 在微服務(wù)架構(gòu)中,服務(wù)的彈性是非常重要的。Resilience4j 是一個(gè)輕量級(jí)的容錯(cuò)庫(kù),專為函數(shù)式編程設(shè)計(jì),提供了斷路器、重試、艙壁、限流器和限時(shí)器等功能。 這里不做過(guò)多演示,只是查看一下官方案例并換成maven構(gòu)建相關(guān)展示&…

1. 引言

在微服務(wù)架構(gòu)中,服務(wù)的彈性是非常重要的。Resilience4j 是一個(gè)輕量級(jí)的容錯(cuò)庫(kù),專為函數(shù)式編程設(shè)計(jì),提供了斷路器、重試、艙壁、限流器和限時(shí)器等功能。

這里不做過(guò)多演示,只是查看一下官方案例并換成maven構(gòu)建相關(guān)展示;

2.配置

spring:application.name: resilience4j-demojackson.serialization.indent_output: true # 格式化輸出jsonserver:port: 9080management.endpoints.web.exposure.include: '*' # 暴露所有端點(diǎn)
management.endpoint.health.show-details: always # 顯示詳細(xì)健康信息management.health.diskspace.enabled: false # 關(guān)閉磁盤空間健康檢查
management.health.db.enabled: false # 關(guān)閉數(shù)據(jù)庫(kù)健康檢查
management.health.circuitbreakers.enabled: true #  開(kāi)啟斷路器健康檢查
management.health.conditions.enabled: false # 關(guān)閉條件健康檢查
management.health.ratelimiters.enabled: false # 關(guān)閉限流器健康檢查info:name: ${spring.application.name}description: resilience4j demoenvironment: ${spring.profiles.active}version: 0.0.1management.metrics.tags.application: ${spring.application.name} # 添加自定義標(biāo)簽
management.metrics.distribution.percentiles-histogram.http.server.requests: true # 開(kāi)啟http請(qǐng)求統(tǒng)計(jì)
management.metrics.distribution.percentiles-histogram.resilience4j.circuitbreaker.calls: true # 開(kāi)啟斷路器統(tǒng)計(jì)#resilience4j.circuitbreaker.metrics.use_legacy_binder: true # 使用舊版綁定器resilience4j.circuitbreaker: # 斷路器配置configs:default:registerHealthIndicator: true # 開(kāi)啟健康檢查slidingWindowSize: 10 # 滑動(dòng)窗口大小minimumNumberOfCalls: 5 # 最小調(diào)用次數(shù)permittedNumberOfCallsInHalfOpenState: 3 # 半開(kāi)狀態(tài)最大調(diào)用次數(shù)automaticTransitionFromOpenToHalfOpenEnabled: true # 自動(dòng)切換到半開(kāi)狀態(tài)waitDurationInOpenState: 5s # 半開(kāi)狀態(tài)等待時(shí)間failureRateThreshold: 50 # 失敗率閾值eventConsumerBufferSize: 10 # 事件消費(fèi)者緩沖區(qū)大小recordExceptions: # 記錄異常- org.springframework.web.client.HttpServerErrorException # http服務(wù)端錯(cuò)誤- java.util.concurrent.TimeoutException # 超時(shí)異常- java.io.IOException # IO異常ignoreExceptions: # 忽略異常- io.github.robwin.exception.BusinessException # 業(yè)務(wù)異常shared: # 共享配置slidingWindowSize: 100 # 滑動(dòng)窗口大小permittedNumberOfCallsInHalfOpenState: 30 # 半開(kāi)狀態(tài)最大調(diào)用次數(shù)waitDurationInOpenState: 1s # 半開(kāi)狀態(tài)等待時(shí)間failureRateThreshold: 50 # 失敗率閾值eventConsumerBufferSize: 10 # 事件消費(fèi)者緩沖區(qū)大小ignoreExceptions: # 忽略異常- io.github.robwin.exception.BusinessException # 業(yè)務(wù)異常instances: # 實(shí)例配置backendA: # 配置 backendA 實(shí)例baseConfig: default # 使用 default 配置backendB: # 配置 backendB 實(shí)例registerHealthIndicator: true # 開(kāi)啟健康檢查slidingWindowSize: 10 # 滑動(dòng)窗口大小minimumNumberOfCalls: 10 # 最小調(diào)用次數(shù)permittedNumberOfCallsInHalfOpenState: 3 # 半開(kāi)狀態(tài)最大調(diào)用次數(shù)waitDurationInOpenState: 5s # 半開(kāi)狀態(tài)等待時(shí)間failureRateThreshold: 50 # 失敗率閾值eventConsumerBufferSize: 10 # 事件消費(fèi)者緩沖區(qū)大小recordFailurePredicate: io.github.robwin.exception.RecordFailurePredicate # 記錄異常
resilience4j.retry: # 重試配置configs:default:maxAttempts: 3 # 最大重試次數(shù)waitDuration: 100 # 重試間隔時(shí)間 (ms)retryExceptions: # 記錄異常- org.springframework.web.client.HttpServerErrorException # http服務(wù)端錯(cuò)誤- java.util.concurrent.TimeoutException # 超時(shí)異常- java.io.IOException # IO異常ignoreExceptions: # 忽略異常- io.github.robwin.exception.BusinessException # 業(yè)務(wù)異常instances:backendA: # 配置 backendA 實(shí)例baseConfig: default # 使用 default 配置backendB: # 配置 backendB 實(shí)例baseConfig: default # 使用 default 配置
resilience4j.bulkhead: # 艙壁 批量請(qǐng)求配置configs:default:maxConcurrentCalls: 100 # 最大并發(fā)調(diào)用數(shù)instances:backendA: # 配置 backendA 實(shí)例maxConcurrentCalls: 10 # 最大并發(fā)調(diào)用數(shù)backendB:maxWaitDuration: 10ms # 最大等待時(shí)間maxConcurrentCalls: 20 # 最大并發(fā)調(diào)用數(shù)resilience4j.thread-pool-bulkhead: # 線程池艙壁 批量請(qǐng)求配置configs:default:maxThreadPoolSize: 4 # 最大線程池大小coreThreadPoolSize: 2 # 核心線程池大小queueCapacity: 2 # 隊(duì)列容量instances:backendA:baseConfig: default # 使用 default 配置backendB:maxThreadPoolSize: 1 # 覆蓋默認(rèn)配置,最大線程池大小coreThreadPoolSize: 1 # 覆蓋默認(rèn)配置,核心線程池大小queueCapacity: 1 # 覆蓋默認(rèn)配置,隊(duì)列容量resilience4j.ratelimiter: # 限流器配置configs:default:registerHealthIndicator: false # 關(guān)閉健康檢查limitForPeriod: 10 # 每個(gè)周期內(nèi)的請(qǐng)求限制數(shù)limitRefreshPeriod: 1s # 周期刷新時(shí)間,即每秒刷新一次timeoutDuration: 0 # 請(qǐng)求超時(shí)時(shí)間,0表示不超時(shí)eventConsumerBufferSize: 100 # 事件消費(fèi)者緩沖區(qū)大小instances:backendA:baseConfig: default # 使用默認(rèn)配置backendB:limitForPeriod: 6 # 每個(gè)周期內(nèi)的請(qǐng)求限制數(shù)limitRefreshPeriod: 500ms # 周期刷新時(shí)間,即每500毫秒刷新一次timeoutDuration: 3s # 請(qǐng)求超時(shí)時(shí)間,3秒resilience4j.timelimiter: # 限時(shí)器配置configs:default:cancelRunningFuture: false # 是否取消正在運(yùn)行的FuturetimeoutDuration: 2s # 超時(shí)時(shí)間,2秒instances:backendA:baseConfig: default # 使用默認(rèn)配置backendB:baseConfig: default # 使用默認(rèn)配置

?3.依賴

 <parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.7.5</version><relativePath/> <!-- lookup parent from repository --></parent><properties><maven.compiler.source>17</maven.compiler.source><maven.compiler.target>17</maven.compiler.target><resilience4j.version>2.0.2</resilience4j.version></properties><dependencies><!-- Spring Boot Starters --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-webflux</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-aop</artifactId></dependency><!-- Resilience4j --><dependency><groupId>io.github.resilience4j</groupId><artifactId>resilience4j-spring-boot2</artifactId><version>${resilience4j.version}</version></dependency><dependency><groupId>io.github.resilience4j</groupId><artifactId>resilience4j-all</artifactId><version>${resilience4j.version}</version></dependency><dependency><groupId>io.github.resilience4j</groupId><artifactId>resilience4j-reactor</artifactId><version>${resilience4j.version}</version></dependency><!-- Micrometer Prometheus --><dependency><groupId>io.micrometer</groupId><artifactId>micrometer-registry-prometheus</artifactId></dependency><!-- Chaos Monkey for Spring Boot --><dependency><groupId>de.codecentric</groupId><artifactId>chaos-monkey-spring-boot</artifactId><version>2.7.0</version></dependency><!-- Vavr Jackson --><dependency><groupId>io.vavr</groupId><artifactId>vavr-jackson</artifactId><version>0.10.3</version></dependency><!-- Test Dependencies --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency><dependency><groupId>io.projectreactor</groupId><artifactId>reactor-test</artifactId><version>3.4.22</version><scope>test</scope></dependency></dependencies>

?這里正好用Prometheus和Grafana看看效果

4 總結(jié)

通過(guò)本文的介紹,你應(yīng)該已經(jīng)了解了如何在 Spring Boot 項(xiàng)目中配置和使用 Resilience4j 來(lái)實(shí)現(xiàn)斷路器、重試、艙壁、限流器和限時(shí)器等功能,Resilience4j 提供了豐富的配置選項(xiàng)和靈活的使用方式,幫助你構(gòu)建彈性的微服務(wù)。

http://www.risenshineclean.com/news/9102.html

相關(guān)文章:

  • 比較好的推廣平臺(tái)seo有名氣的優(yōu)化公司
  • 運(yùn)城 網(wǎng)站制作企業(yè)郵箱賬號(hào)
  • 網(wǎng)站建設(shè)公司業(yè)務(wù)在哪里來(lái)手機(jī)怎么創(chuàng)建自己的網(wǎng)站平臺(tái)
  • b2b電子商務(wù)網(wǎng)站推廣銷售新手怎么找客源
  • 長(zhǎng)春網(wǎng)站建設(shè)工作室seo優(yōu)化一般包括哪些
  • 網(wǎng)站頂部素材沈陽(yáng)seo排名收費(fèi)
  • 做食品網(wǎng)站需要什么資質(zhì)嗎公司網(wǎng)站設(shè)計(jì)公司
  • 珠海網(wǎng)站建設(shè)zhkmkj今天最近的新聞
  • 網(wǎng)站開(kāi)發(fā)ide淘寶客推廣一天80單
  • dreamwearver可以做網(wǎng)站嗎免費(fèi)大數(shù)據(jù)平臺(tái)
  • 綜合網(wǎng)站建設(shè)網(wǎng)絡(luò)營(yíng)銷是什么意思?
  • 武漢建站公司排名百度搜索高級(jí)搜索
  • 如何做網(wǎng)站收錄百度關(guān)鍵詞收錄
  • 網(wǎng)站首頁(yè) 如何設(shè)置抖音怎么運(yùn)營(yíng)和引流
  • 做服裝搭配圖的網(wǎng)站有哪些搜索量查詢百度指數(shù)
  • 杭州微信網(wǎng)站制作營(yíng)銷百度app下載手機(jī)版
  • 國(guó)外做飲料視頻網(wǎng)站佛山網(wǎng)站設(shè)計(jì)實(shí)力樂(lè)云seo
  • 做淘寶要用到哪些網(wǎng)站網(wǎng)站轉(zhuǎn)讓出售
  • wordpress 文章標(biāo)題調(diào)用站長(zhǎng)工具seo詞語(yǔ)排名
  • 淄博教育學(xué)校網(wǎng)站建設(shè)優(yōu)就業(yè)seo課程學(xué)多久
  • wap網(wǎng)站和app的區(qū)別搜索引擎營(yíng)銷的模式有哪些
  • 深圳龍華做網(wǎng)站公司seo排名賺掛機(jī)
  • 阿里百秀 wordpress網(wǎng)站seo推廣營(yíng)銷
  • 建設(shè)端午節(jié)網(wǎng)站的目的主題怎么推廣網(wǎng)頁(yè)
  • 做爰全過(guò)程免費(fèi)的網(wǎng)站視頻廣告公司怎么找客戶資源
  • 東莞前10大互聯(lián)網(wǎng)公司鄭州seo外包顧問(wèn)熱狗
  • 怎么在網(wǎng)上做網(wǎng)站百度賬號(hào)登錄個(gè)人中心
  • 全國(guó)建設(shè)項(xiàng)目竣工驗(yàn)收公示網(wǎng)站廣州網(wǎng)站優(yōu)化服務(wù)
  • 濟(jì)南萊蕪金點(diǎn)子信息港關(guān)鍵詞優(yōu)化是怎么弄的
  • 公司網(wǎng)站怎么建立愛(ài)站網(wǎng)關(guān)鍵詞密度查詢