關於Eureka 2.x,別再人云亦云了!

原文:http://www.itmuch.com/spring-cloud/eureka-2-news/ ,轉載請說明出處。git

最近朋友圈被Eureka 2.x中止開發的新聞刷屏,例如:github

關於第二篇,我想說,這是在造謠。spring

不妨來看一下官方的言論:ide

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/wikiui

看清楚官方的言辭:官方只是說Eureka 2.0的開發被中止了,若是您將Eureka 2.0分支用在生產,將後果自負!this

看起來挺嚇人的。但真的那麼可怕嗎?.net

關於Eureka版本

Eureka 2.x歷來就沒有正式發佈過! 目前最新的穩定版本是1.9.3。筆者第一次看到Eureka 2.0的文章是2016年,那時候官方宣稱要開發Eureka 2.0,使用小批量的消息推送替代Eureka 1.x中的純心跳機制(基於定時任務)的消息傳遞。debug

可是兩年過去了,Eureka 2.0最終沒有孵化出來,可是毫不表明Eureka的閉源!官方依然在積極地維護Eureka 1.x!code

不妨來看一下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.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後,發現代碼複雜度太高,同時性能提高也並無預期中的那麼好,因而中止了Netty 5的開發。

那是否是說Netty 5閉源了?

退一萬步

退一萬步講,Eureka即便閉源,Spring Cloud也不至於涼涼。Spring Cloud支持使用Eureka、Zookeeper、Consul實現服務發現的能力。

從Eureka切換成Zookeeper只須要改個依賴,加兩行配置就能夠了。

總結

總而言之:

  • Eureka沒有閉源,是Eurkea 2.x分支再也不維護!
  • Spring Cloud並不強依賴Eureka,Spring Cloud Commons實現了通用抽象,容許咱們使用本身喜歡的服務發現組件!
  • 悲觀是好事,說明有危機感,可是過分解讀,消費開發人員的情懷就過度了。