8
Implementation of a Load Balancing Algorithm in a Ticktet Booking System Group 6: Yunlong Song(yunlongs), Tian Guan(tguan5), Zizhao Han(zizhah1) June 12, 2020 1 Key objective Distributed systems have been widely demanded and used in today’s indus- try. There are several benefits using a distributed system. First a website based on a distributed set of servers can be more stable and resilient because if one server physically fails, the website can still be able to stay up. Data loss due to the breakdown of a server is unlikely if the data is not stored on one de- vice. Also, distributed systems can be highly reliable and faster because queries can be routed to multiple servers instead of a single server which may make it overloaded. The cost of maintenance on the high volume of servers and the risk of failing servers becomes dangerously high. Implementing a load balancing mechanism based on Zookeeper could be a possible solution. We aim to develop a Distributed Ticket Booking System based on ZooKeeper, and implement a load balancing algorithm by extending Dubbo’s load balance interface. After implementing the system, we evaluate its performance by setting up an experiment and analyze the result. The result shows that our algorithm is better than the simple random load balancing and achieve similar performance with the state of art load balancing algorithms used by Dubbo. This paper is organized as follow: Section 2 describes the related work of this project, including a research survey about the existing load balancing al- gorithms and basic knowledge of Zookeeper and Dubbo. Section 3 presents the load balancing algorithm we proposed for the project. Section 4 presents our implementation of the system. Section 5 describes our evaluation plan and the result of evaluation. And we conclude our work in Section 6. 2 Related work In this section, we present the related efforts we made, including the survey of load balancing algorithms and the deployment of our system. 1

Implementation of a Load Balancing Algorithm in a Ticktet

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Implementation of a Load Balancing Algorithm in a Ticktet

Implementation of a Load Balancing Algorithm

in a Ticktet Booking System

Group 6: Yunlong Song(yunlongs), Tian Guan(tguan5), Zizhao Han(zizhah1)

June 12, 2020

1 Key objective

Distributed systems have been widely demanded and used in today’s indus-try. There are several benefits using a distributed system. First a website basedon a distributed set of servers can be more stable and resilient because if oneserver physically fails, the website can still be able to stay up. Data loss dueto the breakdown of a server is unlikely if the data is not stored on one de-vice. Also, distributed systems can be highly reliable and faster because queriescan be routed to multiple servers instead of a single server which may makeit overloaded. The cost of maintenance on the high volume of servers and therisk of failing servers becomes dangerously high. Implementing a load balancingmechanism based on Zookeeper could be a possible solution.

We aim to develop a Distributed Ticket Booking System based on ZooKeeper,and implement a load balancing algorithm by extending Dubbo’s load balanceinterface. After implementing the system, we evaluate its performance by settingup an experiment and analyze the result. The result shows that our algorithm isbetter than the simple random load balancing and achieve similar performancewith the state of art load balancing algorithms used by Dubbo.

This paper is organized as follow: Section 2 describes the related work ofthis project, including a research survey about the existing load balancing al-gorithms and basic knowledge of Zookeeper and Dubbo. Section 3 presents theload balancing algorithm we proposed for the project. Section 4 presents ourimplementation of the system. Section 5 describes our evaluation plan and theresult of evaluation. And we conclude our work in Section 6.

2 Related work

In this section, we present the related efforts we made, including the surveyof load balancing algorithms and the deployment of our system.

1

Page 2: Implementation of a Load Balancing Algorithm in a Ticktet

2.1 Survey of Load Balancing algorithms

In our project survey paper, we represents seven kinds of load balancingalgorithms. For our project we use General Load Balancing Techniques. GeneralLoad Balancing Techniques can be separated into two kinds: static and dynamic.

The categories we analyzed include natural phenomena-based(6; 8; 9), Agent-based(7; 10), Hadoop Map-Reduce(2; 3), Workflow specific(4; 5), General loadbalancing(11; 12), and Network-aware task scheduling and load balancing(13).

We use dynamic load balancing algorithm which utilize the metrics contain-ing server status such as latency time or average response time.

2.2 Deployment

Since we cannot meet in person to use our computers as servers, we chooseto deploy Zookeeper cluster on a single computer.we use a single device runningmultiple Zookeeper instances on different ports to represent ZooKeeper cluster.We first deploy ZooKeeper instances on Tomcat Server, then deploy DubboAdmin and Dubbo Monitor on the server as well. After that, we use IDE to runthe service providers and consumer on different servers. We tried to use Dubbometrics by adding maven dependency, but it did not work, so we decide to addmetrics’s source code in our project and use it directly. For each provider, wewill also run a http server which can process the http request from load balanceand send back metrics information.

