重磅 | Sentinel 成爲 Spring Cloud 官方的主流推薦選擇之一

近日,Sentinel 貢獻的 spring-cloud-circuitbreaker-sentinel  模塊正式被Spring Cloud社區合併至 Spring Cloud Circuit Breaker,由此,Sentinel 加入了 Spring Cloud Circuit Breaker 俱樂部,成爲 Spring Cloud 官方的主流推薦選擇之一。這意味着,Spring Cloud 微服務的開發者在熔斷降級領域有了更多的選擇,可以更方便地利用 Sentinel 來保障微服務的穩定性。

一、什麼是 Spring Cloud Circuit Breaker?

Spring Cloud Circuit Breaker 是 Spring Cloud 官方的熔斷器組件庫,提供了一套統一的熔斷器抽象API接口,允許開發者自由選擇合適的熔斷器實現。這個官方的熔斷器組件庫,截至目前,官方推薦的熔斷器組件有:

  • Hystrix
  • Resilience4J
  • Sentinel
  • Spring Retry

當前,Spring Cloud Circuit Breaker 處於孵化階段中,未來將合併到 Spring Cloud 主幹版本正式發佈。

Spring Cloud Circuit Breaker 
https://github.com/spring-cloud-incubator/spring-cloud-circuitbreaker

二、Sentinel 發展歷程

2012 年,Sentinel 誕生於阿里巴巴集團內部,主要功能爲入口流量控制;

2013 - 2018 年,Sentinel 在阿里巴巴集團內部迅速發展,成爲基礎技術模塊,覆蓋了所有的核心場景。Sentinel 也因此積累了大量的流量控制場景以及生產實踐;

2018年7月,阿里巴巴宣佈限流降級框架組件 Sentinel 正式開源,在此之前,Sentinel 作爲阿里巴巴“大中臺、小前臺”架構中的基礎模塊,已經覆蓋了阿里的所有核心場景,因此積累了大量的流量歸整場景以及生產實踐;

2018年9月,Sentinel 發佈 v0.2.0版本,釋放異步調用支持、熱點參數限流等多個重要特性;

2018年10月,Sentinel 發佈首個 GA 版本 v1.3.0,該版本包括 Sentinel 控制檯功能的完善和一些 bug 修復,以及其它的產品改進;

2018年12月,Sentinel發佈v1.4,加入了開發者關注的集羣流控功能;

2019年1月,Sentinel發佈v1.4,加入了開發者關注的集羣流控功能;

2019年3月,Sentinel 發佈1.5.0 ,引入 Reactive 支持;

2019年4月,Sentinel 貢獻的 spring-cloud-circuitbreaker-sentinel  模塊正式被Spring Cloud社區合併至 Spring Cloud Circuit Breaker,成爲 Spring Cloud 官方的主流推薦選擇之一。

2019年4月25日,Sentinel 發佈 1.6.0 ,提供對 Spring Cloud Gateway、Zuul 等主流 API Gateway 的定製化支持。

三、Sentinel 的技術特點

Sentinel 的核心思想:根據對應資源配置的規則來爲資源執行相應的流控/降級/系統保護策略。在 Sentinel 中資源定義和規則配置是分離的。用戶先通過 Sentinel API 給對應的業務邏輯定義資源,然後可以在需要的時候動態配置規則。

Sentinel 的優勢和特性:

  • 輕量級,核心庫無多餘依賴,性能損耗小。
  • 方便接入,開源生態廣泛。Sentinel 對 Dubbo、Spring Cloud、Web Servlet、gRPC 等常用框架提供適配模塊,只需引入相應依賴並簡單配置即可快速接入;同時針對自定義的場景 Sentinel 還提供低侵入性的註解資源定義方式,方便自定義接入。
  • 豐富的流量控制場景。Sentinel 承接了阿里巴巴近 10 年的雙十一大促流量的核心場景,流控維度包括流控指標、流控效果(塑形)、調用關係、熱點、集羣等各種維度,針對系統維度也提供自適應的保護機制。
  • 易用的控制檯,提供實時監控、機器發現、規則管理等能力。
  • 完善的擴展性設計,提供多樣化的 SPI 接口,方便用戶根據需求給 Sentinel 添加自定義的邏輯。

更多技術特點介紹:
高可用架構社區專訪,點擊這裏

技術選型:Sentinel vs. Hystrix,點擊這裏

四、誰正在使用 Sentinel 

目前已有不少企業用戶在使用開源版本和雲上版本的Sentinel,包括順豐、vivo、每日優鮮、拼多多、易企秀、愛奇藝、融金所、VIPKID、喜馬拉雅FM、百融金服等(按登記順序排序),我們也在社區發起了“who is using Sentinel”[7]的issue,可以去這個頁面瞭解各家企業的使用場景。

同時,我們提供了 Sentinel 的雲上實現,並融入架構可視化、故障演練等功能,形成阿里雲高可用服務 AHAS,目的是幫助更多開發者更方便的接入應用高可用能力。

阿里雲高可用服務 AHAS:
https://cn.aliyun.com/product/ahas](https://cn.aliyun.com/product/ahas)

五、Sentinel 未來的發展方向

未來,Sentinel 會繼續在無規則容量保護的路上探索,提供更多自適應限流策略,更好地結合系統容量來進行流量控制。另外,Sentinel 也會支持更廣泛的開源生態,包括 API Gateway、Service Mesh、多語言客戶端等;同時也會抽象出標準的指標和監控接口,方便對接 Prometheus 等常用的監控系統。未來 Sentinel 會進一步強化集羣流控的能力,加強對 Cloud Native 生態和 Service Mesh 的支持,在雲原生相關領域更好地發揮穩定性保障的作用。

和 Sentinel 相關的開源項目
Sentinel:https://github.com/alibaba/Sentinel
Spring Cloud:https://spring.io/projects/spring-cloud
Spring Cloud Circuit Breaker :https://github.com/spring-cloud-incubator/spring-cloud-circuitbreaker
Dubbo:http://dubbo.apache.org/en-us/
Spring Cloud Alibaba:https://github.com/spring-cloud-incubator/spring-cloud-alibaba
Nacos:https://github.com/alibaba/nacos](https://github.com/alibaba/nacos

Sentinel Contributors
@sczyh30, @carpenterLee, @cdfive, @jasonjoo2010, @mjaow, @canglang1973, @talshalti, @kexianjun,@yikangfeng, @luoxn28, @all4you, @nicktan, @jz0630, @bitonly, @zhaixiaoxiang, @dqing0, @paulkennethkent, @shxz130, @zhousiliang163, @beston123, @lawrencewu, @blindpirate, @HaojunRen, @ATAXGT, @hantianwei, @MickMo, @yklove, @xburning, @yanlinly, @aalmiray, @Leishunyu, @wangjunwei87, @kangyl, @Arlmls, @YoungHu, @foreveryang321, @fangjian0423, @allencloud, @ro9er, @xcaspar, @shannon312, @waveng, @yfh0918, @refactormachine, @jialianglinjl, @kimmking, @nobodyiam, @guonanjun, @manzhizhen, @xg1907

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章