Eureka閉源,Spring Cloud就會(huì)涼涼嗎?
近日,知名服務(wù)注冊(cè)與服務(wù)發(fā)現(xiàn)工具 Eureka 的 GitHub Wiki 上顯示其 2.0 版本的開源工作已經(jīng)停止。
筆者朋友圈被 Eureka 2.x 停止開發(fā)的新聞刷屏,例如:
- Eureka 2.0 開源工作宣告停止,繼續(xù)使用風(fēng)險(xiǎn)自負(fù)
- 涼涼了,Eureka 宣布閉源,Spring Cloud 何去何從?
關(guān)于第二篇,我想說(shuō),這是在造謠。
不妨來(lái)看一下官方的言論,來(lái)自 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.
看清楚官方的言辭:官方只是說(shuō) Eureka 2.0 的開發(fā)被停止了,如果您將 Eureka 2.0 分支用在生產(chǎn),將后果自負(fù)!
看起來(lái)挺嚇人的。但真的那么可怕嗎?
關(guān)于 Eureka 版本
Eureka 2.x 從來(lái)就沒(méi)有正式發(fā)布過(guò)! 目前最新的穩(wěn)定版本是 1.9.3。
筆者第一次看到 Eureka 2.0 的文章是 2016 年,那時(shí)候官方宣稱要開發(fā) Eureka 2.0,使用小批量的消息推送替代 Eureka 1.x 中的純心跳機(jī)制(基于定時(shí)任務(wù))的消息傳遞。
但是兩年過(guò)去了,Eureka 2.0 最終沒(méi)有孵化出來(lái),但是絕不代表 Eureka 的閉源!官方依然在積極地維護(hù) Eureka 1.x!
不妨來(lái)看一下 Eureka 的發(fā)布?xì)v史,來(lái)自 https://github.com/Netflix/eureka/releases:
從上圖中可以看到,Eureka 的版本維護(hù)相當(dāng)勤快!
Eureka 和服務(wù)注冊(cè)的關(guān)系圖
談?wù)?2.x 的流產(chǎn)
就筆者的研究來(lái)看,官方關(guān)閉 2.x 分支至少 2 年了。只是最近可能考慮到會(huì)有團(tuán)隊(duì)會(huì)將 Eureka 2.x 用于線上,甚至基于 2.x 開發(fā),所以友情提示一下。
但是問(wèn)題是:大部分用戶都是因?yàn)?Spring Cloud 才接觸到 Eureka,Spring Cloud 使用的是 Eureka 1.x!退一萬(wàn)步,你會(huì)在自己項(xiàng)目中使用一個(gè)非正式發(fā)布的版本嗎?
在我來(lái)看,這就是個(gè)友情提示,連個(gè)新聞都算不上。宣布停止開發(fā)已經(jīng)停止 2 年的分支,還能算是新聞嗎?
不是個(gè)例
事實(shí)上,這不是 Netflix(開源 Eureka 的公司)第一次跳票了。
2016 年,Netflix 宣布將在 2016 年底或 2017 年初開源 Zuul 2.x,結(jié)果寫完發(fā)現(xiàn)太復(fù)雜了,而且性能提升也沒(méi)有達(dá)到預(yù)期。
于是官方選擇完全重構(gòu)!知道 2018 年 1 月,Zuul 2.x 才被開源,2018 年 4 月才發(fā)布到中央倉(cāng)庫(kù)!
參考鏈接: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
其他項(xiàng)目的類似情況
不妨多聊聊。相信大家都很熟悉 Netty,或者至少聽說(shuō)過(guò)。
Netty 也有類似的情況。Netty 團(tuán)隊(duì)開源 Netty 5 后,發(fā)現(xiàn)代碼復(fù)雜度過(guò)高,同時(shí)性能提升也并沒(méi)有預(yù)期中的那么好,于是停止了 Netty 5 的開發(fā)。
那是不是說(shuō) Netty 5 閉源了?
退一萬(wàn)步
退一萬(wàn)步講,Eureka 即使閉源,Spring Cloud 也不至于涼涼。Spring Cloud 支持使用 Eureka、Zookeeper、Consul 實(shí)現(xiàn)服務(wù)發(fā)現(xiàn)的能力。
從 Eureka 切換成 Zookeeper 只需要改個(gè)依賴,加兩行配置就可以了。
總結(jié)
總而言之:
- Eureka 沒(méi)有閉源,是 Eurkea 2.x 分支不再維護(hù)!
- Spring Cloud 并不強(qiáng)依賴 Eureka,Spring Cloud Commons 實(shí)現(xiàn)了通用抽象,允許我們使用自己喜歡的服務(wù)發(fā)現(xiàn)組件!
- 悲觀是好事,說(shuō)明有危機(jī)感,但是過(guò)度解讀,消費(fèi)開發(fā)人員的情懷就過(guò)分了。