Index: doc/theses/thierry_delisle_PhD/thesis/local.bib
===================================================================
--- doc/theses/thierry_delisle_PhD/thesis/local.bib	(revision 31b9d3c500e5550cc1127210f69a12736a26ab4d)
+++ doc/theses/thierry_delisle_PhD/thesis/local.bib	(revision a8dd247774520c308c44392d2c58d5b32cd07dee)
@@ -555,5 +555,12 @@
   title = {Mach Scheduling and Thread Interfaces - Kernel Programming Guide},
   organization = {Apple Inc.},
-  howPublish = {\href{https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html}{https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html}}
+  note = {\href{https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html}{https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html}}
+}
+
+@misc{MemcachedThreading,
+  author = {Oracle},
+  title = {MySQL 5.6 Reference Manual Including MySQL NDB Cluster 7.3-7.4 Reference Guide},
+  howpublished = {\href{https://docs.oracle.com/cd/E17952_01/mysql-5.6-en/ha-memcached-using-threads.html}{https://docs.oracle.com/\-cd/E17952\_01/\-mysql-5.6-en/\-ha-memcached-using-threads.html}},
+  note = "[Online; accessed 5-August-2022]"
 }
 
@@ -991,2 +998,23 @@
   note = "[Online; accessed 5-August-2022]"
 }
+
+@article{reese2008nginx,
+    title	= {NGINX: the high-performance web server and reverse proxy},
+    author	= {Reese, Will},
+    journal	= {Linux Journal},
+    volume	= {2008},
+    number	= {173},
+    pages	= {2},
+    year	= {2008},
+    publisher	= {Belltown Media}
+}
+
+@phdthesis{Harji10,
+    author	= {Ashif Harji},
+    title	= {Performance Comparison of Uniprocessor and Multiprocessor Web Server Architectures},
+    school	= {University of Waterloo},
+    year	= 2010,
+    month	= feb,
+    address	= {Waterloo, Ontario, Canada, N2L 3G1},
+    note	= {\textsf{http://uwspace.uwaterloo.ca/\-bitstream/\-10012/\-5040/\-1/\-Harji\_thesis.pdf}},
+}
Index: doc/theses/thierry_delisle_PhD/thesis/text/eval_macro.tex
===================================================================
--- doc/theses/thierry_delisle_PhD/thesis/text/eval_macro.tex	(revision 31b9d3c500e5550cc1127210f69a12736a26ab4d)
+++ doc/theses/thierry_delisle_PhD/thesis/text/eval_macro.tex	(revision a8dd247774520c308c44392d2c58d5b32cd07dee)
@@ -8,5 +8,5 @@
 Therefore, webservers offer a stringent performance benchmark for \CFA.
 Indeed, existing webservers have close to optimal performance, while the homogeneity of the workload means fairness may not be a problem.
-As such, these experiments should highlight the overhead tue to any \CFA fairness cost in realistic scenarios.
+As such, these experiments should highlight the overhead due to any \CFA fairness cost in realistic scenarios.
 
 \section{Memcached}
@@ -24,9 +24,9 @@
 Each node has 2 Intel(R) Xeon(R) CPU E5-2620 v2 running at 2.10GHz.
 \item
-These CPUs have 6 cores per CPUs and 2 \glspl{hthrd} per core, for a total of 24 \glspl{hthrd}.
-\item
-The CPUs each have 384 KB, 3 MB and 30 MB of L1, L2 and L3 caches respectively.
-\item
-Each node is connected to the network through a Mellanox 10 Gigabit Ethernet port.
+Each CPU has 6 cores and 2 \glspl{hthrd} per core, for a total of 24 \glspl{hthrd}.
+\item
+A CPU has 384 KB, 3 MB and 30 MB of L1, L2 and L3 caches, respectively.
+\item
+The compute nodes are connected to the network through a Mellanox 10 Gigabit Ethernet port.
 \item
 Network routing is performed by a Mellanox SX1012 10/40 Gigabit Ethernet switch.
@@ -35,5 +35,5 @@
 \subsection{Memcached threading}\label{memcd:thrd}
 Memcached can be built to use multiple threads in addition to its @libevent@ subsystem to handle requests.
-When enabled, the threading implementation operates as follows~\cite{https://docs.oracle.com/cd/E17952_01/mysql-5.6-en/ha-memcached-using-threads.html}:
+When enabled, the threading implementation operates as follows~\cite[\S~16.2.2.8]{MemcachedThreading}:
 \begin{itemize}
 \item
@@ -99,5 +99,5 @@
 	\centering
 	\resizebox{0.83\linewidth}{!}{\input{result.memcd.rate.99th.pstex_t}}
-	\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} query rate for 15,360 connections. }
+	\caption[Memcached Benchmark : 99th Percentile Latency]{Memcached Benchmark : 99th Percentile Latency\smallskip\newline 99th Percentile of the response latency as a function of \emph{desired} query rate for 15,360 connections. }
 	\label{fig:memcd:rate:tail}
 \end{figure}
@@ -180,12 +180,27 @@
 
 \subsection{NGINX threading}
-Like memcached, NGINX can be makde to use multiple \glspl{kthrd}.
-It has a very similar architecture to the memcached architecture decscribed in Section~\ref{memcd:thrd}, where multiple \glspl{kthrd} each run a mostly independent network logic.
-While it does not necessarily use a dedicated listening thread, each connection is arbitrarily assigned to one of the \newterm{worker} threads.
-Each worker threads handles multiple connections exclusively, effectively dividing the connections into distinct sets.
-Again, this is effectively the \emph{event-based server} approach.
-
-\cit{https://www.nginx.com/blog/inside-nginx-how-we-designed-for-performance-scale/}
-
+% Like memcached, NGINX can be made to use multiple \glspl{kthrd}.
+% It has a very similar architecture to the memcached architecture described in Section~\ref{memcd:thrd}, where multiple \glspl{kthrd} each run a mostly independent network logic.
+% While it does not necessarily use a dedicated listening thread, each connection is arbitrarily assigned to one of the \newterm{worker} threads.
+% Each worker thread handles multiple connections exclusively, effectively dividing the connections into distinct sets.
+% Again, this is effectively the \emph{event-based server} approach.
+% 
+% \cit{https://www.nginx.com/blog/inside-nginx-how-we-designed-for-performance-scale/}
+
+NGINX 1.13.7 is an high-performance, \emph{full-service}, event-driven, with multiple operating-system processes or multiple kernel-threads within a process to handle blocking I/O.
+It can also serve as a reverse proxy and a load balancer~\cite{reese2008nginx}.
+Concurrent connections are handled using a complex event-driven architecture.
+The NGINX server runs a master process that performs operations such as reading configuration files, binding to ports, and controlling worker processes.
+NGINX uses a disk-based cache for performance, and assigns a dedicated process to manage the cache.
+This process, known as the \textit{cache manager}, is spun-off by the master process.
+Additionally, there can be many \textit{worker processes}, each handling network connections, reading and writing disk files, and communicating with upstream servers, such as reverse proxies or databases.
+
+A worker is a single-threaded process, running independently of other workers.
+The worker process handles new incoming connections and processes them.
+Workers communicate using shared memory for shared cache and session data, and other shared resources.
+Each worker assigns incoming connections to an HTTP state-machine.
+As in a typical event-driven architecture, the worker listens for events from the clients, and responds immediately without blocking.
+Memory use in NGINX is very conservative, because it does not spin up a new process or thread per connection, like Apache~\cite{apache} or \CFA.
+All operations are asynchronous -- implemented using event notifications, callback functions and fine-tuned timers.
 
 \subsection{\CFA webserver}
@@ -197,14 +212,14 @@
 Normally, webservers use @sendfile@~\cite{MAN:sendfile} to send files over a socket because it performs a direct move in the kernel from the file-system cache to the NIC, eliminating reading/writing the file into the webserver.
 While @io_uring@ does not support @sendfile@, it does supports @splice@~\cite{MAN:splice}, which is strictly more powerful.
-However, because of how Linux implements file \io, see Subsection~\ref{ononblock}, @io_uring@ must delegate splice calls to worker threads inside the kernel.
+However, because of how Linux implements file \io, see Subsection~\ref{ononblock}, @io_uring@ must delegate splice calls to worker threads \emph{inside} the kernel.
 As of Linux 5.13, @io_uring@ had no mechanism to restrict the number of worker threads, and therefore, when tens of thousands of splice requests are made, it correspondingly creates tens of thousands of internal \glspl{kthrd}.
 Such a high number of \glspl{kthrd} slows Linux significantly.
 Rather than abandon the experiment, the \CFA webserver was switched to @sendfile@.
 
-With a blocking @sendfile@ the \CFA achieves acceptable performance until saturation is reached.
-At saturation, latency increases so some client connections timeout.
+Starting with \emph{blocking} @sendfile@, \CFA achieves acceptable performance until saturation is reached.
+At saturation, latency increases and client connections begin to timeout.
 As these clients close their connection, the server must close its corresponding side without delay so the OS can reclaim the resources used by these connections.
 Indeed, until the server connection is closed, the connection lingers in the CLOSE-WAIT TCP state~\cite{rfc:tcp} and the TCP buffers are preserved.
-However, this poses a problem using nonblocking @sendfile@ calls:
+However, this poses a problem using blocking @sendfile@ calls:
 when @sendfile@ blocks, the \proc rather than the \at blocks, preventing other connections from closing their sockets.
 The call can block if there is insufficient memory, which can be caused by having too many connections in the CLOSE-WAIT state.\footnote{
@@ -212,31 +227,33 @@
 This effect results in a negative feedback where more timeouts lead to more @sendfile@ calls running out of resources.
 
-Normally, this is address by using @select@/@epoll@ to wait for sockets to have sufficient resources.
-However, since @io_uring@ respects nonblocking semantics, marking all sockets as non-blocking effectively circumvents the @io_uring@ subsystem entirely:
-all calls would simply immediately return @EAGAIN@ and all asynchronicity would be lost.
-
+Normally, this problem is address by using @select@/@epoll@ to wait for sockets to have sufficient resources.
+However, since @io_uring@ does not support @sendfile@ but does respects non\-blocking semantics, marking all sockets as non-blocking effectively circumvents the @io_uring@ subsystem entirely:
+all calls simply immediately return @EAGAIN@ and all asynchronicity is lost.
+
+Switching all of the \CFA runtime to @epoll@ for this experiment is unrealistic and does not help in the evaluation of the \CFA runtime.
 For this reason, the \CFA webserver sets and resets the @O_NONBLOCK@ flag before and after any calls to @sendfile@.
 However, when the nonblocking @sendfile@ returns @EAGAIN@, the \CFA server cannot block the \at because its I/O subsystem uses @io_uring@.
-Therefore, the \at must spin performing the @sendfile@ and yield if the call returns @EAGAIN@.
-Normally @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.
-
-Interestingly, Linux 5.15 @io_uring@ introduces the ability to limit the number of worker threads that are created, through the @IORING_REGISTER_IOWQ_MAX_WORKERS@ option.
-Presumably, this limit could prevent the explosion of \glspl{kthrd} which justified using @sendfile@ over @io_uring@ and @splice@.
+Therefore, the \at spins performing the @sendfile@, yields if the call returns @EAGAIN@, and retries in these cases.
+
+Interestingly, Linux 5.15 @io_uring@ introduces the ability to limit the number of worker threads that are created through the @IORING_REGISTER_IOWQ_MAX_WORKERS@ option.
+Presumably, this limit would prevent the explosion of \glspl{kthrd}, which justified using @sendfile@ over @io_uring@ and @splice@.
 However, recall from Section~\ref{iouring} that @io_uring@ maintains two pools of workers: bounded workers and unbounded workers.
-In the particular case of the webserver, we would want the unbounded workers to handle accepts and reads on socket and bounded workers to handle reading the files from disk.
-This would allow fine grained countrol over the number of workers needed for each operation type and would presumably lead to good performance.
+For a webserver, the unbounded workers should handle accepts and reads on socket, and the bounded workers should handle reading files from disk.
+This setup allows fine-grained control over the number of workers needed for each operation type and presumably lead to good performance.
+
 However, @io_uring@ must contend with another reality of Linux: the versatility of @splice@.
-Indeed, @splice@ can be used both for reading and writing, to or from any type of file descriptor.
-This makes it more ambiguous which pool @io_uring@ should delegate @splice@ calls to.
-In the case of splicing from a socket to pipe, @splice@ will behave like an unbounded operation, but when splicing from a regular file to a pipe, @splice@ becomes a bounded operation.
-To make things more complicated, @splice@ can read from a pipe and write out to a regular file.
+Indeed, @splice@ can be used both for reading and writing to or from any type of file descriptor.
+This generality makes it ambiguous which pool @io_uring@ should delegate @splice@ calls to.
+In the case of splicing from a socket to pipe, @splice@ behaves like an unbounded operation, but when splicing from a regular file to a pipe, @splice@ becomes a bounded operation.
+To make things more complicated, @splice@ can read from a pipe and write to a regular file.
 In this case, the read is an unbounded operation but the write is a bounded one.
 This leaves @io_uring@ in a difficult situation where it can be very difficult to delegate splice operations to the appropriate type of worker.
-Since there is little to no context available to @io_uring@, I believe it makes the decision to always delegate @splice@ operations to the unbounded workers.
-This is unfortunate for this specific experiment, since it prevents the webserver from limiting the number of calls to @splice@ happening in parallel without affecting the performance of @read@ or @accept@.
+Since there is little or no context available to @io_uring@, it seems to always delegate @splice@ operations to the unbounded workers.
+This decision is unfortunate for this specific experiment, since it prevents the webserver from limiting the number of parallel calls to @splice@ without affecting the performance of @read@ or @accept@.
 For this reason, the @sendfile@ approach described above is still the most performant solution in Linux 5.15.
 
-Note that it could be possible to workaround this problem, for example by creating more @io_uring@ instances so @splice@ operations can be issued to a different instance than the @read@ and @accept@ operations.
-However, I do not believe this solution is appropriate in general, it simply replaces a hack in the webserver with a different, equivalent hack.
+One possible workaround is to create more @io_uring@ instances so @splice@ operations can be issued to a different instance than the @read@ and @accept@ operations.
+However, I do not believe this solution is appropriate in general;
+it simply replaces my current webserver hack with a different, equivalent hack.
 
 \subsection{Benchmark Environment}
@@ -246,9 +263,9 @@
 The server runs Ubuntu 20.04.4 LTS on top of Linux Kernel 5.13.0-52.
 \item
-It has an AMD Opteron(tm) Processor 6380 running at 2.5GHz.
+The server computer has four AMD Opteron(tm) Processor 6380 with 16 cores running at 2.5GHz, for a total of 64 \glspl{hthrd}.
+\item
+The computer is booted with only 8 CPUs enabled, which is sufficient to achieve line rate.
 \item
 Each CPU has 64 KB, 256 KiB and 8 MB of L1, L2 and L3 caches respectively.
-\item
-The computer is booted with only 8 CPUs enabled, which is sufficient to achieve line rate.
 \item
 The computer is booted with only 25GB of memory to restrict the file-system cache.
@@ -277,5 +294,5 @@
 
 The experiments are run with 16 clients, each running a copy of httperf (one copy per CPU), requiring a set of 16 log files with requests conforming to a Zipf distribution.
-This distribution is representative of users accessing static data through a web-browser.
+This distribution is representative of users accessing static data through a web browser.
 Each request reads a file name from its trace, establishes a connection, performs an HTTP get-request for the file name, receive the file data, close the connection, and repeat the process.
 Some trace elements have multiple file names that are read across a persistent connection.
@@ -287,5 +304,5 @@
 Server throughput is measured both at peak and after saturation (\ie after peak).
 Peak indicates the level of client requests the server can handle and after peak indicates if a server degrades gracefully.
-Throughput is measured by aggregating the results from httperf of all the clients.
+Throughput is measured by aggregating the results from httperf for all the clients.
 
 This experiment can be done for two workload scenarios by reconfiguring the server with different amounts of memory: 25 GB and 2.5 GB.
@@ -305,39 +322,44 @@
 \end{table}
 
+\begin{figure}
+	\centering
+	\subfloat[][Throughput]{
+		\resizebox{0.85\linewidth}{!}{\input{result.swbsrv.25gb.pstex_t}}
+		\label{fig:swbsrv:ops}
+	}
+
+	\subfloat[][Rate of Errors]{
+		\resizebox{0.85\linewidth}{!}{\input{result.swbsrv.25gb.err.pstex_t}}
+		\label{fig:swbsrv:err}
+	}
+	\caption[Static Webserver Benchmark : Throughput]{Static Webserver Benchmark : Throughput\smallskip\newline Throughput vs request rate for short lived connections connections.}
+	\label{fig:swbsrv}
+\end{figure}
+
 Figure~\ref{fig:swbsrv} shows the results comparing \CFA to NGINX in terms of throughput.
 These results are fairly straightforward.
 Both servers achieve the same throughput until around 57,500 requests per seconds.
-Since 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.
+Since 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 request rate.
 Once the saturation point is reached, both servers are still very close.
 NGINX achieves slightly better throughput.
-However, Figure~\ref{fig:swbsrv:err} shows the rate of errors, a gross approximation of tail latency, where \CFA achieves notably fewer errors once the machine reaches saturation.
-This suggest that \CFA is slightly more fair and NGINX may slightly sacrifice some fairness for improved throughput.
-It 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.
-
-\begin{figure}
-	\subfloat[][Throughput]{
-		\resizebox{0.85\linewidth}{!}{\input{result.swbsrv.25gb.pstex_t}}
-		\label{fig:swbsrv:ops}
-	}
-
-	\subfloat[][Rate of Errors]{
-		\resizebox{0.85\linewidth}{!}{\input{result.swbsrv.25gb.err.pstex_t}}
-		\label{fig:swbsrv:err}
-	}
-	\caption[Static Webserver Benchmark : Throughput]{Static Webserver Benchmark : Throughput\smallskip\newline Throughput vs request rate for short lived connections connections.}
-	\label{fig:swbsrv}
-\end{figure}
+However, Figure~\ref{fig:swbsrv:err} shows the rate of errors, a gross approximation of tail latency, where \CFA achieves notably fewer errors once the servers reach saturation.
+This suggests \CFA is slightly fairer with less throughput, while NGINX sacrifice fairness for more throughput.
+This experiment demonstrate that the \CFA webserver is able to match the performance of NGINX up-to and beyond the saturation point of the machine.
 
 \subsection{Disk Operations}
-The 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 rest of the machine.
-Previous 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.
-If 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.
-However, in this configuration, the problem with @splice@ and @io_uring@ rears its ugly head again.
+With 25GB of memory, the entire experimental file-set plus the webserver and OS fit in memory.
+If memory is constrained, the OS must evict files from the file cache, which causes @sendfile@ to read from disk.\footnote{
+For the in-memory experiments, the file-system cache was warmed by running an experiment three times before measuring started to ensure all files are in the file-system cache.}
+Webservers can behave very differently once file I/O begins and increases.
+Hence, prior work~\cite{Harji10} suggests running both kinds of experiments to test overall webserver performance.
+
+However, after reducing memory to 2.5GB, the problem with @splice@ and @io_uring@ rears its ugly head again.
 Indeed, in the in-memory configuration, replacing @splice@ with calls to @sendfile@ works because the bounded side basically never blocks.
 Like @splice@, @sendfile@ is in a situation where the read side requires bounded blocking, \eg reading from a regular file, while the write side requires unbounded blocking, \eg blocking until the socket is available for writing.
-The unbounded side can be handled by yielding when it returns @EAGAIN@ like mentioned above, but this trick does not work for the bounded side.
+The unbounded side can be handled by yielding when it returns @EAGAIN@, as mentioned above, but this trick does not work for the bounded side.
 The only solution for the bounded side is to spawn more threads and let these handle the blocking.
 
 Supporting this case in the webserver would require creating more \procs or creating a dedicated thread-pool.
-However, since what I am to evaluate in this thesis is the runtime of \CFA, I decided to forgo experiments on low memory server.
-The implementation of the webserver itself is simply too impactful to be an interesting evaluation of the underlying runtime.
+However, I felt this kind of modification moves to far away from my goal of evaluating the \CFA runtime, \ie it begins writing another runtime system;
+hence, I decided to forgo experiments on low-memory performance.
+% The implementation of the webserver itself is simply too impactful to be an interesting evaluation of the underlying runtime.
