Zadání Diplomové Práce
Total Page:16
File Type:pdf, Size:1020Kb
ZADÁNÍ DIPLOMOVÉ PRÁCE I. OSOBNÍ A STUDIJNÍ ÚDAJE Příjmení: Hernández Jméno: Oscar Osobní číslo: 393390 Fakulta/ústav: Fakulta elektrotechnická Zadávající katedra/ústav: Katedra počítačů Studijní program: Otevřená informatika Studijní obor: Softwarové inženýrství II. ÚDAJE K DIPLOMOVÉ PRÁCI Název diplomové práce: Multiplatformní horizontálně škálovatelný systém pro zasílání zpráv Název diplomové práce anglicky: Multi-platform horizontally scalable messaging system Pokyny pro vypracování: Prostudujte si doporučenou literaturu. Navrhněte a implementujte horizontálně škálovatelný systém umožňující zasílání zpráv na různé platformy pro velké množství zařízení. K implementaci použijte technologie kompatibilní s JVM. Nad systémem implementujte vzorovou aplikaci pro demonstraci a otestování funkcionality. Seznam doporučené literatury: [1] Martin L. Abbott, Michael T. Fisher. The Art of Scalability: Scalable Web Architecture, Processes, and Organizations for the Modern Enterprise. Addison-Wesley Professional, May 23, 2015. ISBN 9780134031385 [2] Cheng-Zhong Xu. Scalable and Secure Internet Services and Architecture. CRC Press, Jun 10, 2005. ISBN 9781420035209 [3] Felipe Gutierrez. Spring Boot Messaging: Messaging APIs for Enterprise and Integration Solutions. Apress, May 3, 2017. ISBN 9781484212240 [4] Craig Walls. Modular Java: Creating Flexible Applications With Osgi and Spring (Pragmatic Programmers). CreateSpace Independent Publishing Platform, 2014. ISBN 9781503001459 [5] Bill Stonehem. Google Android Firebase: Learning the Basics. First Rank Publishing, Jun 29, 2016. ISBN 9781535004466 Jméno a pracoviště vedoucí(ho) diplomové práce: Ing. Martin Mudra, Katedra počítačové grafiky a interakce Jméno a pracoviště druhé(ho) vedoucí(ho) nebo konzultanta(ky) diplomové práce: Datum zadání diplomové práce: 17.01.2018 Termín odevzdání diplomové práce: 25.05.2018 Platnost zadání diplomové práce: 30.09.2019 ___________________________ ___________________________ ___________________________ Ing. Martin Mudra podpis vedoucí(ho) ústavu/katedry prof. Ing. Pavel Ripka, CSc. podpis vedoucí(ho) práce podpis děkana(ky) III. PŘEVZETÍ ZADÁNÍ Diplomant bere na vědomí, že je povinen vypracovat diplomovou práci samostatně, bez cizí pomoci, s výjimkou poskytnutých konzultací. Seznam použité literatury, jiných pramenů a jmen konzultantů je třeba uvést v diplomové práci. Datum převzetí zadání Podpis studenta CVUT-CZ-ZDP-2015.1 © ČVUT v Praze, Design: ČVUT v Praze, VIC 2 Czech Technical University in Prague Faculty of Electrical Engineering Department of Computer Science and Engineering Master’s Thesis Multi-platform Scalable Messaging System Bc. Oscar Hernández Supervisor: Ing. Martin Mudra Study Program: Open Informatics Field of Study: Software Engineering May 25, 2018 iv v Aknowledgements I would like to thank my supervisor, Ing. Martin Mudra, for his advice and guidance. Whenever I was struggling he always showed me the right direction, helping me find the answer without giving it away. I would also like to express my gratitude to my family and friends, who couldn’t have been more supportive over the course of my studies. Last, but definitely not least, I would like to thank my dear Zuzana, who helped me by proof-reading my work, supported me greatly, and took care of me as I worked day and night. vi vii Declaration I hereby declare that I have completed this thesis independently and that I have listed all the literature and publications used. I have no objection to usage of this work in compliance with the act §60 Zákon č. 121/2000Sb. (copyright law), and with the rights connected with the copyright act including the changes in the act. In Prague on May 25, 2018 ............................................................. viii Abstract This diploma thesis describes a horizontally scalable server-side application that allows send- ing messages across different platforms, with emphasis on modularity and easy expandability. The majority of the thesis and application is focused on the scalability aspect of distributing the system among a large number of computational nodes. The application’s purpose is to serve as a framework and foundation to be built upon and expanded for usage in modern applications. Abstrakt Tato diplomová práce popisuje horizontálně škálovatelnou serverou aplikaci, která umožňuje zasílání zpráv napříč ruzných platforem s důrazem na modularitu a rozšiřitelnost. Drtivá většina práce a aplikace se zaměřuje na škálování za pomoci rozdělení systému na velké množství výpočetních zařízení. Cílem aplikace je sloužit jako základ pro využití v moderních aplikacích. ix x Contents 1 Introduction1 1.1 Motivation......................................1 1.2 Goals........................................1 1.3 Usage Scenarios...................................2 2 Analysis 3 2.1 Problem Analysis..................................3 2.2 Existing Similar Solutions.............................5 2.2.1 PubNub...................................6 2.2.2 Ably.....................................6 2.2.3 Pusher....................................7 2.2.4 OneSignal..................................8 2.2.5 Similar solution comparison conclusion.................. 10 2.3 Requirement Analysis (Core System)....................... 10 2.3.1 Functional Requirements.......................... 10 2.3.2 Non-functional Requirements....................... 10 2.4 Requirement Analysis (Sample Implementation)................. 11 2.4.1 Functional Requirements.......................... 11 2.4.2 Non-functional Requirements....................... 11 2.5 Platform Analysis.................................. 12 2.5.1 Mobile platform.............................. 12 2.5.1.1 Android.............................. 12 2.5.1.2 iOS................................ 12 2.5.2 Desktop and Server platforms....................... 14 2.5.2.1 Java................................ 14 2.5.3 Web..................................... 14 2.6 Analysis of Solutions for Implementation..................... 14 2.6.1 Spring Boot................................. 14 2.6.2 Testing Framework............................. 16 2.6.2.1 JUnit............................... 16 2.6.2.2 Spock Framework........................ 17 2.6.3 Database technology............................ 17 2.7 Analysis of Solutions for Sample Implementation................ 18 2.7.1 Firebase Cloud Messaging......................... 18 2.7.1.1 FcmJava............................. 19 xi xii CONTENTS 2.7.1.2 Pushraven............................ 19 2.7.2 Message Queue............................... 19 2.7.2.1 RabbitMQ............................ 19 2.7.2.2 Apache ActiveMQ........................ 20 2.8 Scalability Analysis................................. 20 2.8.1 Problematic Scenarios........................... 21 2.8.1.1 Servicing a large amount of clients............... 21 2.8.1.2 A large amount of clients connects at the same time..... 21 2.8.1.3 A large amount of messages for a single client......... 21 2.8.1.4 A node dies............................ 21 2.8.1.5 A message is sent to a user group with a large amount of users 22 3 Design 23 3.1 Scalability Design.................................. 23 3.1.1 Scalability Architecture Components................... 24 3.1.1.1 Nodes............................... 24 3.1.1.2 Node Coordinator........................ 24 3.1.1.3 Message Queue.......................... 24 3.1.1.4 Database............................. 26 3.1.2 Problematic Scenarios and their Handling................ 26 3.1.2.1 Serving a large amount of clients................ 26 3.1.2.2 A large amount of clients connects at the same time..... 26 3.1.2.3 A large amount of messages for a single client......... 27 3.1.2.4 A node dies............................ 27 3.1.2.5 A message is sent to a user group with a large amount of users 27 3.2 Architecture Design................................ 28 3.2.1 Data Tier.................................. 31 3.2.1.1 Sample Implementation Data Tier............... 31 3.2.2 Business Tier................................ 31 3.2.3 Collaboration Tier............................. 32 3.2.4 Client Tier................................. 32 3.2.4.1 Sample Implementation Client Tier.............. 33 3.3 Modularity Design................................. 34 3.3.1 Core Module................................ 35 3.3.2 Database Modularity............................ 36 3.3.3 Platform Modularity............................ 37 3.3.3.1 Adapters............................. 38 3.3.4 Message Queue Modularity........................ 40 4 Implementation 41 4.1 Development platform............................... 41 4.2 Code Structure................................... 42 4.2.1 Msgr..................................... 43 4.2.1.1 Core Module........................... 43 4.2.1.2 Message-Common........................ 44 4.2.1.3 Fcm................................ 44 CONTENTS xiii 4.2.1.4 Mysql............................... 44 4.2.1.5 Websocket............................ 44 4.2.1.6 Websocket-Common....................... 45 4.2.1.7 ActiveMq............................. 45 4.2.1.8 Node-Stats............................ 45 4.2.2 Coordinator................................. 45 4.2.3 Java-Client................................. 46 4.2.4 Web..................................... 46 4.2.5 MsgrChattr................................. 46 5 Testing 49 5.1 Automated Testing................................. 49 5.2 Manual Testing................................... 49 5.2.1 Testing Environment............................ 50 5.2.1.1 Testing Environment