§ 瀏覽學位論文書目資料
  
系統識別號 U0002-1008202014295800
DOI 10.6846/TKU.2020.00253
論文名稱(中文) 應用於物聯網環境之階層式發布/訂閱架構實作
論文名稱(英文) Implementation of Hierarchical Publish/Subscribe Architecture for IoT Environment
第三語言論文名稱
校院名稱 淡江大學
系所名稱(中文) 資訊工程學系碩士班
系所名稱(英文) Department of Computer Science and Information Engineering
外國學位學校名稱
外國學位學院名稱
外國學位研究所名稱
學年度 108
學期 2
出版年 109
研究生(中文) 羅紹賢
研究生(英文) Shao-Hsien Lo
學號 607410544
學位類別 碩士
語言別 繁體中文
第二語言別
口試日期 2020-07-14
論文頁數 76頁
口試委員 指導教授 - 林其誼(chiyilin@gmail.com)
共同指導教授 - 許輝煌(hsu@gms.tku.edu.tw)
委員 - 蔡智強(jichiangt@nchu.edu.tw)
委員 - 林振緯(jwlin@csie.fju.edu.tw)
關鍵字(中) Pub/Sub
開源軟體
ActiveMQ
JMS
Hierarchical Broker
關鍵字(英) Pub/Sub
Open source software
ActiveMQ
JMS
Hierarchical Broker
第三語言關鍵字
學科別分類
中文摘要
P2P(Peer-to-Peer),又稱點對點傳輸,是一種網路架構。在P2P的運作模式中,相對於傳統的主從式架構(Client-Server),每個端點(Client)的溝通都會透過伺服器來傳遞。因此,在上述的環境中,每一個客戶端都是分散的。每一個端點都可以作為客戶端或伺服器端,甚至是同時兼任兩者而存在著。
        近年來,由於物聯網的興起,另一種名為發布/訂閱(Publish/Subscribe)的通訊架構也逐漸流行。它的特色是由一個中間者(Broker)擔任伺服器,接收來自於發布者(Publisher)所發布的主題訊息,再轉發給訂閱該主題的訂閱者(Subscriber)。這麼做最大的好處在於可減少訊息發布者與訂閱者之間在時間與空間中的耦合,兩者甚至都不需要知道對方的存在。但是,萬一中間者發生故障,訊息遞送服務就無法運作。 
	為了解決 Pub/Sub 架構中的單點故障(SPOF)的問題,在本篇論文中,我們基於開源軟體 ActiveMQ 實現了階層式中間者的架構。具體來說,我們在具有 Raspberry Pi 開發版的 IoT 環境中部署兩層的中間者群集。數據在上層中間者(又稱中間者中心)之間進行同步,並在雙活躍配置下運行,為發布者提供服務。下層中間者(又稱中間者)由中間者中心管理,並負責為訂閱者提供服務。我們進行了幾次實驗,以測試階層式中間者架構的容錯能力,以及評估與單個中間者相比之下階層式中間者架構的系統性能。
英文摘要
P2P, or Peer-to-Peer, is a decentralized network architecture. Compared with the traditional Client-Server architecture, in P2P model each peer can communicate with each other directly without the need of a centralized server. Specifically, each peer can play the role of a client or a server, or even play the two roles simultaneously.
	In recent years, a new network architecture called Publish/Subscribe (Pub/Sub) is getting popular due to the prevalence of IoT. The unique feature of the Pub/Sub architecture is that a broker plays the role of a server, which receives messages with a specific topic published by the publishers, and then forwards the messages to the subscribers who previously subscribed the topic. This can decouple the publishers and the subscribers both in time and space. They don't even need to be aware of the existence of each other. However, once the broker fails, the message delivery service also fails.
	To solve the single point of failure (SPOF) problem of the Pub/Sub model, in this thesis we implement the hierarchical broker architecture based on ActiveMQ, an open source software. Specifically, we deploy a two-layer broker cluster in an IoT environment with Raspberry Pi 3 development boards. The data is synchronized between the upper-layer brokers (called Broker Hubs), and they run in a dual-active configuration to serve the publishers. The lower-layer brokers (just called Brokers) are managed by the broker hubs, and are responsible for serving the subscribers. We conducted several experiments to test the fault tolerance capability of the hierarchical broker architecture, as well as evaluating the system performance of the hierarchical broker architecture compared with a single broker.
