鑑於以下事實,有沒有實現的算法使事件的重現性排序在集羣環境中的現有的開放源代碼的Java API(可能是由於一些更大的產品的一部分):正式是否有API允許在集羣應用程序中訂購事件?
1) There are N sources of events, each with a unique ID.
2) Each event produced has an ID/timestamp, which, together with
its source ID, makes it uniquely identifiable.
3) The ids can be used to sort the events.
4) There are M application servers receiving those events.
M is normally 3.
5) The events can arrive at any one or more of the application
servers, in no specific order.
6) The events are processed in batches.
7) The servers have to agree for each batch on the list of events
to process.
8) The event each have earliest and latest batch ID in which they
must be processed.
9) They must not be processed earlier, and are "failed" if they
cannot be processed before the deadline.
10) The batches are based on the real clock time. For example,
one batch per second.
11) The events of a batch are processed when 2 of the 3 servers
agree on the list of events to process for that batch (quorum).
12) The "third" server then has to wait until it possesses all the
required events before it can process that batch too.
13) Once an event was processed or failed, the source has to be
informed.
14) [EDIT] Events from one source must be processed (or failed) in
the order of their ID/timestamp, but there is no causality
between different sources.
少
,我有那些接收事件的服務器。他們從相同的初始狀態開始,並且應該通過同意按哪個順序處理哪個事件來保持同步。幸運的是,這些事件不是儘快處理的,而是「一點點」,以便我有一段時間讓服務器在截止日期前達成一致。但我不確定這是否會對算法產生真正的影響。如果所有服務器都同意所有批次,那麼它們將始終保持同步,因此在查詢時會呈現一致的視圖。
儘管我對Java API感到非常滿意,但如果可以從Java調用它,我還會接受其他的東西。如果沒有開源的API,但是算法清晰,我也會將其作爲答案並嘗試自己實現。
您是否熟悉分佈式算法? (第一課是你不會讓多臺計算機的時鐘同步) –
我不是100%確定我真的明白你在問什麼,但是IMO像演員模型那樣可能會讓你走上正軌。有很多實現。你可能也想看看功能如何(如Clojure)。 –
@LouisWasserman我剛纔問了ServerFault:http://serverfault.com/questions/394967/what-is-a-realistic-average-time-difference-between-servers-in-the-same-lan預期的區別是10-20ms,遠低於1秒。批次不必完全在同一時間處理,只需要按照相同的內容和順序進行處理。 –