第四章 系統架構與實作
4.1 插件系統
4.1.2 Service category
服務分類(Service category)在實作方面使用了 Group 作為實現的方法,
服務提供者在註冊 UID 後,查詢是否有以存在之 Group,若有存在之 Group 則加入此 Group 完成服務分類,若無符合之 Group 則自行創建一 Group,
Group 之示意圖如圖 24 所示。
圖 24 服務分類示意圖
33
4.1.3 Query Transfer
訊息轉送(Query Transfer)則是將訊息攔截器處理完之訊息配合相對應的
Group名單進行訊息的重新封裝並發送訊息。相關示意圖如圖 25所示。
當服務攔截器處理完服務請求訊息後,會將符合的服務分類清單、服務 要求者之JID、服務要求條件送至此處進行服務的封裝,並進行轉送。
圖 25 訊息轉送示意圖 4.2 用戶端開發
在本節中,將介紹 Client 與 Service Provider 所使用的實作方法與如何 跟 Openfire Server 進行溝通。
34
4.2.1 JID 註冊
實作方面,Client與Service Provider在架構中皆需要與Openfire Server進 行溝通,而要與Openfire Server則Client與Service Provider各自都要擁有一個 屬於自己的JID,因此要進行服務要求或註冊時,第一個步驟為註冊UID,
相關之服務註冊程式碼如圖 26所示。圖中之ConnectionConfiguration()為在 與Openfire Server進行連線時需要確定Server之位址與開放的Port,之後則使 用connection()進行連線。
當 連 線 建 立 後 , 即 可 進 行 JID 的 註 冊 , 在 Smack Library 中 可 使 用 AccountManager進行createAccount()的動作。
圖 26 JID 註冊
35
4.2.2 訊息發送/接收
當用戶登入帳號後,即可進行訊息的發送與接收,而在接收與發送訊 息上,在此使用了 MessageListener 來進行訊息的監聽,透過 MessageListener,
接收到的訊息皆可在 processMessage 中依照訊息的種類來進行處理,如圖 27、圖 28 所示。
圖 27 訊息接收
圖 28 訊息發送
36
Send Request Message
Search Groups
Match for Suitability
Client :Message
Interceptor
:Query transfer
:Service Provider
Transfer Request Message Message Transfer
Negotiate
Deliver Service
37
圖 30 JID 示意圖
當服務需求者擁有個人 JID 後,即可發送服務需求訊息至 Server 端,而 Server 端之訊息攔截器插件會將此一訊息攔下,並將訊息中的服務需求條件 取出,並搜尋符合此一條件之 Group,若無此服務則回傳無服務訊息,若有 符合條件之 Group 則將服務需求者之 JID 與需求條件轉送至 Group 中所有 JID,示意圖如圖 31 所示。
圖 31 服務需求訊息轉送之循序圖
38
當服務提供者接收到 server 端所傳送之訊息後,會使用包含在訊息中的 服務需求條件進行服務配對,在此使用關鍵字的方式來進行配對,若配對成 功則開始處理服務,並回傳結果至服務需求者端,完成服務要求。
39 Openfire Server 作為架構中 Extended Registry,另外 Computer2 為 Client、
Computer3 則為 Service Provider,詳細之規格如表 2 所示。
表 2 實驗硬體規格表
5.3 實驗方法
在此分為了兩組進行實驗的比對一組為 Extended SOA 組而另一組為 SOA based on XMPP 組。在 Extended SOA 與 SOA based on XMPP 中 Registry 端使用了 Openfire Server 做為實作,而在 Client 與 Service Provider 使用了 Smack 來進行登入伺服器與傳輸訊息之動作。以 10 個 Client 做為一組進行 一次測試,每個 Client 間隔 500ms 發送一次服務需求訊息至 Openfire Server,
Computer1 Computer2 Computer3
CPU AMD PhenomII X6 1045T Processor 2.70GHz Intel Core i7 CPU 870 2.93GHz 2.93GHz Intel Core i7 CPU 870 2.93GHz 2.93GHz
Memory 8GB DDR2 6GB DDR2 4GB DDR2
OS Windows Win7 64Bit Windows Win7 64Bit Windows Win7 32bit
40
再由 Openfire Server 經過處理後轉送至 Service Provider 端,最後將結果回 傳至 Client 完成一次服務要求,一次實驗持續一分鐘,接著再增加一組 Client 進行實驗直到 10 組為止,兩組實驗不同的地方為 SOA based on XMPP 是依 照 SOA 架構由 UDDI 進行服務的配對,而 Extended SOA 為將服務配對分 散至 Service Provider 端。進行測試的項目有:平均回應時間、CPU 使用率、
IO Read/Write。
5.4 實驗結果
從架構面來看,相較於原始 SOA 架構中負載集中於 UDDI,本文提出 之擴充式架構將服務配對之功能從 UDDI 中移出至服務提供者端,由服務 提供者進行服務配對,再由服務提供者與服務要求者遞送服務,是可將 UDDI 的負載分散的。從實驗結果來看,隨著 Client 數量的增加,SOA based on XMPP 組的 UDDI 需要處理服務的搜尋配對,因此導致負載的集中,因 SOA 組,將負載分散至 Service Provider 端可使 Server 端之負載降低。
41
Extended SOA SOA based on XMPP
0.00%
Extended SOA SOA based on XMPP
42
圖 34 IO write 結果圖
圖 35 IO Read 結果圖
從以上結果來看,當 Client 數量上升至某一程度後,SOA based on XMPP 組由於負載的集中而造成系統的延遲,因而降低了性能,而 Extended SOA 組,將服務配對從 UDDI 中分散至服務提供者端,由服務提供者進行服務
IO Write Bytes/sec
Extended SOA SOA based on XMPP
0
IO Read Bytes/sec
Extended SOA SOA based on XMPP
43
第六章 結論與未來工作
本文提出了改善原始 SOA 中 UDDI 的過於集中的負載,並提出使用 XMPP 作為通訊協定的方法,用以增加在溝通上能夠表達更多訊息,其中 主要的貢獻在提出擴充式的 SOA 架構,將 UDDI 的負載分散至服務提供者,
UDDI 並不進行服務的配對且對於接收到的服務要求封包只進行轉送的動 作,讓服務提供者自行進行服務配對和與服務要求者進行溝通,且使用 XMPP 來增加進行溝通時的封包的擴展度。
未來則希望能透過此一架構,使網路服務結合即時通訊,使服務的靈 活度與精確度能夠向上提升,獲得更好的服務品質,並且透過 XMPP 的特 性來擴展網路服務的應用範圍。
44
參考文獻
[1] T. Erl, "Service-oriented architecture (SOA): concepts, technology, and design," Prentice Hall Englewood Cliffs, 2005.
[2] E. Newcomer, and G. Lomow, Understanding SOA with web services (independent technology guides): Addison-Wesley Professional, 2004.
[3] S. Banerjee, S. Basu, S. Garg et al., “Scalable grid service discovery based on uddi,” in Proceedings of the 3rd international workshop on Middleware for grid computing, 2005, pp. 1-6.
[4] M. Randles, D. Lamb, and A. Taleb-Bendiab, “Experiments with Honeybee Foraging Inspired Load Balancing,” in Developments in eSystems Engineering (DESE), 2009 Second International Conference on, 2009, pp. 240-247.
[5] M. Bjorkqvist, L. Y. Chen, and W. Binder, “Load-balancing dynamic service binding in composition execution engines,” in Services Computing Conference (APSCC), 2010 IEEE Asia-Pacific, 2010, pp. 67-74.
[6] A. Hornsby, and R. Walsh, “From instant messaging to cloud computing, an XMPP review,” in Consumer Electronics (ISCE), 2010 IEEE 14th International Symposium on, 2010, pp. 1-6.
[7] J. Cao, H. Zhao, and M. Li, “A fuzzy rule based load balancing model for a distributed service process engine,” in Grid and Pervasive Computing Workshops, 2008. GPC Workshops' 08. The 3rd International Conference on, 2008, pp. 9-14.
[8] P. Saint-Andre. "Extensible messaging and presence protocol (XMPP): Core,"
http://tools.ietf.org/html/rfc6120.
45
[9] F. Curbera, M. Duftler, R. Khalaf et al., “Unraveling the Web services web: an introduction to SOAP, WSDL, and UDDI,” IEEE Internet computing, vol. 6, no.
2, pp. 86-93, 2002.
[10] P. Saint-Andre, “Extensible Messaging and Presence Protocol (XMPP):
Address Format,” 2011.
[11] P. Saint-Andre, “Extensible messaging and presence protocol (xmpp): Instant messaging and presence,” 2011.
[12] P. Saint-Andre, “Streaming xml with jabber/xmpp,” Internet Computing, IEEE, vol. 9, no. 5, pp. 82-89, 2005.
[13] T. Muldowney, M. Miller, R. Eatmon et al. "Xep-0096: Si file transfer,"
http://xmpp.org/extensions/xep-0096.html.
[14] J. Hildebrand, P. Millard, R. Eatmon et al., “XEP-0030: service discovery,”
XMPP Standards Foundation, Tech. Rep, 2008.
[15] S. Sahasrabudhe, and C. Paolini, “A load balancing scheme for ebXML registries,” in Parallel Processing Workshops (ICPPW), 2010 39th International Conference on, 2010, pp. 9-16.
[16] F. Mohammed, and L. Pravin, “Oracle SOA Suite,” Sys-Con XML Journal, 2007.
[17] M. Fleury, and F. Reverbel, “The JBoss extensible server,” in Proceedings of the ACM/IFIP/USENIX 2003 International Conference on Middleware, 2003, pp. 344-373.
[18] J. Cao, Y. Sun, X. Wang et al., “Scalable load balancing on distributed web servers using mobile agents,” Journal of Parallel and Distributed Computing, vol. 63, no. 10, pp. 996-1005, 2003.
[19] W. Binder, D. Bonetta, C. Pautasso et al., “Towards Self-Organizing
46
Service-Oriented Architectures,” in Services (SERVICES), 2011 IEEE World Congress on, 2011, pp. 115-121.
[20] A. M. Nakai, E. Madeira, and L. E. Buzato, “Load balancing for internet distributed services using limited redirection rates,” in Dependable Computing (LADC), 2011 5th Latin-American Symposium on, 2011, pp. 156-165.
[21] R. Mondéjar, P. García, and C. Pairot, “Towards a decentralized p2pWeb service oriented architecture,” 2006.