第三語言摘要
論文目次
目錄
第一章 緒論	1
1.1 研究背景與動機	1
1.2 研究目的	2
1.3 論文架構	5
第二章 技術背景與相關研究	6
2.1 Java Message Service(JMS)	6
2.2 Apache ActiveMQ	7
2.3 Hierarchical Broker	8
2.4 Openwire protocol	9
2.5 相關研究	11
第三章 系統架構與實作	14
3.1 實驗系統架構圖	14
3.2 網路架構圖	16
3.3 系統運作原理	17
第四章 系統功能展示與驗證	19
4.1 端點需求	19
4.2 Broker、Publisher 與 Subscriber	20
4.3 在 Raspberry Pi 3 環境建置階層式中間者架構	22
4.3.1 在 Raspberry Pi 3 環境中建立必要的軟體環境	23
4.3.2 Broker Hub 設定:Networking connection	24
4.3.3 Broker 設定	29
4.3.4 Publisher、Subscriber 設定	31
4.3.5 Supervisor 設定:PHP 套件	33
4.4 資料庫	37
4.5 實驗	38
4.5.1 實驗一	39
4.5.2 實驗二	41
4.5.3 實驗三	44
4.5.4 實驗四	46
4.5.5 實驗五	47
第五章 結論與未來展望	63
5.1 結論	63
5.2 未來展望	63
參考文獻	65
附錄-英文論文	69

圖目錄
圖 2-1 JMS Pub/Sub Messaging Model	7
圖 2-2 ActiveMQ - Network of Brokers[3]	11
圖 3-1 實驗系統架構圖	15
圖 3-2 ActiveMQ 架構示意圖[5]	16
圖 3-3 Broker Hub 1 Network Bridges 配置	17
圖 3-4 Broker Hub 2 Network Bridges 配置	17
圖 3-5 Broker 1、2、3 Network Bridges 配置	18
圖 4-1 Raspberry Pi 3 規格[6]	20
圖 4-2 三個角色在架構中的階層式關係	22
圖 4-3 Java 安裝完成圖	23
圖 4-4 Broker Hub 使用 Networking connection	24
圖 4-5 Broker Hub 1 Networking connection 設定[4]	25
圖 4-6 Broker Hub 1 Persistence adapter 設定	26
圖 4-7 Broker Hub 1 Transport connection 設定	26
圖 4-8 Broker Hub 2 Networking connection	26
圖 4-9 Broker Hub 2 Transport connection	27
圖 4-10 Broker Hub 1 使用者帳號、密碼	27
圖 4-11 Broker Hub 1 埠號設定	27
圖 4-12 Broker Hub 2 埠號設定	28
圖 4-13 Broker Hub 1 使用者帳號、密碼	28
圖 4-14 Broker 1 Transport connection 設定	29
圖 4-15 Broker 2 Transport connection 設定	30
圖 4-16 Broker 3 Transport connection 設定	30
圖 4-17 Broker 1 埠號設定	30
圖 4-18 Broker 2 埠號設定	31
圖 4-19 Broker 3 埠號設定	31
圖 4-20  訂閱者設定	32
圖 4-21 發布者設定	33
圖 4-22 SSH 連線與安裝 PHP	34
圖 4-23 PHP 安裝完成圖	34
圖 4-24 PHP 網頁部分代碼	35
圖 4-25 執行 PHP Server	36
圖 4-26 運行網頁	36
圖 4-27 運行網頁(運行部分中間者)	37
圖 4-28 kahadb 存儲狀況	38
圖 4-29 使 Broker Hub 2 停止運作	39
圖 4-30 Supervisor 觀察到 Broker Hub 2 已離線	40
圖 4-31 發布者發送訊息給 Broker Hub 1	40
圖 4-32 訂閱者接收到訊息	40
圖 4-33 使 Broker 3 停止運作	42
圖 4-34 訂閱者與 Broker 2 重連	42
圖 4-35 Supervisor 觀察到 Broker Hub 2、Broker 3 已離線	42
圖 4-36 使 Broker 2 停止運作	43
圖 4-37 訂閱者與 Broker 1 重連	43
圖 4-38 Supervisor 觀察到 Broker Hub 2、Broker 2、3 已離線	43
圖 4-39 使 Broker Hub 1 停止運作	45
圖 4-40 Supervisor 觀察到 Broker Hub 1、2、Broker 2、3 已離線	45
圖 4-41 發布者發送訊息給 Broker Hub 失敗	45
圖 4-42 下層中間者出現過載情況,訂閱者重連	47
圖 4-43 以多執行緒模擬發布者與訂閱者的設備數量	48
圖 4-44 創建指定數量的執行緒(端點設備數量)	48
圖 4-45 上層中間者 CPU 使用率折線圖	49
圖 4-46 上層中間者記憶體使用情況折線圖	49
圖 4-47 Broker 1 CPU 使用率折線圖	52
圖 4-48 Broker 1 記憶體使用情況折線圖	52
圖 4-49 Broker 2 CPU 使用率折線圖	53
圖 4-50 Broker 2 記憶體使用情況折線圖	53
圖 4-51 Broker 3 CPU 使用率折線圖	54
圖 4-52 Broker 3 記憶體使用情況折線圖	54
圖 4-53 單一中間者 CPU 使用率折線圖	57
圖 4-54 單一中間者記憶體使用情況折線圖	58
圖 4-55 相同負載下階層式與單一中間者的成功率	60

