看板 PttCurrent 關於我們 聯絡資訊
就我想到的關於分散一些問題, 提出我的想法, 大家幫我看一下有沒有問題~ :)) 1.有一個前端的程式負責接 connection, 決定要分到哪個 server , 如果是在 local的話, 就直接 exec 她, 否則看看要用 multi-thread 來弄會不會比 select 好些? 2.每個 mbbsd都用兩個 message queue (一個負責收, 一個發) 和一些 local server 連. 架構: mbbsd lock daemon <-> netd <-intranet-> netd <-\ mbbsd mbbsd <-> local daemon <-/ local daemon <-> mbbsd mbbsd mbbsd syncd <-intranet-> syncd 即任兩台間只會有 netd (主要負責回應 mbbsd的資料) 以及 syncd (負責 sync shared-memory)的連線. 舉例: 使用者 login (->local daemon -> netd -> netd 要看主 server 是不是在近端) -> lock daemon 進行實際的 utmp login -> lock daemon 向 netd 送出廣播 utmp login . 修正 money: mbbsd -> (local daemon -> netd -> netd) -> lock daemon進行實體修正錢的動作 -> return成功/失敗 -> (netd -> netd -> local daemon ->) mbbsd 其中 netd 最主要只是在 socket 間和 message queue間轉換. 因為 select() 好像沒有辦法吃 message queue , 也就是, 如果 mbbsd要透過 message queue丟過來的話, 中間勢必要有個把 message <->socket的程式 syncd 主要是 sync 一些 shared-memory的東西, 像是每五秒鐘會把目前自己這台上使用者的動態 broadcast給其他 server . -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.30.143