Eureka閉源,Spring Cloud就會涼涼嗎?
近日,知名服務注冊與服務發(fā)現工具 Eureka 的 GitHub Wiki 上顯示其 2.0 版本的開源工作已經停止。
筆者朋友圈被 Eureka 2.x 停止開發(fā)的新聞刷屏,例如:
- Eureka 2.0 開源工作宣告停止,繼續(xù)使用風險自負
- 涼涼了,Eureka 宣布閉源,Spring Cloud 何去何從?
關于第二篇,我想說,這是在造謠。
不妨來看一下官方的言論,來自 https://github.com/Netflix/eureka/wiki:
The open source work on eureka 2.0 has been discontinued. The code base and artifacts that were released as part of the existing repository of work on the 2.x branch is considered use at your own risk.
看清楚官方的言辭:官方只是說 Eureka 2.0 的開發(fā)被停止了,如果您將 Eureka 2.0 分支用在生產,將后果自負!
看起來挺嚇人的。但真的那么可怕嗎?
關于 Eureka 版本
Eureka 2.x 從來就沒有正式發(fā)布過! 目前最新的穩(wěn)定版本是 1.9.3。
筆者第一次看到 Eureka 2.0 的文章是 2016 年,那時候官方宣稱要開發(fā) Eureka 2.0,使用小批量的消息推送替代 Eureka 1.x 中的純心跳機制(基于定時任務)的消息傳遞。
但是兩年過去了,Eureka 2.0 最終沒有孵化出來,但是絕不代表 Eureka 的閉源!官方依然在積極地維護 Eureka 1.x!
不妨來看一下 Eureka 的發(fā)布歷史,來自 https://github.com/Netflix/eureka/releases:
從上圖中可以看到,Eureka 的版本維護相當勤快!
Eureka 和服務注冊的關系圖
談談 2.x 的流產
就筆者的研究來看,官方關閉 2.x 分支至少 2 年了。只是最近可能考慮到會有團隊會將 Eureka 2.x 用于線上,甚至基于 2.x 開發(fā),所以友情提示一下。
但是問題是:大部分用戶都是因為 Spring Cloud 才接觸到 Eureka,Spring Cloud 使用的是 Eureka 1.x!退一萬步,你會在自己項目中使用一個非正式發(fā)布的版本嗎?
在我來看,這就是個友情提示,連個新聞都算不上。宣布停止開發(fā)已經停止 2 年的分支,還能算是新聞嗎?
不是個例
事實上,這不是 Netflix(開源 Eureka 的公司)第一次跳票了。
2016 年,Netflix 宣布將在 2016 年底或 2017 年初開源 Zuul 2.x,結果寫完發(fā)現太復雜了,而且性能提升也沒有達到預期。
于是官方選擇完全重構!知道 2018 年 1 月,Zuul 2.x 才被開源,2018 年 4 月才發(fā)布到中央倉庫!
參考鏈接:https://github.com/netflix/zuul/tree/1.x
A lot of people are asking about the status of Zuul 2.0. We are actively working on open sourcing it and with it, likely many filters that we use at Netflix. Yes, we realize it’s been a long time coming. When we initially wrote Zuul 2.0, we heavily relied on RxJava to string filters together with Netty. This ended up adding a lot of complexity to the Zuul 2.0 core as well as made it quite difficult to operate and debug. We didn’t think it was right to release Zuul 2.0 like this. So we spent a lot of time refactoring out this pattern, using Netty constructs directly. This took the better part of a year to complete and deploy safely within Netflix. So this work is now done. We are working towards releasing this much better, easier to understand, and more reliable Zuul 2.0. Obviously Netflix’s business priorities take precedence to our open sourcing efforts, so as we get free time we will put efforts to open sourcing! Stay Tuned.
Current Zuul 2 development is on the 2.1 branch
其他項目的類似情況
不妨多聊聊。相信大家都很熟悉 Netty,或者至少聽說過。
Netty 也有類似的情況。Netty 團隊開源 Netty 5 后,發(fā)現代碼復雜度過高,同時性能提升也并沒有預期中的那么好,于是停止了 Netty 5 的開發(fā)。
那是不是說 Netty 5 閉源了?
退一萬步
退一萬步講,Eureka 即使閉源,Spring Cloud 也不至于涼涼。Spring Cloud 支持使用 Eureka、Zookeeper、Consul 實現服務發(fā)現的能力。
從 Eureka 切換成 Zookeeper 只需要改個依賴,加兩行配置就可以了。
總結
總而言之:
- Eureka 沒有閉源,是 Eurkea 2.x 分支不再維護!
- Spring Cloud 并不強依賴 Eureka,Spring Cloud Commons 實現了通用抽象,允許我們使用自己喜歡的服務發(fā)現組件!
- 悲觀是好事,說明有危機感,但是過度解讀,消費開發(fā)人員的情懷就過分了。