FULLTEXT01
FULLTEXT01
ROBERT HEDIN
1 Introduction 1
1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.1 Transport layer . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2.2 Internet layer and transmission methods . . . . . . . . . . . . 5
1.2.3 AMS – Arena Market Server . . . . . . . . . . . . . . . . . . 8
1.2.4 Front Arena clients . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2.5 TNP – Transaction Network Protocol . . . . . . . . . . . . . 10
1.2.6 MESMA – Multi Exchange, Simulation, Measurement and
Analysis platform . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3 Previous research . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.3.1 Area of research . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.3.2 Problems with multicast . . . . . . . . . . . . . . . . . . . . . 13
1.3.3 Online auction . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.3.4 Multimedia . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.3.5 PGM (Pragmatic General Multicast) . . . . . . . . . . . . . . 15
2 Problem description 17
2.1 Problem definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.3 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4.1 Test accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4.2 Test reliability . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2.4.3 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3 Methodology 21
3.1 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.2 Hypotheses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.3 Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4 Implementation 25
4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.2 Multicast enabled sockets . . . . . . . . . . . . . . . . . . . . . . . . 26
4.3 Message states . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3.1 Receive message state . . . . . . . . . . . . . . . . . . . . . . 30
4.3.2 Recovery State . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.4 Recovery mechanism . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.5 Market Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5 Experiment 37
5.1 Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.1.1 Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.1.2 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.2 Test suits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.2.1 Information transmitted . . . . . . . . . . . . . . . . . . . . . 39
5.2.2 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.2.3 Varying number of clients . . . . . . . . . . . . . . . . . . . . 40
5.2.4 Increased amount of transmitted data . . . . . . . . . . . . . 40
Bibliography 53
Chapter 1
Introduction
1
CHAPTER 1. INTRODUCTION
times to the subscribing clients. The new implementation replaces these compo-
nents with genuine multicast using UDP. The two implementations are compared
to each other to see which one performed best under the circumstances. Multicast
is not flawless and certain prerequisites are required to enable the use of it – all in
which is discussed in this thesis.
1.1 Motivation
SunGard is a company providing software to financial institutions (i.e. investment
banks and hedge funds) for integrated sales, trading, risk management and oper-
ations/distribution across multiple asset classes. These software are built up by a
collection of components, such as Arena Market Server (AMS), and PRIME that is
a client application. AMS works as a layer between an exchange for financial instru-
ments and the client application shown in Figure 1.1. The information transmitted
between these applications is required to be delivered and has to be delivered with
as low latency as possible.
SunGard has developed a tool that can measure the performance of the AMS;
this tool is called MESMA (Multi Exchange, Simulation, Measurement and Anal-
ysis platform). MESMA has the ability to simulate an exchange and the clients
2
1.2. BACKGROUND
communicating with AMS. SunGard has performed extensive testing with MESMA
to evaluate the performance of AMS and the network traffic. A selection of these
tests was performed in Intel’s lab environment [20]. The benefits of performing
tests at Intel’s lab are the possibility to use high-end hardware with configurations
similar to the production setups used by customers. The tests showed that the
performance of the system (CPU resources) and the latency was highly dependent
on the number of clients and the activity each of the clients conducted. SunGard
has therefore issued a request to explore other communication protocols used be-
tween AMS and the client applications. The communication protocol used at the
time when this thesis started was strictly TCP and SunGard wanted to see if an
improvement could be reach by using multicast (UDP) instead. The objective of
this thesis is to investigate if the use of multicast could improve the performance
and the availability of financial instrument applications. To verify the hypotheses
of this thesis a quantitative methodology is exercised comparing test results from
the original implementation, based on TCP, and a prototype based on multicast.
1.2 Background
This section describes the foundation of the different protocols, frameworks, test
applications, and core applications of Front Arena that are used throughout this
thesis in order to implement the use of multicast. There are two different name
conventions to describe the different layers of protocols OSI model and TCP/IP
(DoD) model. Table 1 shows the difference and TCP/IP is the name convention
used throughout this thesis.
3
CHAPTER 1. INTRODUCTION
4
1.2. BACKGROUND
stable. As with UDP, TCP offers process-to-process communication for the applica-
tion layer, which is accomplished the same way as with UDP by port numbers. The
difference is that TCP is a stream-oriented protocol that requires an open connec-
tion throughout the entire session [1]. UDP and TCP have separate ways of dealing
with reliability. As explained earlier, UDP only has the checksum for error control
and nothing else. TCP on the other hand provides an array of features to ensure
the safety and regulation of data being transmitted. Due to the fact that TCP
allows streaming of bytes it can offer byte oriented flow control. This is a strong
feature to allow the flow of data to be sent in the correct pace resulting in the
loss of data to be minimized. TCP also includes features for error control, delivery
acknowledgement, retransmission of lost data, and out-of-order control. The error
control includes mechanisms such as checksum calculation [15].
TCP can guarantee packets to be delivered (unless the connection is lost) and
the flow of these packets to be regulated. There is however a price for this reliability.
These features contribute to an overhead of data being transmitted between the two
applications. For example, if a packet is lost somewhere between the server and a
client, the server has to resend the packet after a given timespan due to missing
acknowledgement. The server sends the same packet for a predefined number of
times or until it is confirmed as delivered by the client [2]. If data is frequently
lost the need to retransmit data increases, which leads to increased traffic on the
network, increased CPU consumption, and higher latency.
Multicast
Multicast is based upon one-to-many, many-to-many, or one-to-one communication
[17], perhaps the most known communication method is the one-to-many, depicted
in Figure 1.3.
Multicast is, as mentioned, supported by UDP but not by TCP; this is due to
the fact that it does not suit some of the essential features of TCP. Features such
as:
• Flow control - How could the multicast decide the flow of data in order minimize
the loss of data sent to the recipients? The flow of data is based on the feedback
5
CHAPTER 1. INTRODUCTION
of the recipients and if the sender were to receive this kind of reports from
multiple recipients there is a possibility of feedback implosion [6].
• Retransmission - What would happen in the case that a data was not delivered
to a recipient? An option would be to retransmit the lost data on the multicast
channel but that would be inefficient because not every recipient may need the
data. If one was to choose this approach and the loss of data was a repeating
event, the retransmissions could swamp the network [5].
There are reliable multicast protocols that are under research such as PGM
(Pragmatic General Multicast) which include some of these features; however, PGM
is not a standard protocol and was not tested in this thesis but is discussed in section
1.3.5 [19] [12].
If multicast were applied to the same example as described in the Unicast section
the following scenario would occur. The initial step is for the acquired recipients to
subscribe to the multicast group at which the application sends data through. The
subscription is needed for the router to identify each individual destination address
so that the datagram can be delivered. The recipients can then start to receive
datagrams sent by the application on that specific multicast group. The advantage
of this approach is that the datagram is not being copied until it has arrived at
the intermediate router where two or more recipients do not share the same path.
The use of multicast has been shown to reduce the amount of data traversing the
6
1.2. BACKGROUND
Figure 1.3. Multicast using routers, and switches with IGMP snooping enabled
network with a factor of O( 2 (n)), where n is the number of clients, for suitable
p
applications [4].
The problem with multicast is still the absence of reliability, meaning that there
is no guarantee of the data transmitted being delivered or delivered in the correct
order. However, if the reliability is not as important for portions of the systems
communication as the aspect of reducing bandwidth usage then the option of using
multicast is at hand and could improve the performance three.
Another downside of using multicast is the importance of a correct configured
network environment (LAN). A typical example of this would be an environment,
built up by switches, where IGMP snooping was not configured or if IGMP snoop-
ing was not included in the switches. By default, switches forward every multicast
packet on all ports (Multicast flooding) because they are not aware of the subscrib-
ing hosts and therefore rely on the recipients to handle the message(s). Multicast
flooding can strain the network and each individual host because it requires the
host to process packets they have not solicited. However, newer switches come with
a feature called IGMP snooping that allows the switch to listen in on the IGMP
conversation (e.g. membership request) between hosts and routers. This feature
enables the switches to maintain a map of host and the corresponding multicast
stream and packets are forwarded only to the required port. Figure 1.4 illus-
trates the absence of IGMP snooping and Figure 1.3 illustrates the use of IGMP
snooping.
7
CHAPTER 1. INTRODUCTION
Figure 1.4. Multicast using routers, and switches with IGMP snooping disabled
8
1.2. BACKGROUND
An AMS is usually setup with the relationship of one AIMS and multiple AMAS
instances, one for each exchange. It is also possible to install multiple AMS in-
stance/component on a single machine to fully utilize the resources. The commu-
nication between the client applications and AMS is handled using TNP, which is
described in section 1.2.5.
• OMNI
9
CHAPTER 1. INTRODUCTION
• PRIME
• SOFT BROKER
The flow of data is depicted in Figure 1.6 where the example illustrates the
event of a trader entering an order.
The picture shows how the client application, in this case OMNI, places an order
request that in turn is passed on to the exchange. Afterwards the exchange sends
a reply message, later processed back to the client by AMS.
10
1.2. BACKGROUND
• Public orders - Buy or sell orders from all exchange members, same as Market
prices but with better granularity.
• Private orders - Detailed information like Public orders but generated from buy
or sell order placed inside the domain of a member.
• Market prices - Price, volume, and order depth for which a goods or service is
offered by an exchange (sell and buy). Public orders aggregated by price, a
compact view.
• Price details - Information message generated upon a match between two orders
(e.g. last price, opening price, and closing price).
For example, the three clients in Figure 1.7 are subscribing to Market prices
information. The server would construct a list containing the three clients (con-
11
CHAPTER 1. INTRODUCTION
nections) and send the Market price information to each connection to simulate
multicast.
This software replaces the exchange so that the latency of unit under test, band-
width, throughput, along with other aspects, e.g. CPU-load can be evaluated. This
approach allows for a controlled interaction between the server and the client, which
is not possible with the alternative of using recorded market data and playback be-
cause of the inconsistency. The measurements are performed on each individual
transaction during an experiment – there is no average or sampling because the
behavior of the system is different under load.
The time is measured in microseconds, using the Intel CPU instruction RDTSC
(Read Time-Stamp Counter). This enables a very accurate measuring of each trans-
12
1.3. PREVIOUS RESEARCH
action and it does not create any dependencies to any external appliances. Every
transaction is measured by the time it takes to send the transaction and receive its
acknowledgement. Measured times are bucketed, i.e. counted and stored as a pair
– number of occurrences per measured time.
What makes MESMA such a powerful tool is the ability to specify parameters
used in each test-case, parameters such as the number of clients, number of order
books, load across each order book, and the duration of the tests. This feature
enables each test to be consistent and repeatable which is a requirement for this
thesis.
13
CHAPTER 1. INTRODUCTION
two multicast-aware routers [5]. Routers that do not support multicast go hand
in hand with the problem that network switches have when handling multicast, as
previously mentioned as Multicast flooding. It is not unjustified for people to think
that multicast is an immature and unreliable technology; there is no guarantee that
a network supports multicast or routers/network switches with IGMP snooping
(efficient multicast). Fortunately, more and more routers are being upgraded to
handle multicast packets and more and more network switches ship with IGMP
snooping as an option.
1.3.4 Multimedia
There are studies [5] pointing toward the fact that the use of multicast may benefit
certain applications especially in the field of multimedia. A canonical example of
this was performed in March, 1992 at the meeting of Internet Engineering Task
Force (IETF) in San Diego where a live audio meeting was performed [7]. The test
was conducted with 20 participants placed on three different continents spanning
over 16 time zones. The results of this experiment and similar research lead to a
better insight of the capabilities and issues involved in using multicast [7] [8]. In
the past, multicast was considered a service with limited use and applicable to few
areas, but research has shown that multicast is a much desired service which is
needed for efficient group applications [?].
The ideal solution according to the study of ’A multimedia multicasting problem’
[5] would be for the sender to treat the multicast group as a whole and not on an
individual basis. The issue with this is that either some recipient’s retransmission
14
1.3. PREVIOUS RESEARCH
• Enable the transmitter and recipients to cooperate in handling with lost data. A
recipient who discovers a loss can multicast a retransmission request to the
group and whoever has the missing data can multicast it back to the group
[5] [10].
• Try to solve the problem of flow and congestion control by reducing the need to
send error detection back to the transmitter by using FEC (Forward Error
Correction) [11]. FEC is a technique used for controlling error in data trans-
mission over unreliable or noisy communication channels. The sender and
recipient reserve enough resources in order to minimize the risk of receiving
more data than can be dealt with [13].
The conclusion from the study of ’The multimedia multicasting problem’ [5] is
that there is not a single solution to the problems of reliable multicast communi-
cation but rather a combination. The mixture of solutions is highly dependent on
each individual system and its requirements.
15
Chapter 2
Problem description
This chapter states the problem at hand as well as what the goals are, what limita-
tions exist, and the requirement that needs to be taken into considerations in order
to achieve comprehensive results.
17
CHAPTER 2. PROBLEM DESCRIPTION
• What are the benefits of using multicast instead of unicast (TCP) and if there
are any, how big of an impact will they have?
• What are the negative aspects of using multicast instead of unicast and how can
they be minimized?
2.2 Goals
The far most important goal of this thesis is to increase the knowledge in the field
of Transport layer, especially the technology of multicast. This thesis investigates
the effects of using multicast for parts of the communication in AMS and what the
benefits/disadvantages are.
2.3 Limitations
A limitation to this thesis is that the experiments performed are based on very
specific software and the results may not apply to similar software. The same goes
for most of the libraries used in this system; all tests and implementations are
based on Windows environment. An interesting aspect would have been to test the
solution on platform independent software with a wider range of use.
2.4 Requirements
This section deals with the requirement of the tests accuracy, test reliability, and
the model itself.
18
2.4. REQUIREMENTS
exception of the network activity. The influence of external factor impacting the
network activity was decreased by performing the tests in an isolated VLAN (Virtual
LAN).
2.4.3 Model
The requirements of the model are to act identical to the previous implementation
and contain the same functionality. The information transmitted should not un-
der any circumstances, be modified by the model with the exception of adding a
sequence number to the messages needed for reliability features.
19
Chapter 3
Methodology
The purpose of this chapter is to describe how this study was conducted. The Model
section describes the transition to using multicast and what makes it possible to
compare transmissions using TCP to multicast. The Hypotheses section has the
objective of describing the hypotheses of the model and what the expected outcome
of this study is. The final section of this chapter, Verification, deals with the process
of how to test each hypothesis.
3.1 Model
The objective of this study was to test if the use of multicast could improve per-
formance of financial instrument applications. In order to test the hypotheses in
section 3.2 a model was created. The purpose of the model was to enable the use
of multicast and make it possible to compare the two transmission technologies.
The first step in creating this model was to extend TNP with features needed to
send messages using Multicast. These features are described in the Implementation
chapter. The next step was to ensure that the model behaved like the original
implementation e.g. transmitting message m from point A to point B with the
original implementation had the same outcome as the model. The model had the
same functionality as the original implementation meaning that it could perform
test using either TCP or multicast. When the model was completed MESMA could
compare the two technologies by running test using the model, switching between
the protocols. The extended version of TNP consisted of new network sockets using
multicast and functionality to manage these sockets, Figure 3.1 illustrates a scaled
down version of the model.
3.2 Hypotheses
This section describes the hypotheses that were evaluated during this thesis. There
are three factors that are considered in the following four hypotheses. The three
factors are time, computing power (CPU-usage), and the load on the network.
21
CHAPTER 3. METHODOLOGY
• Hypothesis 1 - The time it takes to send data with the multicast implementation
does not exceed the time it take to send the same data to a client list (MC)
with the old implementation.
• Hypothesis 2 - The load on the network at which the client and AMS is com-
municating through decreases with the new solution.
• Hypothesis 3 - The CPU-usage of the new implementation does not exceed the
amount used by the old implementation.
• Hypothesis 4 - The number of clients able to utilize the service of one AMS
increases without exceeding the load on the network or the need to use more
CPU as for the old implementation.
22
3.3. VERIFICATION
3.3 Verification
To test the hypotheses MESMA was setup to run either the original implementation
or the new implementation by a setting specifying which one to use. The tests were
performed on an isolated network (VLAN) where interfering network traffic was
reduced to a minimum.
Hypothesis 1 is the most difficult hypothesis to test because the data is randomly
created between each test case. However, the test framework (MESMA) is created
with this problem in mind and is therefore equipped with the ability to parameterize
these variables so that tests can be replicated. By performing tests with the same
parameters for the two MESMA setups the result could be evaluated and hopefully
the hypothesis could be verified. At the end of each test the latency of the data was
compared and if the latency is equal or lower, compared to the old implementation,
Hypothesis 1 is verified.
Hypothesis 2 is not going to be evaluated by the results of each MESMA test
case but can instead be evaluated by the built in Performance Monitor included
in Windows. The Performance Monitor registers the load on the network while
running a test. It is important that no other application is running at the same
time because there is no way of isolating the monitoring of network to a single
application and this could therefore impact the results. If the load on the network
is lower for the new implementation, compared to the old implementation, then
Hypothesis 2 is verified.
Hypothesis 3 is similar to hypothesis 2 because it requires the use of Performance
Monitor in Windows. The monitor is also capable of registering the CPU activity
of the applications currently running. It is therefore important not to run other
applications, as it would impact the result. Hypothesis 3 can be verified if the CPU
usage of the new implementation is lower or equal to the old implementation.
Hypothesis 4 can be evaluated by performing tests with MESMA using varying
number of clients. To verify the hypothesis the number of clients used with MESMA
utilizing the new TNP has to be greater than MESMA utilizing the old TNP while
at the same time yield the same result in terms of latency.
23
Chapter 4
Implementation
In this chapter all the steps needed to implement the use of multicast with UDP
are described. That includes how the model was created and what the end result
of the model would look like. Other subjects that are described in this chapter are
the existing libraries and how those are used and/or extended with functionality
needed to test the hypotheses.
4.1 Overview
Most of the multicast functionality was placed in TNP library (described in section
1.2.5 ). TNP is a library constructed as a communication layer between clients
and server applications (e.g. AMAS and AIMS). The first step towards multicast
communication was to extend the TNP library with three major components. The
first component was network sockets able to communicate with multicast. The
second component was new states to handle these messages and the recovery process.
The third component was a basic recovery mechanism, NAK, where the receiving
client can determine if there is a missing or out-of-order message by comparing the
received message´s sequence number with that of the previously received message.
TNP was not the only component that changed; changes were also made to the
Market Server (MSRV). The Market Server had to be extended with functional-
ity to enable the use of multicast, functionalities such as the initiation-phase and
house-keeping of connections. The initiation-phase is the phase that guides the
client towards using multicast communication instead of TCP, such as what mul-
ticast groups certain information is distributed on and the address/port to find
those multicast groups. The house-keeping task is mainly focused on how to divide
different kinds of information on each multicast group, and how many multicast
groups to be used. The changes made in the Market Server are described in greater
details in section 4.5. Figure 4.1 illustrates the relationship between TNP and the
components using it.
The functionality used to aggregate messages from TNP to the client remains
the same for TCP and multicast so there were no changes made at the client side
25
CHAPTER 4. IMPLEMENTATION
applications.
With these points in mind, TNP was extended with the new socket and all the
functionality needed to send and transmit data through multicast.
TNP can handle multiple simultaneous asynchronous input/output operations
from many file descriptors (socket, file, etc.) with an API called Input/Output
26
4.2. MULTICAST ENABLED SOCKETS
Completion Port (IOCP). The benefit of using IOCP is resource conservation; in-
stead of dedicating a complete thread to handle I/O from a file descriptor, IOCP
can handle multiple file descriptors with just one thread. Figure 4.2 illustrates
how IOCP generally works serving four clients with four threads handling comple-
tions. IOCP receives a notification, or what is in this context called a completion.
These completions are generated from each file descriptor bound to the IOCP object
from events such as received data, sent data, or established connections. After the
IOCP receives one of these completions it can perform the appropriate action such
as aggregate the data received to another part of the application.
The amount of work needed to integrate the newly created multicast socket into
IOCP was small. In the eyes of IOCP, whether the completion was a result from
data received by a TCP socket or a UDP socket does not matter, the completion
looks the same. It was therefore an easy assignment to implement the use of other
sockets and have them bind to the same IOCP and work seamlessly. Another great
feature with IOCP is that multiple threads can handle the completions generated
from multiple file descriptors. The completions are stored in a thread-safe queue
where each thread can poll completion and deal with the given task individually.
TNP contains an extension of the socket class called TNPConnection. TNPCon-
nection can either be using TCP or multicast, and contains all the functionality
needed to establish a connection, send/receive data, set socket properties, and much
more.
TNPConnection has placeholders for other connection objects, which basically
means that two TNPConnection objects can be linked. This setup becomes clearer
when addressing the recovery mechanism in section 4.4. In the recovery process,
lost messages are transmitted over TCP and not multicast so that the other clients
are not disrupted by old messages. When entering the retransmission process the
UDP connection asks its linked TCP connection object for assistance to fetch the
lost message(s).
TNPConnection objects works differently if it is a server side or a client side
connection. For the server there is one TCP connection for each client connected
and multiple UDP connections depending on the number of multicast groups used.
TNPConnection at the server are not linked (as mention earlier) because the connec-
tions do not collaborate or complete any tasks together. At the client application
there are one TCP connection and multiple UDP connections depending on the
number of multicast groups used. The difference is that the TCP connection is
linked to all the UDP connections and considered the parent connection. The TCP
connection handles all the communication that is not within the scope of multicast,
such as initializing the use if multicast and fetching recovery messages. Figure 4.3
illustrates the setup of connections before the use of multicast.
Figure 4.4 illustrates the new setup with multicast and how the two different
connections are linked together.
To show how IOCP and TNPConnections are linked together another class has
to be explained, the TNPConnectionManager class. TNPConnectionManager can
handle TNPConnections using TCP and multicast so it only requires one TNPCon-
27
CHAPTER 4. IMPLEMENTATION
Figure 4.2. IOCP – The setup used in this figure illustrates IOCP running on a
dual processor box with four worker threads handling completions from four clients.
The client context represents the data included in each I/O operations such as the
buffer, buffer size, and other connection properties. These properties are needed to
create the next asynchronous I/O operation without duplicating the data, e.g. only
allocate the buffer at the beginning and not for each I/O operation.
28
4.3. MESSAGE STATES
29
CHAPTER 4. IMPLEMENTATION
The new multicast message was equipped with a sequence number used to keep
track of which message to expect and for recovery purposes. Details about the
recovery process can be found in next section 4.4.
The purpose of the receiving state is to evaluate the message and check of error.
The first step is to check if the recipient is in the client list, meaning that the
client is eligible to receive the message. This check is necessary because there is
no way for the Market Server to filter out ineligible users with UDP. The Market
Server appends a client list to the message and each client evaluates whether or not
to aggregate the message. If the client is not eligible to receive the message the
message is discarded and the current sequence number incremented. If the client
is eligible to receive the message the sequence number of the message is evaluated.
By subtracting the sequence number of the previously received message´s to the
sequence number of the current message the next step can be calculated. The red
area in Figure 4.5 illustrates the state of receiving a multicast message.
30
4.3. MESSAGE STATES
31
CHAPTER 4. IMPLEMENTATION
message(s). All other checks work exactly the same as for the receive message state
(section 4.3.1 ). When the client has processed all the stored messages in the con-
tainer without issuing another recovery request the client leaves the recovery state
and enters the receiving message state. The red area in Figure 4.5 illustrates the
state that handles the process of recovering a multicast message.
32
4.4. RECOVERY MECHANISM
Figure 4.6 and the following bullet points describe the recovery process in
greater details.
33
CHAPTER 4. IMPLEMENTATION
8. The parent connection informs the UDP connection (child) that the recovery
is completed.
9. The UDP connection aggregates the message(s) received during the recovery-
phase.
10. Messages arrive as normal.
1. The Market Server initializes by opening the requested multicast groups, dur-
ing the tests three groups were created – Market prices, Price details, and
Public orders.
2. A client connects to the Market Server.
3. The client sends a request to start a subscription.
4. The Market Server informs the client that the requested subscription can be
reached on multicast group X.
5. The client opens the connection to start receiving from multicast group X.
6. The client sends a message to the market Server informing that it has opened
the connection successfully, and includes a request to send a PING message
on the multicast group.
34
4.5. MARKET SERVER
7. The Market Server sends the PING message (or regular multicast message),
interpreted by the client as a verification or that multicast is possible.
If the client on the other hand uses an older version of TNP, which does not
have the features needed to use multicast, the server adds the client to the TCP
multicast list and sends MC messages as before using TCP. This also applies to the
event that the multicast verification failed (PING). The Market Server consistently
sends out heartbeats on each multicast group and if a client does not receive the
heartbeat within a given time span the client considers the multicast transmission
as failed and shuts down; a multicast message updates the heartbeat expiration
timer.
35
Chapter 5
Experiment
This section covers how the new implementation was tested against the old version,
everything from the hardware setup, computer environment, test cases, and test
case parameters.
5.1 Environment
When the tests were conducted two physical computers and two VMs (Virtual
Machine) were used, all placed inside an isolated VLAN. The purpose of the VLAN
was to eliminate as much of the network interference coming from outside sources
to achieve the best result. An overview of the environment and the names of each
machine can be seen in Figure 5.1.
• Tokra01 Tokra01 was the first VM whose purpose was to simulate half of the
passive clients. The passive clients only receive message and do not enter any
orders. This simulates a client subscribing for information.
• Tokra02 Tokra02 has the same purpose as Tokra01, which was to simulate the
other half of the passive clients.
• WhiteSands WhiteSands had the task of running the server application (AMAS)
and distribute the data to the clients, both passive and active.
• WorldCup WorldCup had the task of running the emulated exchange (MESMA)
forwarding continuous flow of information/data to the running AMAS on
WhiteSands. WorldCup also hosted two active clients used as measuring sta-
tions and for placing orders. The two active clients are needed because the
messages are delivered at different times for different clients when transmit-
ting multicast message using TCP, this is due to the each multicast message
is sent for each individual TCP client and the number of clients affects the
time of arrival.
37
CHAPTER 5. EXPERIMENT
5.1.1 Hardware
• Tokra01 VM, 2 x 2.40GHz E7-2870 Intel Xeon 2 core, 10 GB 1066 MHz DDR3,
vmxnet3 Ethernet Adapter Gigabit network connection, Windows Server 2008
(64-bit).
• Tokra02 VM, 2 x 2.40GHz E7-2870 Intel Xeon 2 core, 10 GB 1066 MHz DDR3,
vmxnet3 Ethernet Adapter Gigabit network connection, Windows Server 2008
(64-bit).
38
5.2. TEST SUITS
5.1.2 Software
Software used to develop the implementation and used during the running of the
test are listed below, most all used with standard settings.
5.2.2 Parameters
The range of test cases, defined by the parameters, is wide and each test suite was
constructed with the purpose to test one of the hypotheses. The parameters used
during the test for this thesis were:
39
CHAPTER 5. EXPERIMENT
• Public orders per second The Public orders are used to generate Market prices
emulating a real exchange and the load across the passive and active clients.
• Private orders per second Private orders are more complex than Public or-
ders and have a greater impact on the Market Server (more CPU needed).
The reason Private orders are used within MESMA is to get a better approx-
imation of how a real world environment would perform/behave. The Private
orders are usually 5% of the total orders, meaning that clients enter 5% of the
orders (market participation).
• Number of runs The parameter to run each test multiple times is not part of
MESMA, however, this was achieved by scripting each test suit to run multiple
times. During the test conducted in this thesis, five test runs were performed
for each test suite to get an average.
40
Chapter 6
6.1 Results
The results from each test case described in Chapter 5 are presented in this section
through graphs and tables. How the results were reached and calculated is described
in this Chapter.
41
CHAPTER 6. RESULTS AND DISCUSSION
multiple messages missing in a sequence then those messages are sent as one batch.
However, these data points are equal to each individual recovered message and not
the amount of batches. The results in Table 6.3 are also displayed in Figure 6.5
for easier interpretation.
42
6.1. RESULTS
Figure 6.1. Average latency measured by the first client (TCP and multicast)
using varying number of clients.
Figure 6.2. Average latency measured by the last client (TCP and UPD/Multicast)
using varying number of clients.
43
CHAPTER 6. RESULTS AND DISCUSSION
This test case was conducted using varying amount of transmitted data whilst
comparing TCP against multicast. Table 6.4 shows the results from transmitting
10000 Public orders/s over a period of 20 seconds at 5% market participation (500
Private orders/s). The number of clients varies from 10 to 40 (+ 2 active) with an
interval of 10. The results in Table 6.4 are also displayed in Graph 6.6 for easier
interpretation.
44
6.2. DISCUSSION
Figure 6.3. Average CPU usage of WhiteSands throughout a test, measured for
both TCP and multicast.
6.2 Discussion
6.2.1 Increase of clients
The results presented in Table 6.1 and456.4 show that the total number of clients
utilizing one AMS can be higher without the need of more resources by using
CHAPTER 6. RESULTS AND DISCUSSION
UDP/Multicast. The first explanation that comes to mind is that the network
capacity has reached its limit. The amount of data transporting through the Mar-
ket Server and the clients has become the bottleneck. However, if one examines the
amount of data transmitted through a complete test, take TCP using 40 (A)ctive
and 2 (P)assive clients; the amount of data is 60,7 MB over 15 seconds which is
roughly 4,05 MB/s or 32,0 Mbps. The capacity of the network used during the
test was 1 Gbps and is more than enough to handle the amount of data 42 clients
transmit at test with 5000 Public orders/s and 250 Private orders/s. Another ex-
planation to this behaviour is that the resources at the VMs become the bottleneck
and the congestion control that TCP uses prevents data to be transmitted faster.
If a client does not receive enough resources the client informs the Market Server,
at the Transport Layer, that it has to decrease the transmission rate. However, in
order for this to be the case the TCP protocol must require more CPU power to
process a single datagram (message). A way to verify this behaviour would be to
increase the hardware resources at the VMs, or exchange the VMs with dedicated
46
6.2. DISCUSSION
6.2.2 Latency
The results presented in Table 6.1 show that the average latency is lower for the
multicast implementation. The latency was lower in all cases for both the first and
the last client. The reason behind this is that the messages are only transmitted
47
CHAPTER 6. RESULTS AND DISCUSSION
Figure 6.6. Average latency measured by the last client (TCP and UPD/Multicast)
with increase amount of data transmitted.
once for multicast whereas for TCP the messages have to be sent individually to
each client which causes a delay between each transmission. The time complexity
to send a given message for the multicast implementation is O(1) or constant and
for the TCP implementation the time complexity is O(n), where n is the number
of recipients.
An interesting note to the latency is the number of retransmissions presented in
Table 6.3. What caused the number of retransmissions is difficult to understand
as the data transmitted occurred over a local network (VLAN) where no losses are
expected. An explanation to this behaviour might be the receiving buffer where it
at some points during the tests becomes full and a message being received is simply
discarded. The impact on the latency, due to retransmissions, does not seem to
be too great. However, if the reason behind this behaviour depends on the lack
of resources at the receiving end then this problem could be more severe when
running the client application on hardware with fewer resources. The number of
retransmissions is irregular and could be explained by retransmissions causing more
retransmissions due to a retransmission requires more resources from the server and
client.
The same result was reached when performing test using an increased amount
of data transmitted as presented in Table 6.4. Hypothesis 1 stated that the time
48
6.2. DISCUSSION
to send data with the multicast implementation does not exceed the time it takes
to send the same data with the old implementation. Both the results presented in
Table 6.1 and 6.4 clearly indicate that this hypothesis is true.
6.2.3 Performance
The performance was tested by comparing the average CPU-usage of the White-
Sands server running an AMS. The results presented in Table 6.2 show that the
test runs from multicast implementation performed better than that of the TCP
implementation. The difference is not great which can be explained by the fact
that the work needed to send a message to each client (TCP implementation) is not
noticeable. However, when the multicast implementation has to perform retrans-
missions it adds some extra work and increases the CPU-usage, hence the small
difference might be the result from the extra work required to send each message
individually levels out with the extra work to handle retransmissions. The results
presented in Table 2 support the fact that Hypothesis 3 is true and that the
CPU-usage has not exceeded that of the TCP implementation.
49
CHAPTER 6. RESULTS AND DISCUSSION
on virtual machines. When multiple virtual machines work in parallel the resources
could be distributed uneven or unfair that may cause unpredictable behaviour. To
eliminate the risk of unpredictable behaviour the use of dedicated servers could in-
crease the performance and latency of both implementations. Increasing the hard-
ware resources could also eliminate some of the retransmission occurring in the
multicast implementation. A qualified guess or explanation regarding the amount
of retransmission could be traced down to the receiving buffer. If more hardware
resources were given to the VMs hosting the clients, then the time to process a
message would be reduced and the probability of ending up with a full buffer would
also decrease. This would of course apply to the TCP implementation leading to
better results in both cases. An easy way to test this issue would be to decrease the
receiving buffer size and see what impact it would have on the amount of recoveries.
Increased reliability
The implementation in this Master’s thesis only consisted of very basic recovery
mechanism. This aspect could easily be extended with more advanced mechanisms
such as Congestion Control and FEC. A solution containing more of the reliability
feature that is present in PGM would be interesting to see. If there is a limit at which
the reliability mechanisms decrease the latency to the point that other protocols are
more suitable. The results presented in Table 6.3 show that recovery of messages
occurs and the number of recoveries could easily be reduced by implementing a
Congestion Control mechanism. However, the reason behind the low latency in the
multicast implementation is due to little overhead that comes with UDP. If all the
reliability features in TCP would be included then perhaps the low latency would
be lost. There are reasons why there exists minimal overhead protocol such as UDP,
and that is the low latency.
Comparing PGM
PGM is not a standard at the moment and a reason behind that might be that
there is no demand for it. Perhaps PGM is not as efficient or has the low latency as
50
6.3. CONCLUSION
UDP and that those who really demand the low latency rather stick to UDP with
simple or no reliability because that is more efficient and supported. However, a
thorough examination of PGM and its capability, applied to the same are as this
Master’s thesis, lies within reasonable boundaries for future work. Perhaps it is not
suitable for this specific area but there might be others where reliability is of higher
interest.
6.3 Conclusion
This thesis aimed to test what benefits there are of using multicast (UDP) instead of
unicast (TCP) in financial systems. The negative aspects of using multicast instead
of unicast were also dealt with in this research. This thesis also aimed to test if it
was possible to increasing the number of clients utilizing the server application by
switching to multicast. This was achieved by creating a model able to send data
with multicast and include a low level reliability mechanism.
The model was then used to alter the architecture of the Market Server and
TNP. In this new architecture the Market Server instructed the clients to open
the needed network sockets/connections to enable data to be sent using multicast.
TNP had to include new states of receiving data in order to allow the possibility
that a message did not arrive or arrived in the wrong order. This was achieved
using a sequence number attached to each message and compared at the arrival.
To the other end of this problem the TNP server side had to store the most recent
transmitted messages to ensure that when a request for a missing message occurred
it could be retransmitted again.
To answer the first question - What are the benefits of using multicast instead
of unicast (TCP) and if there are any, how big of an impact will they have?
The results from the test comparing the latency showed that the implementation
of multicast was faster than of the implementation using TCP. The CPU-usage and
the amount of data transmitted were also lower for the multicast implementation
for all sizes of clients utilizing the Market Server.
To answer the second question - What are the negative aspects of using multicast
instead of unicast and how can they be minimized?
The negative aspects of using multicast instead of unicast is not shown in the
result but rather described in section 1.2.2. The first issue is availability, multicast
is not necessarily supported in all networks and additional configurations may be
needed in order to support it. If network routers/switches does not use or support
IGMP snooping hosts connected to the network may become victims of receiving
unnecessary data. The last issue has not been discussed in section 1.2.2 and it
concerns the security, everyone can listen on multicast data and applications have
to be aware of this and avoid transmitting sensitive data using multicast.
To answer the last question - Is it possible to increase the number of clients
utilizing the Market Server by switching to multicast?
The result presented in Table 6.1, 6.2 and 6.4 all show that increasing the
51
CHAPTER 6. RESULTS AND DISCUSSION
number of clients utilizing the server application has a lower impact on the per-
formance and the resources required for the multicast implementation. The TCP
implementation is more sensitive to increasing the number of clients as can espe-
cially be seen in Figure 6.6 when running test with 30 and 40 clients at the same
time.
52
Bibliography
[1] Forouzan, BA., ’TCP/IP Protocol Suite’, 4th edn. 1221 Avenue of the Amer-
icas, New York, NY 10020, US, 2010.
[2] Stallings, W., ’Computer networking with internet protocols and technology’,
1th edn. Upper Saddle River, NJ Prentice Hall, US, 2004.
[3] Liu, H., Wang, S., Fei, T., ’Multicast-based online auctions: a performance
perspective’, Benchmarking: An International Journal, vol. 10, no. 1, pp.
54-64, 2003.
[4] Jacquet, P., Rodolakis, G., ’Multicast Scaling Properties in Massively Dense
Ad Hoc Networks’, 11th International Conference on Parallel and Distributed
Systems, INRIA and Ecole Polytechnique, France, Vol. 2, pp. 93-99, July
2005.
[5] Pasquale, J., Polyzos, G., Xylomenos, G., ’The multimedia multicasting prob-
lem’, Multimedia Systems, vol. 6, no. 1, pp. 43-59, 1998.
[6] Crowcroft, j., Paliwoda, K., ’A multicast transport protocol’, Computer Com-
munication Review, vol. 18, no. 4, pp. 247-256, 1998.
[7] Casner, S., Deering, S., ’First IETF Internet Audiocast’, ACM SIGCOMM
Computer Communication Review, Vol. 22, No. 3, pp. 92-97, 1992.
[8] Prasada, B., Sabri, S., ’Video conference systems’, Proceedings of the IEEE,
Vol. 73, No. 4, pp. 671-688, 1985.
[9] Hughes, L., ’Survey of multicast address handling techniques for Ethernet
communication controllers’, Microprocessors and Microsystems, Vol. 19, No.
9, pp. 563-568, 1989.
[10] Kurose, JF., Pingali, S., Towsley, D., ’A Comparison of sender-initiated and
receiver-initiated reliable multicast protocols’, ACM SIGMETRICS confer-
ence on Measurement and modeling of computer systems, Vol. 22, No. 1, pp.
221-230, 1994.
53
BIBLIOGRAPHY
[12] Gemmell, J., MontGomery, T., Speakman, T., Bhaskar, N., Crowcroft, J.,
’The PGM reliable multicast protocol’, IEEE Network, Vol 17, No. 1, pp.
16-22, 2003.
[13] Deering, S., Estrin, D., Shenker, S., Zappala, D., Zhang, L., ’A new resource
reservation protocol’, IEEE Network, Vol. 7, No. 5, pp. 8-18, 1993.
[14] Postel, J., ’User Datagram Protocol’, RFC 768. [Online]. Available: http:
//www.rfc-editor.org/rfc/rfc768.txt, Aug. 1980.
[16] Leiner, B., ’Critical Issues in High Bandwidth Networking’, RFC 1077, [On-
line]. Available: http://www.rfc-editor.org/rfc/rfc1077.txt, Nov. 1988.
[17] Quinn, B., Almeroth, K., ’IP Multicast Applications: Challenges and So-
lutions’ RFC 3170, [Online]. Available: http://www.rfc-editor.org/rfc/
rfc3170.txt, Sep. 2001.
[18] Speakman, T., Crowcroft, J., Gemmel, J., et al., ’PGM Reliable Trans-
port Protocol Specification’ RFC 3208, [Online]. Available: http://www.
rfc-editor.org/rfc/rfc3208.txt, Dec. 2001.
54
Abbreviations and Terms
Exchange – An organized market which offers services for stock brokers, traders
to trade stocks, bonds, and other securities
OSI model – Is a model uses abstract layers to characterize and standardize in-
ternal functions of a communication system
55
BIBLIOGRAPHY
TCP/IP (DoD) model - Is another model, similar to the OSI model, that uses
abstract layers to characterize and standardize internal functions of a commu-
nication system
56