3 Frameworks

We use three frameworks in this project. First of all, we use ZooKeeperas registry center. We also use Dubbo to monitor the status of services andextend Dubbo’s LoadBalance interface to implement our load balancing algo-rithm. Apart from that, we use Spring framework to accelerate the developmentprocess.

3.1 Zookeeper

ZooKeeper is a centralized service for maintaining configuration information,naming, providing distributed synchronization, and providing group services. Inour project we use Zookeeper as a registry center. Clients submit requests toZooKeeper through a client API using a ZooKeeper client library. In additionto exposing the ZooKeeper service interface through the client API, the clientlibrary also manages the network connections between the client and ZooKeeperservers(1).

3.2 Dubbo

Apache Dubbo is a high-performance, Java based open source RPC frame-work. Dubbo provides load balancing interface ”LoadBalance” which we can use

2

Page 3: Implementation of a Load Balancing Algorithm in a Ticktet

to implement our own load balancing algorithm. Besides, Dubbo also providesDubbo Admin and Dubbo Monitor to monitor the services, including requestsnumber and average latency.

3.3 Spring

The Spring Framework is open source project, it is an application frame-work and inversion of control container for the Java platform. The framework’score features can be used by any Java application, but there are extensions forbuilding web applications on top of the Java EE (Enterprise Edition) platform.Although the framework does not impose any specific programming model, ithas become popular in the Java community as an addition to, or even replace-ment for the Enterprise JavaBeans (EJB) model.

4 Implementation

In this section, we will show the implementation of the ticket booking systemand the load balancing algorithm.

4.1 Ticket Booking System

Since the main focus of this project is implementing a load balancing algo-rithm for ZooKeeper, the ticket booking system we build is only a simple proto-type with basic functions just enough to test the load balancing algorithm. Thearchitecture of the system is shown in Figure 1. Users will browse the websiteto find the ticket they want to buy, and a request will be sent to book the ticket.The load balancer will receive the request and assign this request to a serverbased on the response time of requests of available servers. This request willbe processed by the server assigned, the service will write the information intodatabase if the ticket is booked successfully and return a message to the clientto inform him. The UI of the system is shown in Figure 2. The top of thewebsite is a navbar, users can go to home page, find the contact methods forsupport and search for tickets using it. These functions are not implementeddue to the limitation of time. There is also a carousel to show some informationthe users may be interested in, like tickets for some hot events, or an update an-nouncement. The tickets are shown below the carousel, we haven’t implementedthe search function so we test the purchase function through the buy button inthese tickets cards. The basic ticket information is shown in the cards, and userscan click the button ”buy now” to purchase the ticket. Once the users click thebutton, a request will to sent to the server to process this purchase, and userswill see a dialog showing whether the purchase is completed successfully or not.

4.2 Load balancing algorithm

Yakhchi et al.(2015) come up with an algorithm which they named it CuckooOptimization Algorithm (COA)(6). In the COA algorithm, they use the re-

3

Page 4: Implementation of a Load Balancing Algorithm in a Ticktet

Figure 1: System Architecture

Figure 2: Website for the system

4

Page 5: Implementation of a Load Balancing Algorithm in a Ticktet

Figure 3: Ticket

sponse time to determine whether a host is overutlized or not. We also usethis idea in our algorithm. We use Dubbo to build http server in each serverand use http request to get the zookeeper metrics in each server. Among thediverse information contained in the metrics, we use the data named ”middle-ware.metrics.rest.url.rt” as response time.

5 Evaluation plan and result

We plan to deploy our system, then send a large set of requests to theservers to test our load balancing algorithm. In the following sections we willfirst illustrate the experiment setup and result of the experiment.

5.1 Experiment Setup

We set up the experiment with the same configuration as we used to deploythe system, which is running multiple Zookeeper instances on different ports ofone device to represent ZooKeeper cluster.

In order to simulate large amount of requests, we use Postman, which cangenerate a lot of http requests with different data as parameters. We use DubboMonitor Service to monitor our system, so that we can use its visualized chartsto evaluate the performance of our load balancing algorithm. Apart from ourload balancing algorithm, we also test the performance of a simple random loadbalancing algorithm and some load balancing algorithms provided by Dubbo.

