# source:doc/theses/thierry_delisle_PhD/thesis/text/eval_macro.tex@e378c73

Last change on this file since e378c73 was e378c73, checked in by Thierry Delisle <tdelisle@…>, 4 months ago

Fleshed out some more the evaluation sections, still waiting on some new data for churn nasus, locality nasus and memcached update

• Property mode set to 100644
File size: 14.4 KB
Line
1\chapter{Macro-Benchmarks}\label{macrobench}
2The previous chapter has demonstrated that the scheduler achieves its performance goal in small and controlled scenario.
3The next step is then to demonstrate that this stays true in more realistic and complete scenarios.
4This chapter presents two flavours of webservers that demonstrate that \CFA performs competitively with production environments.
5
6Webservers where chosen because they offer fairly simple applications that are still useful as standalone products.
7Furthermore, webservers are generally amenable to parallelisation since their workloads are mostly homogenous.
8They therefore offer a stringent performance benchmark for \CFA.
9Indeed existing solutions are likely to have close to optimal performance while the homogeneity of the workloads mean the additional fairness is not needed.
10
11\section{Memcached}
12Memcached~\cite{memcached} is an in memory key-value store that is used in many production environments, \eg \cite{atikoglu2012workload}.
13This also server also has the notable added benefit that there exists a full-featured front-end for performance testing called @mutilate@~\cite{GITHUB:mutilate}.
14Experimenting on memcached allows for a simple test of the \CFA runtime as a whole, it will exercise the scheduler, the idle-sleep mechanism, as well the \io subsystem for sockets.
15This experiment does not exercise the \io subsytem with regards to disk operations.
16
17\subsection{Benchmark Environment}
18These experiments are run on a cluster of homogenous Supermicro SYS-6017R-TDF compute nodes with the following characteristics:
19The server runs Ubuntu 20.04.3 LTS on top of Linux Kernel 5.11.0-34.
20Each node has 2 Intel(R) Xeon(R) CPU E5-2620 v2 running at 2.10GHz.
21These CPUs have 6 cores per CPUs and 2 \glspl{hthrd} per core, for a total of 24 \glspl{hthrd}.
22The cpus each have 384 KB, 3 MB and 30 MB of L1, L2 and L3 caches respectively.
23Each node is connected to the network through a Mellanox 10 Gigabit Ethernet port.
24The network route uses 1 Mellanox SX1012 10/40 Gigabit Ethernet cluster switch.
25
27Comparing against memcached using a user-level runtime only really make sense if the server actually uses this threading model.
28Indeed, evaluating a user-level runtime with 1 \at per \proc is not meaningful since it does not exercise the runtime, it simply adds some overhead to the underlying OS scheduler.
29
30One approach is to use a webserver that uses a thread-per-connection model, where each incoming connection is served by a single \at in a strict 1-to-1 pairing.
31This models adds flexibility to the implementation, as the serving logic can now block on user-level primitives without affecting other connections.
32
33Memcached is not built according to a thread-per-connection model, but there exists a port of it that is, which was built for libfibre in \cite{DBLP:journals/pomacs/KarstenB20}.
34Therefore this version can both be compared to the original version and to a port to the \CFA runtime.
35
36As such, this memcached experiment compares 3 different varitions of memcached:
37\begin{itemize}
38 \item \emph{vanilla}: the official release of memcached, version~1.6.9.
39 \item \emph{fibre}: a modification of vanilla which uses the thread per connection model on top of the libfibre runtime~\cite{DBLP:journals/pomacs/KarstenB20}.
40 \item \emph{cfa}: a modification of the fibre webserver that replaces the libfibre runtime with \CFA.
41\end{itemize}
42
43\subsection{Throughput} \label{memcd:tput}
44\begin{figure}
45        \centering
46        \input{result.memcd.rate.qps.pstex_t}
47        \caption[Memcached Benchmark: Throughput]{Memcached Benchmark: Throughput\smallskip\newline Desired vs Actual request rate for 15360 connections. Target QPS is the request rate that the clients are attempting to maintain and Actual QPS is the rate at which the server is able to respond.}
48        \label{fig:memcd:rate:qps}
49\end{figure}
50Figure~\ref{fig:memcd:rate:qps} shows the result for the throughput of all three webservers.
51This experiment is done by having the clients establish 15360 total connections, which persist for the duration of the experiments.
52The clients then send requests, attempting to follow a desired request rate.
53The servers respond to the desired rate as best they can and the difference between desired rate, Target \underline{Q}ueries \underline{P}er \underline{S}econd'', and the actual rate, Actual QPS''.
54The results show that \CFA achieves equivalent throughput even when the server starts to reach saturation.
55Only then does it start to fall behind slightly.
56This is a demonstration of the \CFA runtime achieving its performance goal.
57
58\subsection{Tail Latency}
59\begin{figure}
60        \centering
61        \input{result.memcd.rate.99th.pstex_t}
62        \caption[Memcached Benchmark : 99th Percentile Lantency]{Memcached Benchmark : 99th Percentile Lantency\smallskip\newline 99th Percentile of the response latency as a function of \emph{desired} request rate for 15360 connections. }
63        \label{fig:memcd:rate:tail}
64\end{figure}
65Another important performance metric to look at is \newterm{tail} latency.
66Since many web applications rely on a combination of different requests made in parallel, the latency of the slowest response, \ie tail latency, can dictate overall performance.
67Figure~\ref{fig:memcd:rate:tail} shows the 99th percentile latency results for the same experiment memcached experiment.
68As is expected, the latency starts low and increases as the server gets close to saturation, point at which the latency increses dramatically.
69Note that the figure shows \emph{target} request rate, the actual response rate is given in Figure~\ref{fig:memcd:rate:qps} as this is the same underlying experiment.
70
71\subsection{Update rate}
72\begin{figure}
73        \centering
74        \subfloat[][Throughput]{
75                \input{result.memcd.forall.qps.pstex_t}
76        }
77
78        \subfloat[][Latency]{
79                \input{result.memcd.forall.lat.pstex_t}
80        }
81        \caption[forall Latency results at different update rates]{forall Latency results at different update rates\smallskip\newline Description}
82        \label{fig:memcd:updt:forall}
83\end{figure}
84
85\begin{figure}
86        \centering
87        \subfloat[][Throughput]{
88                \input{result.memcd.fibre.qps.pstex_t}
89        }
90
91        \subfloat[][Latency]{
92                \input{result.memcd.fibre.lat.pstex_t}
93        }
94        \caption[fibre Latency results at different update rates]{fibre Latency results at different update rates\smallskip\newline Description}
95        \label{fig:memcd:updt:fibre}
96\end{figure}
97
98\begin{figure}
99        \centering
100        \subfloat[][Throughput]{
101                \input{result.memcd.vanilla.qps.pstex_t}
102        }
103
104        \subfloat[][Latency]{
105                \input{result.memcd.vanilla.lat.pstex_t}
106        }
107        \caption[vanilla Latency results at different update rates]{vanilla Latency results at different update rates\smallskip\newline Description}
108        \label{fig:memcd:updt:vanilla}
109\end{figure}
110
111
112
113\section{Static Web-Server}
114The memcached experiment has two aspects of the \io subsystem it does not exercise, accepting new connections and interacting with disks.
115On the other hand, static webservers, servers that offer static webpages, do stress disk \io since they serve files from disk\footnote{Dynamic webservers, which construct pages as they are sent, are not as interesting since the construction of the pages do not exercise the runtime in a meaningfully different way.}.
116The static webserver experiments will compare NGINX~\cit{nginx} with a custom webserver developped for this experiment.
117
118\subsection{\CFA webserver}
119Unlike the memcached experiment, the webserver experiment relies on a custom designed webserver.
120It is a simple thread-per-connection webserver where a fixed number of \ats are created upfront.
121Each of the \at calls @accept@, through @io_uring@, on the listening port and handle the incomming connection once accepted.
122Most of the implementation is fairly straight forward however the inclusion of file \io introduces a new challenge that had to be hacked around.
123
124Normally, webservers use @sendfile@\cite{MAN:sendfile} to send files over the socket.
125@io_uring@ does not support @sendfile@, it supports @splice@\cite{MAN:splice} instead, which is strictly more powerful.
126However, because of how linux implements file \io, see Subsection~\ref{ononblock}, @io_uring@'s implementation must delegate calls to splice to worker threads inside the kernel.
127As of Linux 5.13, @io_uring@ caps the numer of these worker threads to @RLIMIT_NPROC@ and therefore, when tens of thousands of splice requests are made, it can create tens of thousands of \glspl{kthrd}.
128Such a high number of \glspl{kthrd} is more than Linux can handle in this scenario so performance suffers significantly.
129For this reason, the \CFA webserver calls @sendfile@ directly.
130This approach works up to a certain point, but once the server approaches saturation, it leads to a new problem.
131
132When the saturation point of the server is attained, latency will increase and inevitably some client connections will timeout.
133As these clients close there connections, the server must close these sockets without delay so the OS can reclaim the resources used by these connections.
134Indeed, until they are closed on the server end, the connection will linger in the CLOSE-WAIT tcp state~\cite{rfc:tcp} and the tcp buffers will be preserved.
135However, this poses a problem using blocking @sendfile@ calls.
136The calls can block if they do not have suffcient memory, which can be caused by having too many connections in the CLOSE-WAIT state.
137Since blocking in calls to @sendfile@ blocks the \proc rather than the \at, this prevents other connections from closing their sockets.
138This leads to a vicious cycle where timeouts lead to @sendfile@ calls running out of resources, which lead to more timeouts.
139
140Normally, this is address by marking the sockets as non-blocking and using @epoll@ to wait for sockets to have sufficient resources.
141However, since @io_uring@ respects non-blocking semantics marking all sockets as non-blocking effectively circumvents the @io_uring@ subsystem entirely.
142For this reason, the \CFA webserver sets and resets the @O_NONBLOCK@ flag before and after any calls to @sendfile@.
143Normally @epoll@ would also be used when these calls to @sendfile@ return @EAGAIN@, but since this would not help in the evaluation of the \CFA runtime, the \CFA webserver simply yields and retries in these cases.
144
145It is important to state that in Linux 5.15 @io_uring@ introduces the ability for users to limit the number of worker threads that are created, through the @IORING_REGISTER_IOWQ_MAX_WORKERS@ option.
146However, as of writing this document Ubuntu does not have a stable release of Linux 5.15.
147There exists versions of the kernel that are currently under testing, but these caused unrelated but nevertheless prohibitive issues in this experiment.
148Presumably, the new kernel would remove the need for the hack described above, as it would allow connections in the CLOSE-WAIT state to be closed even while the calls to @splice@/@sendfile@ are underway.
149However, since this could not be tested, this is purely a conjecture at this point.
150
151\subsection{Benchmark Environment}
152Unlike the memcached experiment, the webserver run on a more heterogenous environment.
153The server runs Ubuntu 20.04.4 LTS on top of Linux Kernel 5.13.0-52.
154It has an AMD Opteron(tm) Processor 6380 running at 2.50GHz.
155These CPUs has only 8 \glspl{hthrd} enabled by grub, which is sufficient to achieve line rate.
156This cpus each have 64 KB, 256 KiB and 8 MB of L1, L2 and L3 caches respectively.
157The kernel is setup to limit the memory at 25Gb.
158
159The client machines each have two 2.8 GHz Xeon CPUs, and four one-gigabit Ethernet cards.
160Each client machine runs two copies of the workload generator.
161They run a 2.6.11-1 SMP Linux kernel, which permits each client load-generator to run on a separate CPU.
162Since the clients outnumber the server 8-to-1, this is plenty sufficient to generate enough load for the clients not to become the bottleneck.
163
164\todo{switch}
165
166\subsection{Throughput}
167To measure the throughput of both webservers, each server is loaded with over 30,000 files making over 4.5 Gigabytes in total.
168Each client runs httperf~\cit{httperf} which establishes a connection, does an http request for one or more files, closes the connection and repeats the process.
169The connections and requests are made according to a Zipfian distribution~\cite{zipf}.
170Throughput is measured by aggregating the results from httperf of all the clients.
171\begin{figure}
172        \subfloat[][Throughput]{
173                \input{result.swbsrv.25gb.pstex_t}
174                \label{fig:swbsrv:ops}
175        }
176
177        \subfloat[][Rate of Errors]{
178                \input{result.swbsrv.25gb.err.pstex_t}
179                \label{fig:swbsrv:err}
180        }
181        \caption[Static Webserver Benchmark : Throughput]{Static Webserver Benchmark : Throughput\smallskip\newline Throughput vs request rate for short lived connections connections.}
182        \label{fig:swbsrv}
183\end{figure}
184Figure~\ref{fig:swbsrv} shows the results comparing \CFA to NGINX in terms of throughput.
185These results are fairly straight forward.
186Both servers achieve the same throughput until around 57,500 requests per seconds.
187Since the clients are asking for the same files, the fact that the throughput matches exactly is expected as long as both servers are able to serve the desired rate.
188Once the saturation point is reached, both servers are still very close.
189NGINX achieves slightly better throughtput.
190However, Figure~\ref{fig:swbsrv:err} shows the rate of errors, a gross approximation of tail latency, where \CFA achives notably fewet errors once the machine reaches saturation.
191This suggest that \CFA is slightly more fair and NGINX may sloghtly sacrifice some fairness for improved throughtput.
192It demonstrate that the \CFA webserver described above is able to match the performance of NGINX up-to and beyond the saturation point of the machine.
193
194\subsection{Disk Operations}
195The throughput was made using a server with 25gb of memory, this was sufficient to hold the entire fileset in addition to all the code and data needed to run the webserver and the reste of the machine.
196Previous work like \cit{Cite Ashif's stuff} demonstrate that an interesting follow-up experiment is to rerun the same throughput experiment but allowing significantly less memory on the machine.
197If the machine is constrained enough, it will force the OS to evict files from the file cache and cause calls to @sendfile@ to have to read from disk.
198However, what these low memory experiments demonstrate is how the memory footprint of the webserver affects the performance.
199However, since what I am to evaluate in this thesis is the runtime of \CFA, I diceded to forgo experiments on low memory server.
200The implementation of the webserver itself is simply too impactful to be an interesting evaluation of the underlying runtime.
Note: See TracBrowser for help on using the repository browser.