CHAPTER 1 Introduction
1.4 Organization
The rest of this thesis is organized as follows. Chapter 2 introduces related works in common scheduling and task assignment algorithm. In Chapter 3, we propose a mobile banking messaging frameworks which can easily fulfill functions, including Instant Messaging, Instant Computing and Dissemination of Major Information, Bilateral Communication, Bilateral Trading, and many other mobile financial services. In Chapter 4, we observe the characteristic of real-world network delay and propose a network delay autocorrelation model to verify our task assignment algorithm. In Chapter 5, we have an experiment to find the bottleneck of the system and then propose our task assignment algorithm. In Chapter 6, we take some simulation and emulation to verify the network delay autocorrelation model and our task assignment algorithm.
Finally, the conclusions and future work are presented in Chapter 7.
9
CHAPTER 2
Related Work
To satisfy the demand for mobile financial service, it is important to overcome bursty traffic and network instability. Especially in financial industry, the pursuit of the greatest benefit is always along with investment of the least resources.
Scheduling can be thought of as improving performance for free. Therefore, an appropriate scheduling policy is selected to achieve better efficiency and stability of the network, and mean response time is vastly reduced without requiring the purchase of faster machines.
In this thesis, some common scheduling policies are discussed and the feasibility in the time-sensitive financial markets is analyzed.
2.1 Risk Diversified Schemes
The most intuitive and simplest method is diversification of risk based schemes. The simplest example of diversification is provided by the proverb "Don't put all your eggs in one basket". This method allocates loading of work evenly to each host so that a single and specific host won’t face overloading. Methods based on this scheme include Round Robin Based Schemes, Random Based Schemes and so forth.
10
2.1.1 Round Robin Based Schemes
2.1.1.1 Round Robin (RR)
Round Robin (RR) [19][20][21]means each host is selected in a round robin order.
2.1.1.2 Weighted Round Robin (WRR)
Weighted Round-Robin [22] is modified from Round-Robin. WRR determines the number of jobs for each server depending on the weight. More algorithms of Weighted Round Robin Based Schemes are derived from the different patterns of calculating weights.
These kinds of algorithms should have the best mean response time if the servers’
performance or the workload is uniform. However, if each server has different and changing capacity, the use of the round-robin based schemes system means that a less powerful server or the heaviest load server receives the next inquiry even though it has not yet been able to process the current one.
2.1.2 Opportunity Based Schemes
2.1.2.1 Random
Random [23][24] means that each host has the same probability of being selected.
2.1.2.2 Weighted Random
Weighted Random scheduling algorithm [25] is modified from Random. According to different weights, we can determine the probability of each server. Weight of each queue is determined by the computing ability of corresponding server.
11
The aim of Opportunity Based algorithm is to equalize each server’s expected probability of being selected. Opportunity Based algorithm is oblivious to the change in the state of the system, so it will face the same problem with Round-robin when the servers have different and changing capacities.
2.2 Least-Number Based Schemes
Load balance is achieved by evaluating loading through calculating quantity of users’
connection and queue length (number of jobs). Some of these algorithms are Least Connection First, Shortest Queue First and so on.
2.2.1 Least Connection First (LCF)
Least Connection First (Least User First)[26] ensures that the server that is currently servicing the least number of connections is allocated the next service request that is directed at the load balanced server farm.
LCF is one of the dynamic scheduling algorithms because it needs to count the number of connections for each server dynamically to estimate its load. Round-robin could not recognize how many connections are maintained over a given time. This potential problem can be avoided with the least-connection-first algorithm.
Least connection queue is not necessarily the lightest load queue when the load is not the same for each connection. The least-connection-first algorithm cannot get load well balanced among servers with various processing capacities.
2.2.2 Shortest Queue First (SQF)
Assigning priorities is as a function of the number of jobs[27]. This algorithm tries to equalize the instantaneous number of jobs at each server whereas Round-robin balances the expected workload of the system. The advantage of Shortest-Queue-First algorithm
12
is that it can react quickly as soon as the queue length of each host becomes imbalanced.
The shortest queue is not necessarily the fastest consumption rate queue when job size variability is high. In this situation, queues can become empty or explode very suddenly.
2.3 Job-Size Based Schemes
To achieve the lowest possible response time, allocation of job is conducted according to job size or computing time of job.
2.3.1 Shortest Job First
Assigning priorities is as a function of the job size [28][29]. That is, each job goes to the queue where it will achieve possibly the lowest response time. This is an ambitious policy because each job is acting in its own best interest. Unlike some of the above algorithms that aim to equalize the probability of being selected of each host, the Shortest-Job-First algorithm focuses on equalizing the total work at each host.
2.3.2 Min-Min
The host that has the minimum completion time for all jobs is selected[30][31]. Then the job with the minimum completion time overall is selected and mapped to that resource.
2.3.3 Max-Min
Max-Min[32] is similar to Min-Min algorithm. The job with the maximum completion time as a whole is assigned to the host which has the minimum completion time.
Both Min-Min algorithm and Max-Min algorithm are good way to balance the load of server farm when it is available to estimate the completion time of each job.
13
These are ambitious policies because each job is acting in its own best interest. The disadvantage of such algorithm is that it will cause starvation.
Furthermore, like Shortest-Job-First algorithm, they fail to function when the completion time or the time of each connection used is unpredictable. Unfortunately, in the real world, it is hard to predict the job size and the time of each connection used before delivering.
2.4 Consumption Fast First Strategies
Load balancing judgment is according to the consumption rate of the queues.
2.4.1 Flow Control Principle
Priority of scheduling is received by monitoring consumption rate of queue on each server[33].
2.4.2 M/M/1
Suppose arriving time of job is Poisson process and service time is exponentially distributed. Response time of each job is predicted by M/M/1 queuing model [34][35]
in queuing theory, and server with the shortest response time is selected.
In Flow Control Principle, each job is assumed the same in scale, while service time is assumed exponentially distributed in M/M/1. Hence, the prediction is imprecise when the scale of job is very high and there is a wide variety of service times.
14
2.5 Summary of Related Work
It is not easy to balance the load of each server considering the bursty traffic and network instability. Constrained by the unpredictable mobile network bandwidth, SJF, Min-Min, Max-Min, and algorithms that require the completion time to function do not correspond to what this research expects to get.
Because of users’ mobility, transmission speed of mobile network might be fast or slow. Therefore, transmission time for each job would not be known in advance. On the other hand, the loading of each connection is unknown as well because there is no evidence to show where the heavy user is. When using Shortest-Queue-First algorithm, it may produce a shortest queue that has the longest waiting time. When it comes to Lest-Connection-Fist algorithm, it may balance the connection of each host but not balance the queue length or the response time, not to mention the RR algorithm and the Random algorithm which do not consider the backend state in the bursty traffic and network instability condition.
With the goal of achieving the best performance in such an uncertain network environment, this research analyzes the architecture and behavior of the system in the conditions of real world and then proposes an algorithm as a solution to solve these problems.
15
CHAPTER 3
Mobile Banking Messaging as a Service Framework
3.3 Mobile Banking Messaging as a Service Framework (MBMaaS)
This research aims at building a framework which can easily fulfill functions, including Instant Messaging, Instant Computing and Dissemination of Major Information, Bilateral Communication, Bilateral Trading, and many other mobile financial services.
When it comes to performance, flexible expansion and complete management of resource are in the considerations as well.
While the frameworks mentioned above make it feasible to accomplish the horizontal expansion, instant state of background management system cannot be monitored. Thus, only the static policies like Round-robin and Random can be implemented, but they are unable to satisfy instant demand of financial service.
As shown in Figure 2, based on the mentioned framework, monitor component is added to each of Connection Manager in the server farm with a view of monitoring the state of server. Information being monitored includes the number of connection, the number of users, the number of job, arrival rate, service rate and so forth. Following the monitoring procedure is the return of information to controller component on Load Balancer where task assignment can make judgment accordingly.
16
Figure 2. Mobile Banking Messaging as a Service Framework
17
CHAPTER 4
Network Delay Autocorrelation Model
4.1 Hypothesis
In order to solve the network problems, it is necessary to understand the characteristics of real-world network delay so that we can propose an improved method and verify it.
Like Figure 3, we observe one of the receivers, whose time series of network delay is recorded. In spite of the continuous variations of network delay, some patterns can be observed. Drastic variations of network delay rarely happen in a short period of time according to the observation. That is, the correlation of network delay exists right before and after a short time period. For instance, if the network delay is “high” before the short time period, so is the network delay of current short time period. This sign continues even after the short time period, meaning a continuous congestion of network may last for a while.
Figure 3. Time Series of Real-world Network Delay
To compare the performance of system in the real network when adopting various task assignment policies and to validate correctness and feasibility of task assignment
18
policy in subsequent tests, a mobile network which consists of tens of millions of users in the experimental environment is necessary to meet the scenario of future Bank 3.0.
However, it’s hard to use thousands of real mobile devices and deploy them in different real network conditions to verify the scheduling policy. Moreover, controlled factors would not remain the same in every real experiment, representing the performance of algorithm with different parameters cannot be compared. Hence, a network model is expected to be proposed as a way of simulating the real network condition.
4.2 Autocorrelation
The time series of network delay is assumed to meet the characteristic of autocorrelation.
Autocorrelation in the analysis of time series reflects degree of relevance of how the same series takes numerical data in various time periods. When Autocorrelation Coefficient gets greater in time series, this represents there is a higher relevance and likeness between the historical data and the future one.
Based on the observation and assumption above, a network delay autocorrelation model is designed to produce a network with the practical characteristic of network delay. By doing so, the systematic performance of different algorithms of task assignment can be evaluated and compared in the same network environment.
19
4.3 Network Delay Autocorrelation Model
The following Table 1 lists some of the related parameters we may use:
Table 1. Symbols of Network Delay Autocorrelation Model
Symbols Definition
𝑚𝑖𝑛 Message i target to the user n, where (i, n =1, 2, 3…) 𝑡𝑖𝑛 Delivery time of 𝑚𝑖𝑛, where (i, n =1, 2, 3…)
𝜏𝑖𝑛 Interval time between 𝑚𝑖𝑛 and 𝑚𝑖−1𝑛
𝐷𝑖𝑛 Network delay of 𝑚𝑖𝑛, where (i, n =1, 2, 3…)
In our assumption, autocorrelation of network delay is higher before and after a short time period but lower in a longer time period. Hence, a formulation is designed to satisfy the above assumption. If we produce shorter sending time interval through network delay generator, the probability of creating a similar network delay for the current one and the previous one is expected. Thus, this condition is achieved by the formulation as follows:
𝐷𝑖𝑛 = weight× 𝐷𝑖−1𝑛 + (1-weight)× 𝐷𝑛𝑒𝑤 (1) The Pareto Distribution with alpha=1.1 is set, which is used in the SURGE web workload generator to produce network delay with the initial number 𝐷𝑛𝑒𝑤. We hope we can follow Pareto Distribution under the law of large numbers, and then time series of network delay meets the characteristic of autocorrelation. Thus, an interval of weight ranging from 0~1 is defined. Whenever the weight approaches 1, 𝐷𝑖𝑛 gets closer to 𝐷𝑖−1𝑛 , and whenever the weight approaches 0, 𝐷𝑖𝑛 gets closer to 𝐷𝑛𝑒𝑤. In other words, to ensure the characteristic of autocorrelation exists in the network delay time series, probability of weight with a value closer to 1 is raised as sending time interval is shorter, and in contrast, probability of owing a weight near 0 is expected when sending time interval is longer. Following is the method of how the weight is generated:
20
Step 1:
Figure 4. Interval between the Sending of Two Messages
First of all, as Figure 4 shows, an interval between the sending of two messages is recorded. Suppose the message 𝑚𝑖𝑛 for 𝑢𝑠𝑒𝑟𝑛 is sent at time of 𝑡𝑖𝑛 along with another message 𝑚𝑖+1𝑛 sending at time of 𝑡𝑖+1𝑛 , the interval time between the two messages is 𝜏𝑖+1𝑛 formulated as:
𝜏𝑖+1𝑛 = 𝑡𝑖+1𝑛 − 𝑡𝑖𝑛 (2) Since there is no message before the first message 𝑚0𝑛, 𝜏0𝑛 is preset as:
𝜏0𝑛 = 0 (3)
Step 2:
Once 𝜏𝑖𝑛 of the message 𝑚𝑖𝑛 is computed, value of 𝜏𝑖𝑛 and the correlation between 𝑚𝑖𝑛 and network delay are requisite to be defined. A parameter, most possible weight, is defined, too. If the most possible weight equals 1, network delay 𝐷𝑖𝑛 for 𝑚𝑖𝑛 is highly possible to be similar to network delay 𝐷𝑖+1𝑛 for 𝑚𝑖+1𝑛 from the perspective of probability; on the contrary, if most possible weight equals 0, the probability of finding a network delay 𝐷𝑖𝑛 for 𝑚𝑖𝑛 that is similar to network delay 𝐷𝑖+1𝑛 for 𝑚𝑖+1𝑛 is very low.
For network delay, probability of drastic variations in the condition of shorter time period is low through observation. Therefore, a function 𝑓(𝜏𝑖𝑛) with the characteristics
21
stated above is set to describe the most possible weight. A parabola opening downward then is used to denote the function of most possible weight:
𝑓(𝜏𝑖𝑛) =1+(𝜏𝑖−2×𝑎𝑛)2 (4) where,
𝛼 = 𝐶22 (5)
The width of parabola is decided by 𝑎 while b equals 𝜏𝑖𝑛 once 𝑓(𝜏𝑖𝑛) = 0. In other words, as long as 𝜏𝑖𝑛 ≥ 𝑏, there is no correlation between 𝐷𝑖+1𝑛 and 𝐷𝑖𝑛, which is the previous network delay of 𝑚𝑖+1𝑛 .
In Figure 5, this method is applied to produce either large or small functions of network delay autocorrelation by deciding different c. The model is denoted as C100 when c equals 100 and as C200 when c equals 200, and so on.
Figure 5. Functions that Decide the Most Possible Weight Step 3:
After getting the value of most possible weight, the final value of weight is required to compute the network delay. A function that is capable of randomly generating values of weight and enabling the production of most possible weight with the highest probability is expected. Hence, two parabolas, g(x) and h(x), are defined.
22
While g(x) opens upward and h(x) opens downward, the peaks of two parabolas meet each other at most possible weight, shown as Figure 6.
Figure 6. The Function that Decide the Final Weight
In order to make decision on the final weight, value of x is generated along the x axis within a range from 0~1. When 𝑓(𝜏𝑖𝑛) > x, weight = g(x); when 𝑓(𝜏𝑖𝑛) < x, weight = h(x). According to this method, random values of most possible weight can correspond to g(x) and h(x), deciding the final weight, as Figure 7.
Figure 7. Using Most Possible Weight Functions to Generate the Corresponding Functions that Decide the Final Weight
23
4.4 Result of the Network Delay Autocorrelation Model
Through Network Delay Generator, different network delay time series of autocorrelation Coefficient are generated, as Figure 8~12.
Figure 8. Network Delay with c=300 When Average 𝞽=10
Figure 9. Network Delay with c=100 When Average 𝞽=10
0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08
1.448E+09 1.448E+09 1.448E+09 1.448E+09 1.448E+09 1.448E+09
Network Delay with c=300 When Average 𝞽=10
24
Figure 10. Network Delay with c=50 When Average 𝞽=10
Figure 11. Network Delay with c=10 When Average 𝞽=10
Figure 12. Network Delay with c=1 When Average 𝞽=10
25
4.4 Autocorrelation Coefficient
Whether Autocorrelation Coefficient of network delay time series from different models is the same as expected is calculated and evaluated. s is assumed as starting time while t as ending time. Sequence of network delay is denoted as 𝑋𝑠,𝑡: 𝑥𝑠,𝑥𝑠+1, 𝑥𝑠+2, 𝑥𝑠+3… … , 𝑥𝑡. 𝜇𝑠,𝑡 and 𝜎𝑠,𝑡 represent the mean value and the standard deviation of the sequence 𝑋𝑠,𝑡 respectively. Thus, autocorrelation of k lags is denoted as follows:
𝑅(𝑘) =
𝐸(𝑋𝑘+1,𝑛−𝜇𝜎𝑘+1,𝑛)(𝑋1,𝑛−𝑘−𝜇1,𝑛+𝑘)𝑘+1,𝑛×𝜎1,𝑛−𝑘
(6) Figure 13 shows 0~10 lags, Autocorrelation Coefficient of network delay time series is generated by six models where c = 100~ 600. With the same lag, it is found that c and Autocorrelation Coefficient are in positive direction. This evidence proves generation of different network delay time series of Autocorrelation Coefficient is feasible when we adopt different values of c in the network delay autocorrelation model.
The result is in accordance with the expectation. Next, a Network Delay Generator with the characteristics of the real network which produces network delay of autocorrelation is applied to verify the task assignment policy.
Figure 13. Autocorrelation Coefficient of Network Delay Time Series Which are Produced by Six Models Where c = 100~ 600.
26
CHAPTER 5
Research Method
The current research aims to improve the performance of system based on the real behavior and bottleneck of system. To test the hypothesis that the qualities of users’
networks have impacts on the performance of system, an experiment is designed. The result of experiment is used to create a task assignment algorithm capable of improving the performance of system.
5.1 Pre-study
Take Financial Instant Messaging as an example, two receivers using mobile devices are arranged and connected to Openfire Server by the same Connection Manager, shown in Figure 14.
Figure 14. Architecture of Pre-study
Table 2. The Experimental Parameter of the two Set
Receiver 1 Receiver 2
Set 1 9.72 Mbps (Wi-Fi) 9.72 Mbps (Wi-Fi)
Set 2 9.72 Mbps (Wi-Fi) 2.09 Mbps (3G)
Table 2 compares Set1 with Set2. In Set1, two mobile devices receive the message from Wi-Fi with downloading speed at 9.72 Mbps in average, while Set2 assigned two
27
patterns of downloading speed in average, 9.72 Mbps with Wi-Fi and 2.09 Mbps with 3G respectively. Next, average waiting time of the message staying in Connection Manager is measured after sending the message to Set1 and Set2 with the same speed.
In Figure 15, it is found that average waiting time of Set2 is much longer than Set1 because of the impact of network delay, as shown in Figure 16.
Figure 15. Experiment Result of Pre-Study
Figure 16. The Impact of Network Delay
According to the experiment, it can be inferred that TCP adopted by Connection Manager is stop-and-wait instead of go-back-N. The reason why go-back-N can be used in TCP is on account of a single connection. The message would not face congestion due to the network delay of the previous message when using go-back-N as TCP.
However, in practice ,Connection Manager with go-back-N as TCP in a chat room needs a thread of TCP socket at least for connection because Connection Manager
28
Module have to manage a portion of the client connections. When facing a huge amount
Module have to manage a portion of the client connections. When facing a huge amount