5

Page 6: Implementation of a Load Balancing Algorithm in a Ticktet

Figure 4: Performance

Figure 5: Comparison

5.2 Result

The performance of different algorithms is shown in Figure 4. Dubbo Moni-tor draw the charts according to the metrics information it collected. Accordingto the chart shown in Figure 5, we can see that the performance of our algorithmcan achieve a similar performance compared to the popular algorithms used byDubbo.

6 Conclusion

In this paper, we implemented a load balancing algorithm based on ZooKeeperand Dubbo, build a ticket booking system with is algorithm and test the perfor-mance of our algorithm. Then we set up an experiment to test the performanceand analyze the result. As shown by the result, our load balancing algorithmcan achieve a similar performance compared with some popular algorithms likeround robin and least active.

There are still limitations in our project. First of all, the system is still

6

Page 7: Implementation of a Load Balancing Algorithm in a Ticktet

a prototype, so the composition of the request and its process time could bedifferent from the complete system. Apart from that, we only deploy the systemon a fake cluster, so its performance on a real cluster with more servers still needto be evaluated. The last but not least, the load balancing algorithm can stillbe improved by taking factors other than response time into account, and assignweight to servers to make the algorthm more efficient.

References

[1] P. Hunt, M. Konar, F. P. Junqueira, and B. Reed. 2010. Zookeeper: Wait-free coordination for internet-scale systems. In USENIX ATC. 9, 100

[2] ] Ahmad, R.W., Gani, A., Hamid, S.H.A., Shiraz, M., 2015. A survey onvirtual machine migration and server consolidation frameworks for clouddata centers. J. Netw. Comput. Appl. 52, 11–25.

[3] Hou, X., Kumar, A., Varadharajan, V., 2014. Dynamic Workload Balancingfor Hadoop MapReduce. Proceeding of International Conference on Bigdata and Cloud Computing, 56-62.

[4] Ghosh, S., Banerjee, C., 2016. Priority Based Modified Throttled Algorithmin Cloud Computing. International Conference on Inventive ComputationTechnology.

[5] Cai, Z., Li, X., Ruizc, R., Lia, Q., 2017. A delay-based dynamic schedulingalgorithm for bag-of-task workflows with stochastic task execution times inclouds. J. Future

[6] Yakhchi, M., Ghafari, S.M., Yakhchi, S., Fazeliy, M., Patooghi, A., 2015.Proposing a Load Balancing Method Based on Cuckoo Optimization Algo-rithm for Energy Management in Cloud Computing Infrastructures. Pub-lished In: Proceedings of the 6th International Conference on Modeling,Simulation, and Applied Optimization (ICMSAO).

[7] Singha, A., Juneja, D., Malhotra, M., 2015. Autonomous Agent BasedLoad-balancing algorithm in Cloud Computing. International Conferenceon Advanced Computing Technologies and Applications (ICACTA), 45,832–841.

[8] Asghari, Saied, and Nima Jafari Navimipour. “Nature Inspired Metaheuris-tic Algorithms for Solving the Service Composition Problem in the CloudEnvironments.” International Journal of Communication Systems 31.12(2018): n/a–n/a. Web.

[9] Zhou J, Yao X. A hybrid approach combining modified artificial bee colonyand cuckoo search algorithms for multi-objective cloud manufacturing ser-vice composition. Int J Prod Res. 2017;1-20.

7

Page 8: Implementation of a Load Balancing Algorithm in a Ticktet

[10] M. N. Anjum, C. Chowdhury and S. Neogy, ”Implementing Mobile Agentbased Secure Load Balancing Scheme for MANET,” 2019 InternationalConference on Opto-Electronics and Applied Optics (Optronix),

[11] Komarasamy, D. and Muthuswamy, V., 2016. A novel approach for dynamicload balancing with effective Bin packing and VM reconfiguration in cloud.Indian Journal of Science and Technology, 9(11), pp.1-6.

[12] Nitika M, Shaveta M, Raj MG. Comparative analysis of load balancingalgorithms in cloud computing. International Journal of Advanced Researchin Computer Engineering and Technology. 2012; 1(3):34–8.

[13] Ullman, J.D.: NP-Complete scheduling problems. J. Comput. Syst. Sci. 10,384–393 (1975)

8