最近朋友圈被Eureka 2.x停止開發的新聞刷屏,例如:
關于第二篇,我想說,這是在造謠。
不妨來看一下官方的言論:
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.
來自: https://github.com/Netflix/eureka/wiki
看清楚官方的言辭:官方隻是說Eureka 2.0的開發被停止了,如果您将Eureka 2.0分支用在生産,将後果自負!
看起來挺吓人的。但真的那麼可怕嗎?
關于Eureka版本
Eureka 2.x從來就沒有正式釋出過! 目前最新的穩定版本是1.9.3。筆者第一次看到Eureka 2.0的文章是2016年,那時候官方宣稱要開發Eureka 2.0,使用小批量的消息推送替代Eureka 1.x中的純心跳機制(基于定時任務)的消息傳遞。
但是兩年過去了,Eureka 2.0最終沒有孵化出來,但是絕不代表Eureka的閉源!官方依然在積極地維護Eureka 1.x!
不妨來看一下Eureka的釋出曆史:
https://github.com/Netflix/eureka/releases
可以看到,Eureka的版本維護相當勤快!
談談2.x的流産
就筆者的研究來看,官方關閉2.x分支至少2年了。隻是最近可能考慮到會有團隊會将Eureka 2.x用于線上,甚至基于2.x開發,是以友情提示一下。
但是問題是:大部分使用者都是因為Spring Cloud才接觸到Eureka,Spring Cloud使用的是Eureka 1.x!退一萬步,你會在自己項目中使用一個非正式釋出的版本嗎?
在我來看,這就是個友情提示,連個新聞都算不上。宣布停止開發已經停止2年的分支,還能算是新聞嗎?
不是個例
事實上,這不是Netflix(開源Eureka的公司)第一次跳票了。
2016年,Netflix宣布将在16年底或17年初開源Zuul 2.x,結果寫完發現太複雜了,而且性能提升也沒有達到預期。于是官方選擇完全重構!知道2018年1月,Zuul 2.x才被開源,2018年4月才釋出到中央倉庫!
https://github.com/netflix/zuul/tree/1.xA 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後,發現代碼複雜度過高,同時性能提升也并沒有預期中的那麼好,于是停止了Netty 5的開發。
那是不是說Netty 5閉源了?
退一萬步
退一萬步講,Eureka即使閉源,Spring Cloud也不至于涼涼。Spring Cloud支援使用Eureka、Zookeeper、Consul實作服務發現的能力。
從Eureka切換成Zookeeper隻需要改個依賴,加兩行配置就可以了。
總結
總而言之:
- Eureka沒有閉源,是Eurkea 2.x分支不再維護!
- Spring Cloud并不強依賴Eureka,Spring Cloud Commons實作了通用抽象,允許我們使用自己喜歡的服務發現元件!
- 悲觀是好事,說明有危機感,但是過度解讀,消費開發人員的情懷就過分了。