表目錄
表 4-1 上層中間者 CPU 使用率與記憶體使用情況一欄表	50
表 4-2 上層中間者在三次測試中各自接收的訊息數量	51
表 4-3 下層中間者 CPU 使用率與記憶體使用情況一欄表	56
表 4-4 下層中間者在三次測試中各自接收的訊息數量	56
表 4-5 單一中間者 CPU 使用率與記憶體使用情況一欄表	59
表 4-6 相同負載下階層式與單一中間者的成功率	59
參考文獻
[1]  DAI Jun,ZHU Xiao-Min.Design and Implementation of an Asynchronous Message Bus Based on ActiveMQ.COMPUTER SYSTEMS APPLICATIONS,2010,19(8):254-257
[2]  H. Chien, G. Qiu, R. Hung, A. Shih and C. Su, "Hierarchical MQTT with Edge Computation," 2019 IEEE 10th International Conference on Awareness Science and Technology (iCAST), Morioka, Japan, 2019, pp. 1-5
[3]  http://puremonkey2010.blogspot.com/2015/09/inaction-note-ch4-connecting-activemq.html, last accessed Jun. 30, 2020
[4]  https://www.jakubkorab.net/2011/11/understanding-activemq-broker-networks.html, last accessed Jun. 30, 2020
[5]  https://www.itread01.com/articles/1488744004.htm, last accessed Jun. 30, 2020
[6]  https://blog.xuite.net/byrony/twblog/498606848-極簡化CAT+--+樹莓派+Raspberry+Pi+數位流播放器, last accessed Jun. 30, 2020
[7]   WebSub, https://www.w3.org/TR/websub/, last accessed Jun. 30, 2020
[8]   Introduction to Apache ActiveMQ, https://freecontent.manning.com/wp-content/uploads/introduction-to-apache-activemq.pdf, last accessed Jun. 30, 2020
[9]   Henjes R., Schlosser D., Menth M., Himmler V. (2007) Throughput Performance of the ActiveMQ JMS Server. In: Braun T., Carle G., Stiller B. (eds) Kommunikation in Verteilten Systemen (KiVS). Informatik aktuell. Springer, Berlin, Heidelberg
[10]   A. F. Klein, M. Ştefãnescu, A. Saied and K. Swakhoven, "An experimental comparison of ActiveMQ and OpenMQ brokers in asynchronous cloud environment," 2015 Fifth International Conference on Digital Information Processing and Communications (ICDIPC), Sierre, 2015, pp. 24-30
[11]   B. Yahaya, R. Latip, A. Abdullah and M. Othman, "Medical Data Simulation with Self-Adaptive Multi-instance Broker in Hierarchical Cluster Grid Structure," 2014 International Conference on Computer Assisted System in Health, Kuala Lumpur, 2014, pp. 52-57
[12]   P. Rathod, D. Sharma and A. Golhani, "A topic-based publish-subscribe message broker for SCADA system using hierarchical subscription handling," 2017 International Conference on Advances in Computing, Communication and Control (ICAC3), Mumbai, 2017, pp. 1-10
[13]   Lei Jin and Xiaohui Lin, "A study of hierarchical cloud resource pricing," 2015 12th Annual IEEE Consumer Communications and Networking Conference (CCNC), Las Vegas, NV, 2015, pp. 808-813
[14]   Client, Broker / Server and Connection Establishment - MQTT Essentials: Part 3, https://www.hivemq.com/blog/mqtt-essentials-part-3-client-broker-connection-establishment/, last accessed Jun. 30, 2020  
[15]   K. Matsui, M. Kaneda and H. Ishii, "Hierarchical Policy-Based Multi-User Bandwidth Broker System Suitable for Large-Scale Bandwidth On-Demand Services," 2012 9th Asia-Pacific Symposium on Information and Telecommunication Technologies (APSITT), Santiago and Valparaiso, 2012, pp. 1-6.
[16]   Ibrahim, Mohamad & Rehfeldt, Karina & Rausch, Andreas, "Conception of a Type-based Pub/Sub Mechanism with Hierarchical Channels for a Dynamic Adaptive Component Model," ADAPTIVE 2018 : The Tenth International Conference on Adaptive and Self-Adaptive Systems and Applications
[17]   Chang, Shun-Fa & Fu, Li-Chen & Tsai, Ming-Yu. Automatic Integration of Inter-Enterprise Processes with Hierarchical Broker Framework Base on Bulletin of the College of Engineering, N.T.U., No. 90, February 2004, pp. 99–107
[18]   N. Ranaldo and E. Zimeo, "An economy-driven mapping heuristic for hierarchical master-slave applications in grid systems," Proceedings 20th IEEE International Parallel & Distributed Processing Symposium, Rhodes Island, 2006, pp. 13
[19]   IOT5. MQTT on the ESP32, https://www.wolfaiottw.com/7-mqtt-on-the-esp32/
[20]   Apache ActiveMQ, http://activemq.apache.org
[21]   aws-mq-example, https://github.com/blackie1019/aws-mq-example
論文全文使用權限
校內
校內紙本論文立即公開
同意電子論文全文授權校園內公開
校內電子論文立即公開
校外
同意授權
校外電子論文立即公開

如有問題,歡迎洽詢!
圖書館數位資訊組 (02)2621-5656 轉 2487 或 來信