- Timestamp:
- Sep 19, 2022, 8:11:02 PM (3 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, stuck-waitfor-destruct
- Children:
- aa9f215
- Parents:
- ebf8ca5 (diff), ae1d151 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/thierry_delisle_PhD/thesis/text/eval_micro.tex
rebf8ca5 r23a08aa0 4 4 This chapter presents five different experimental setups for evaluating the basic features of the \CFA, libfibre~\cite{libfibre}, Go, and Tokio~\cite{Tokio} schedulers. 5 5 All of these systems have a \gls{uthrding} model. 6 The goal in this chapter is show the \CFA scheduler obtains equivalent performance to other less fairschedulers through the different experiments.7 Note ,only the code of the \CFA tests is shown;8 all tests in the other systems are functionally identical and available online~\cite{ SchedulingBenchmarks}.6 The goal of this chapter is to show that the \CFA scheduler obtains equivalent performance to other, less fair, schedulers through the different experiments. 7 Note that only the code of the \CFA tests is shown; 8 all tests in the other systems are functionally identical and available online~\cite{GITHUB:SchedulingBenchmarks}. 9 9 10 10 \section{Benchmark Environment}\label{microenv} … … 13 13 \begin{description} 14 14 \item[AMD] is a server with two AMD EPYC 7662 CPUs and 256GB of DDR4 RAM. 15 The EPYC CPU has 64 cores with 2 \glspl{hthrd} per core, for 128 \glspl{hthrd} per socket with 2 sockets for a total of 256 \glspl{hthrd}.15 The EPYC CPU has 64 cores with 2 \glspl{hthrd} per core, for a total of 128 \glspl{hthrd} per socket with 2 sockets for a total of 256 \glspl{hthrd}. 16 16 Each CPU has 4 MB, 64 MB and 512 MB of L1, L2 and L3 caches, respectively. 17 Each L1 and L2 instance areonly shared by \glspl{hthrd} on a given core, but each L3 instance is shared by 4 cores, therefore 8 \glspl{hthrd}.17 Each L1 and L2 instance is only shared by \glspl{hthrd} on a given core, but each L3 instance is shared by 4 cores, therefore 8 \glspl{hthrd}. 18 18 The server runs Ubuntu 20.04.2 LTS on top of Linux Kernel 5.8.0-55. 19 19 … … 25 25 \end{description} 26 26 27 For all benchmarks, @taskset@ is used to limit the experiment to 1 NUMA node with no hyper threading.27 For all benchmarks, @taskset@ is used to limit the experiment to 1 NUMA node with no hyperthreading. 28 28 If more \glspl{hthrd} are needed, then 1 NUMA node with hyperthreading is used. 29 29 If still more \glspl{hthrd} are needed, then the experiment is limited to as few NUMA nodes as needed. … … 32 32 On AMD, the same algorithm is used, but the machine only has 2 sockets. 33 33 So hyperthreading\footnote{ 34 Hyperthreading normally refers specifically to the technique used by Intel, however it is often used generically to refer to any equivalent feature.}35 is used when the \proc count reach 65 and 193.36 37 The limited sharing of the last-level cache on the AMD machine is markedly different thanthe Intel machine.34 Hyperthreading normally refers specifically to the technique used by Intel, however, it is often used generically to refer to any equivalent feature.} 35 is used when the \proc count reaches 65 and 193. 36 37 The limited sharing of the last-level cache on the AMD machine is markedly different from the Intel machine. 38 38 Indeed, while on both architectures L2 cache misses that are served by L3 caches on a different CPU incur a significant latency, on the AMD it is also the case that cache misses served by a different L3 instance on the same CPU also incur high latency. 39 39 … … 42 42 Each experiment is run 15 times varying the number of processors depending on the two different computers. 43 43 All experiments gather throughput data and secondary data for scalability or latency. 44 The data is graphed using a solid and two dashed lines representing the median, maximum and minimum resultrespectively, where the minimum/maximum lines are referred to as the \emph{extremes}.\footnote{44 The data is graphed using a solid, a dashed, and a dotted line, representing the median, maximum and minimum results respectively, where the minimum/maximum lines are referred to as the \emph{extremes}.\footnote{ 45 45 An alternative display is to use error bars with min/max as the bottom/top for the bar. 46 46 However, this approach is not truly an error bar around a mean value and I felt the connected lines are easier to read.} … … 48 48 49 49 For each experiment, four graphs are generated showing traditional throughput on the top row and \newterm{scalability} or \newterm{latency} on the bottom row (peek ahead to Figure~\ref{fig:cycle:jax}). 50 Scalability uses the same data as throughput but the Y axis is calculated as the number of \procs over the throughput.50 Scalability uses the same data as throughput but the Y-axis is calculated as the number of \procs over the throughput. 51 51 In this representation, perfect scalability should appear as a horizontal line, \eg, if doubling the number of \procs doubles the throughput, then the relation stays the same. 52 52 53 The left column shows results for 100 cycles per \proc, enough cyclesto always keep every \proc busy.54 The right column shows results for 1 cycleper \proc, where the ready queues are expected to be near empty most of the time.55 The distinction between 100 and 1 cycles is meaningful because the idle sleep subsystem is expected to matter only in the right column, where spurious effects can cause a \proc to run out of work temporarily.53 The left column shows results for hundreds of \ats per \proc, enough to always keep every \proc busy. 54 The right column shows results for very few \ats per \proc, where the ready queues are expected to be near empty most of the time. 55 The distinction between many and few \ats is meaningful because the idle sleep subsystem is expected to matter only in the right column, where spurious effects can cause a \proc to run out of work temporarily. 56 56 57 57 \section{Cycle} … … 62 62 Hence, systems that perform this optimization have an artificial performance benefit because the yield becomes a \emph{nop}. 63 63 For this reason, I designed a different push/pop benchmark, called \newterm{Cycle Benchmark}. 64 This benchmark arranges a number of\ats into a ring, as seen in Figure~\ref{fig:cycle}, where the ring is a circular singly-linked list.65 At runtime, each \at unparks the next \at before parkingitself.66 Unparking the next \at pushes that \at onto the ready queue while the ensuing park leads to a \at being popped from the ready queue.64 This benchmark arranges several \ats into a ring, as seen in Figure~\ref{fig:cycle}, where the ring is a circular singly-linked list. 65 At runtime, each \at unparks the next \at before \glslink{atblock}{parking} itself. 66 Unparking the next \at pushes that \at onto the ready queue while the ensuing \park leads to a \at being popped from the ready queue. 67 67 68 68 \begin{figure} 69 69 \centering 70 70 \input{cycle.pstex_t} 71 \caption[Cycle benchmark]{Cycle benchmark\smallskip\newline Each \at unparks the next \at in the cycle before parkingitself.}71 \caption[Cycle benchmark]{Cycle benchmark\smallskip\newline Each \at unparks the next \at in the cycle before \glslink{atblock}{parking} itself.} 72 72 \label{fig:cycle} 73 73 \end{figure} 74 74 75 75 Therefore, the underlying runtime cannot rely on the number of ready \ats staying constant over the duration of the experiment. 76 In fact, the total number of \ats waiting on the ready queue is expected to vary because of the race between the next \at unparking and the current \at parking.76 In fact, the total number of \ats waiting on the ready queue is expected to vary because of the race between the next \at \glslink{atsched}{unparking} and the current \at \glslink{atblock}{parking}. 77 77 That is, the runtime cannot anticipate that the current task immediately parks. 78 78 As well, the size of the cycle is also decided based on this race, \eg a small cycle may see the chain of unparks go full circle before the first \at parks because of time-slicing or multiple \procs. 79 79 If this happens, the scheduler push and pop are avoided and the results of the experiment are skewed. 80 (Note, an unpark is like a V on a semaphore, so the subsequentpark (P) may not block.)81 Every runtime system must handle this race and cannot optimize daway the ready-queue pushes and pops.82 To prevent any attempt of silently omitting ready-queue operations, the ring of \ats is made big enough so the \ats have time to fully park before being unparked again.80 (Note, an \unpark is like a V on a semaphore, so the subsequent \park (P) may not block.) 81 Every runtime system must handle this race and cannot optimize away the ready-queue pushes and pops. 82 To prevent any attempt of silently omitting ready-queue operations, the ring of \ats is made big enough so the \ats have time to fully \park before being unparked again. 83 83 Finally, to further mitigate any underlying push/pop optimizations, especially on SMP machines, multiple rings are created in the experiment. 84 84 85 85 Figure~\ref{fig:cycle:code} shows the pseudo code for this benchmark, where each cycle has 5 \ats. 86 There is additional complexity to handle termination (not shown), which requires a binary semaphore or a channel instead of raw @park@/@unpark@and carefully picking the order of the @P@ and @V@ with respect to the loop condition.86 There is additional complexity to handle termination (not shown), which requires a binary semaphore or a channel instead of raw \park/\unpark and carefully picking the order of the @P@ and @V@ with respect to the loop condition. 87 87 88 88 \begin{figure} … … 99 99 } 100 100 \end{cfa} 101 \caption[Cycle Benchmark : Pseudo Code]{Cycle Benchmark: Pseudo Code}101 \caption[Cycle Benchmark: Pseudo Code]{Cycle Benchmark: Pseudo Code} 102 102 \label{fig:cycle:code} 103 %\end{figure}104 105 103 \bigskip 106 107 %\begin{figure}108 104 \subfloat[][Throughput, 100 cycles per \proc]{ 109 105 \resizebox{0.5\linewidth}{!}{ … … 131 127 \label{fig:cycle:jax:low:ns} 132 128 } 133 \caption[Cycle Benchmark on Intel]{Cycle Benchmark on Intel\smallskip\newline Throughput and scalability as a function of \proc count, 5 \ats per cycle, and different cycle count. For throughput, higher is better, for scalability, lower is better. Each series represent 15 independent runs, the dotted lines are maximums while the solid line is the medium.} 129 \caption[Cycle Benchmark on Intel]{Cycle Benchmark on Intel\smallskip\newline Throughput and scalability as a function of \proc count, 5 \ats per cycle, and different cycle counts. 130 For throughput, higher is better, for scalability, lower is better. 131 Each series represent 15 independent runs, the dashed lines are the maximums of each series while the solid lines are the median and the dotted lines are the minimums.} 134 132 \label{fig:cycle:jax} 135 133 \end{figure} … … 161 159 \label{fig:cycle:nasus:low:ns} 162 160 } 163 \caption[Cycle Benchmark on AMD]{Cycle Benchmark on AMD\smallskip\newline Throughput and scalability as a function of \proc count, 5 \ats per cycle, and different cycle count. For throughput, higher is better, for scalability, lower is better. Each series represent 15 independent runs, the dotted lines are extremes while the solid line is the medium.} 161 \caption[Cycle Benchmark on AMD]{Cycle Benchmark on AMD\smallskip\newline Throughput and scalability as a function of \proc count, 5 \ats per cycle, and different cycle counts. 162 For throughput, higher is better, for scalability, lower is better. 163 Each series represent 15 independent runs, the dashed lines are the maximums of each series while the solid lines are the median and the dotted lines are the minimums.} 164 164 \label{fig:cycle:nasus} 165 165 \end{figure} … … 167 167 \subsection{Results} 168 168 169 For the Intel architecture, Figure~\ref{fig:cycle:jax}: 170 \begin{itemize} 171 \item 172 For 100 cycles per \proc (first column), \CFA, Go and Tokio all obtain effectively the same throughput performance. 169 Figures~\ref{fig:cycle:jax} and \ref{fig:cycle:nasus} show the results for the cycle experiment on Intel and AMD, respectively. 170 Looking at the left column on Intel, Figures~\ref{fig:cycle:jax:ops} and \ref{fig:cycle:jax:ns} show the results for 100 cycles of 5 \ats for each \proc. 171 \CFA, Go and Tokio all obtain effectively the same throughput performance. 173 172 Libfibre is slightly behind in this case but still scales decently. 174 As a result of the \gls{kthrd} placement, additional \procs from 25 to 48 offer less performance improvement (flatting of the line) for all runtimes. 175 As expected, this pattern repeats again between \proc count 72 and 96. 176 \item 177 For 1 cycle per \proc, \CFA and Tokio obtain very similar results overall, but Tokio shows more variations in the results. 178 Go achieves slightly better performance. 173 As a result of the \gls{kthrd} placement, additional \procs from 25 to 48 offer less performance improvement for all runtimes, which can be seen as a flattening of the line. 174 This effect even causes a decrease in throughput in libfibre's case. 175 As expected, this pattern repeats between \proc count 72 and 96. 176 177 Looking next at the right column on Intel, Figures~\ref{fig:cycle:jax:low:ops} and \ref{fig:cycle:jax:low:ns} show the results for 1 cycle of 5 \ats for each \proc. 178 \CFA and Tokio obtain very similar results overall, but Tokio shows more variations in the results. 179 Go achieves slightly better performance than \CFA and Tokio, but all three display significantly worst performance compared to the left column. 180 This decrease in performance is likely due to the additional overhead of the idle-sleep mechanism. 181 This can either be the result of \procs actually running out of work or simply additional overhead from tracking whether or not there is work available. 182 Indeed, unlike the left column, it is likely that the ready queue is transiently empty, which likely triggers additional synchronization steps. 179 183 Interestingly, libfibre achieves better performance with 1 cycle. 180 \end{itemize} 181 182 For the AMD architecture, Figure~\ref{fig:cycle:nasus}, the results show the same story as on the Intel, with close to double the performance overall but with slightly increased variation. 183 The different performance improvements and plateaus are due to cache topology and appear at the expected \proc counts of 64, 128 and 192, for the same reasons as on Intel. 184 \begin{itemize} 185 \item 186 For 100 cycles per \proc, unlike Intel, all 4 runtimes achieve very similar throughput and scalability. 187 \item 188 For 1 cycle per \proc, unlike on Intel, Tokio and Go have the same throughput performance, while \CFA is slightly slower. 189 Again, the same performance increase for libfibre is visible. 190 \end{itemize} 184 185 Looking now at the results for the AMD architecture, Figure~\ref{fig:cycle:nasus}, the results are overall similar to the Intel results, but with close to double the performance, slightly increased variation, and some differences in the details. 186 Note the maximum of the Y-axis on Intel and AMD differ significantly. 187 Looking at the left column on AMD, Figures~\ref{fig:cycle:nasus:ops} and \ref{fig:cycle:nasus:ns} all 4 runtimes achieve very similar throughput and scalability. 188 However, as the number of \procs grows higher, the results on AMD show notably more variability than on Intel. 189 The different performance improvements and plateaus are due to cache topology and appear at the expected: \proc counts of 64, 128 and 192, for the same reasons as on Intel. 190 Looking next at the right column on AMD, Figures~\ref{fig:cycle:nasus:low:ops} and \ref{fig:cycle:nasus:low:ns}, Tokio and Go have the same throughput performance, while \CFA is slightly slower. 191 This result is different than on Intel, where Tokio behaved like \CFA rather than behaving like Go. 192 Again, the same performance increase for libfibre is visible when running fewer \ats. 191 193 Note, I did not investigate the libfibre performance boost for 1 cycle in this experiment. 192 194 193 The conclusion from both architectures is that all of the compared runtime have fairly equivalent performance for this micro-benchmark.194 Clearly, the pathological case with 1 \at per \proc,can affect fairness algorithms managing mostly idle processors, \eg \CFA, but only at high core counts.195 Forthis case, \emph{any} helping is likely to cause a cascade of \procs running out of work and attempting to steal.196 For this experiment, the \CFA scheduler has achieved the goal of obtaining equivalent performance to other less fair schedulers, except for very unusual workloads.195 The conclusion from both architectures is that all of the compared runtimes have fairly equivalent performance for this micro-benchmark. 196 Clearly, the pathological case with 1 cycle per \proc can affect fairness algorithms managing mostly idle processors, \eg \CFA, but only at high core counts. 197 In this case, \emph{any} helping is likely to cause a cascade of \procs running out of work and attempting to steal. 198 For this experiment, the \CFA scheduler has achieved the goal of obtaining equivalent performance to other, less fair, schedulers. 197 199 198 200 \section{Yield} 199 201 200 For complet ion, the classic yield benchmark is included.202 For completeness, the classic yield benchmark is included. 201 203 Here, the throughput is dominated by the mechanism used to handle the @yield@ function. 202 204 Figure~\ref{fig:yield:code} shows pseudo code for this benchmark, where the cycle @wait/next.wake@ is replaced by @yield@. … … 216 218 } 217 219 \end{cfa} 218 \caption[Yield Benchmark : Pseudo Code]{Yield Benchmark: Pseudo Code}220 \caption[Yield Benchmark: Pseudo Code]{Yield Benchmark: Pseudo Code} 219 221 \label{fig:yield:code} 220 222 %\end{figure} … … 227 229 \label{fig:yield:jax:ops} 228 230 } 229 \subfloat[][Throughput, 1 \at sper \proc]{231 \subfloat[][Throughput, 1 \at per \proc]{ 230 232 \resizebox{0.5\linewidth}{!}{ 231 233 \input{result.yield.low.jax.ops.pstex_t} … … 240 242 \label{fig:yield:jax:ns} 241 243 } 242 \subfloat[][Scalability, 1 \at sper \proc]{244 \subfloat[][Scalability, 1 \at per \proc]{ 243 245 \resizebox{0.5\linewidth}{!}{ 244 246 \input{result.yield.low.jax.ns.pstex_t} … … 246 248 \label{fig:yield:jax:low:ns} 247 249 } 248 \caption[Yield Benchmark on Intel]{Yield Benchmark on Intel\smallskip\newline Throughput and scalability as a function of \proc count, using 1 \ats per \proc. For throughput, higher is better, for scalability, lower is better. Each series represent 15 independent runs, the dotted lines are extremes while the solid line is the medium.} 250 \caption[Yield Benchmark on Intel]{Yield Benchmark on Intel\smallskip\newline Throughput and scalability as a function of \proc count. 251 For throughput, higher is better, for scalability, lower is better. 252 Each series represent 15 independent runs, the dashed lines are the maximums of each series while the solid lines are the median and the dotted lines are the minimums.} 249 253 \label{fig:yield:jax} 250 254 \end{figure} … … 252 256 \subsection{Results} 253 257 254 Figures~\ref{fig:yield:jax} and~\ref{fig:yield:nasus} show the same throughput graphs as @cycle@ on Intel and AMD, respectively. 255 Note, the Y-axis on the yield graph for Intel is twice as large as the Intel cycle-graph. 256 A visual glance between the cycle and yield graphs confirms my claim that the yield benchmark is unreliable. 257 258 For the Intel architecture, Figure~\ref{fig:yield:jax}: 259 \begin{itemize} 260 \item 258 Figures~\ref{fig:yield:jax} and \ref{fig:yield:nasus} show the results for the yield experiment on Intel and AMD, respectively. 259 Looking at the left column on Intel, Figures~\ref{fig:yield:jax:ops} and \ref{fig:yield:jax:ns} show the results for 100 \ats for each \proc. 260 Note that the Y-axis on this graph is twice as large as the Intel cycle graph. 261 A visual glance between the left columns of the cycle and yield graphs confirms my claim that the yield benchmark is unreliable. 261 262 \CFA has no special handling for @yield@, but this experiment requires less synchronization than the @cycle@ experiment. 262 Hence, the @yield@ throughput and scalability graphs for both 100 and 1 cycles/tasks per processor have similar shapes to the corresponding @cycle@ graphs. 263 The only difference is sightly better performance for @yield@ because of less synchronization. 264 As for @cycle@, the cost of idle sleep also comes into play in a very significant way in Figure~\ref{fig:yield:jax:low:ns}, where the scaling is not flat. 265 \item 266 libfibre has special handling for @yield@ using the fact that the number of ready fibres does not change, and therefore, by-passing the idle-sleep mechanism entirely. 267 Additionally, when only running 1 \at per \proc, libfibre optimizes further, and forgoes the context-switch entirely. 268 Hence, libfibre behaves very differently in the cycle and yield benchmarks, with a 4 times increase in performance for 100 cycles/tasks and an 8 times increase for 1 cycle/task. 269 \item 270 Go has special handling for @yield@ by putting a yielding goroutine on a secondary global ready-queue, giving it lower priority. 263 Hence, the @yield@ throughput and scalability graphs have similar shapes to the corresponding @cycle@ graphs. 264 The only difference is slightly better performance for @yield@ because of less synchronization. 265 Libfibre has special handling for @yield@ using the fact that the number of ready fibres does not change, and therefore, bypassing the idle-sleep mechanism entirely. 266 Hence, libfibre behaves very differently in the cycle and yield benchmarks, with a 4 times increase in performance on the left column. 267 Go has special handling for @yield@ by putting a yielding goroutine on a secondary global ready-queue, giving it a lower priority. 271 268 The result is that multiple \glspl{hthrd} contend for the global queue and performance suffers drastically. 272 Hence, Go behaves very differently in the cycle and yield benchmarks, with a complete performance collapse in @yield@ for both 100 and 1 cycles/tasks. 273 \item 269 Hence, Go behaves very differently in the cycle and yield benchmarks, with a complete performance collapse in @yield@. 274 270 Tokio has a similar performance collapse after 16 processors, and therefore, its special @yield@ handling is probably related to a Go-like scheduler problem and/or a \CFA idle-sleep problem. 275 271 (I did not dig through the Rust code to ascertain the exact reason for the collapse.) 276 \end{itemize} 272 Note that since there is no communication among \ats, locality problems are much less likely than for the cycle benchmark. 273 This lack of communication is probably why the plateaus due to topology are not present. 274 275 Looking next at the right column on Intel, Figures~\ref{fig:yield:jax:low:ops} and \ref{fig:yield:jax:low:ns} show the results for 1 \at for each \proc. 276 As for @cycle@, \CFA's cost of idle sleep comes into play in a very significant way in Figure~\ref{fig:yield:jax:low:ns}, where the scaling is not flat. 277 This result is to be expected since fewer \ats mean \procs are more likely to run out of work. 278 On the other hand, when only running 1 \at per \proc, libfibre optimizes further and forgoes the context switch entirely. 279 This results in libfibre outperforming other runtimes, even more, achieving 8 times more throughput than for @cycle@. 280 Finally, Go and Tokio's performance collapse is still the same with fewer \ats. 281 The only exception is Tokio running on 24 \procs, deepening the mystery of its yielding mechanism further. 277 282 278 283 \begin{figure} … … 302 307 \label{fig:yield:nasus:low:ns} 303 308 } 304 \caption[Yield Benchmark on AMD]{Yield Benchmark on AMD\smallskip\newline Throughput and scalability as a function of \proc count, using 1 \ats per \proc. For throughput, higher is better, for scalability, lower is better. Each series represent 15 independent runs, the dotted lines are extremes while the solid line is the medium.} 309 \caption[Yield Benchmark on AMD]{Yield Benchmark on AMD\smallskip\newline Throughput and scalability as a function of \proc count. 310 For throughput, higher is better, for scalability, lower is better. 311 Each series represent 15 independent runs, the dashed lines are the maximums of each series while the solid lines are the median and the dotted lines are the minimums.} 305 312 \label{fig:yield:nasus} 306 313 \end{figure} 307 314 308 For the AMD architecture, Figure~\ref{fig:yield:nasus}, the results show the same story as on the Intel, with slightly increased variations. 309 Also, some transition points on the X-axis differ because of the architectures, like at 16 versus 24 processors. 310 311 It is difficult to draw conclusions for this benchmark when runtime system treat @yield@ so differently. 315 Looking now at the results for the AMD architecture, Figure~\ref{fig:yield:nasus}, the results again show a story that is overall similar to the results on the Intel, with increased variation and some differences in the details. 316 Note that the maximum of the Y-axis on Intel and AMD differ less in @yield@ than @cycle@. 317 Looking at the left column first, Figures~\ref{fig:yield:nasus:ops} and \ref{fig:yield:nasus:ns}, \CFA achieves very similar throughput and scaling. 318 Libfibre still outpaces all other runtimes, but it encounters a performance hit at 64 \procs. 319 This anomaly suggests some amount of communication between the \procs that the Intel machine is able to mask where the AMD is not once hyperthreading is needed. 320 Go and Tokio still display the same performance collapse as on Intel. 321 Looking next at the right column on AMD, Figures~\ref{fig:yield:nasus:low:ops} and \ref{fig:yield:nasus:low:ns}, all runtime systems effectively behave the same as they did on the Intel machine. 322 At the high \ats count, the only difference is Libfibre's scaling and this difference disappears on the right column. 323 This behaviour suggests whatever communication issue it encountered on the left is completely circumvented on the right. 324 325 It is difficult to draw conclusions for this benchmark when runtime systems treat @yield@ so differently. 312 326 The win for \CFA is its consistency between the cycle and yield benchmarks making it simpler for programmers to use and understand, \ie the \CFA semantics match with programmer intuition. 313 327 … … 315 329 \section{Churn} 316 330 317 The Cycle and Yield benchmark represent an \emph{easy} scenario for a scheduler, \eg an embarrassingly parallel application.318 In these benchmarks ,\ats can be easily partitioned over the different \procs upfront and none of the \ats communicate with each other.319 320 The Churn benchmark represents more chaotic executions, where there is more communication among \ats but no relationship between the last \proc on which a \at ran and blocked and the \proc that subsequently unblocks it.331 The Cycle and Yield benchmarks represent an \emph{easy} scenario for a scheduler, \eg an embarrassingly parallel application. 332 In these benchmarks \ats can be easily partitioned over the different \procs upfront and none of the \ats communicate with each other. 333 334 The Churn benchmark represents more chaotic executions, where there is more communication among \ats but no relationship between the last \proc on which a \at ran and blocked, and the \proc that subsequently unblocks it. 321 335 With processor-specific ready-queues, when a \at is unblocked by a different \proc that means the unblocking \proc must either ``steal'' the \at from another processor or find it on a remote queue. 322 336 This dequeuing results in either contention on the remote queue and/or \glspl{rmr} on the \at data structure. 323 Hence, this benchmark has performance dominated by the cache traffic as \proc are constantly accessing theeach other's data.324 In either case, this benchmark aims to measure how well a scheduler handles these cases ,since both cases can lead to performance degradation if not handled correctly.337 Hence, this benchmark has performance dominated by the cache traffic as \procs are constantly accessing each other's data. 338 In either case, this benchmark aims to measure how well a scheduler handles these cases since both cases can lead to performance degradation if not handled correctly. 325 339 326 340 This benchmark uses a fixed-size array of counting semaphores. 327 Each \at picks a random semaphore, @V@s it to unblock any waiting \at, and then @P@s (maybe blocks) the \at son the semaphore.341 Each \at picks a random semaphore, @V@s it to unblock any waiting \at, and then @P@s (maybe blocks) the \at on the semaphore. 328 342 This creates a flow where \ats push each other out of the semaphores before being pushed out themselves. 329 For this benchmark to work, the number of \ats must be equal or greater than the number of semaphores plus the number of \procs;330 \eg if there are 10 semaphores and 5 \procs, but only 3 \ats, all 3 \ats can block (P) on a random semaphore and now there isno \ats to unblock (V) them.331 Note , the nature of these semaphores meanthe counter can go beyond 1, which can lead to nonblocking calls to @P@.343 For this benchmark to work, the number of \ats must be equal to or greater than the number of semaphores plus the number of \procs; 344 \eg if there are 10 semaphores and 5 \procs, but only 3 \ats, all 3 \ats can block (P) on a random semaphore and now there are no \ats to unblock (V) them. 345 Note that the nature of these semaphores means the counter can go beyond 1, which can lead to nonblocking calls to @P@. 332 346 Figure~\ref{fig:churn:code} shows pseudo code for this benchmark, where the @yield@ is replaced by @V@ and @P@. 333 347 … … 346 360 } 347 361 \end{cfa} 348 \caption[Churn Benchmark : Pseudo Code]{Churn Benchmark: Pseudo Code}362 \caption[Churn Benchmark: Pseudo Code]{Churn Benchmark: Pseudo Code} 349 363 \label{fig:churn:code} 350 364 %\end{figure} … … 364 378 } 365 379 366 \subfloat[][ Latency, 100 \ats per \proc]{380 \subfloat[][Scalability, 100 \ats per \proc]{ 367 381 \resizebox{0.5\linewidth}{!}{ 368 382 \input{result.churn.jax.ns.pstex_t} … … 370 384 \label{fig:churn:jax:ns} 371 385 } 372 \subfloat[][ Latency, 2 \ats per \proc]{386 \subfloat[][Scalability, 2 \ats per \proc]{ 373 387 \resizebox{0.5\linewidth}{!}{ 374 388 \input{result.churn.low.jax.ns.pstex_t} … … 376 390 \label{fig:churn:jax:low:ns} 377 391 } 378 \caption[Churn Benchmark on Intel]{\centering Churn Benchmark on Intel\smallskip\newline Throughput and latency of the Churn on the benchmark on the Intel machine. For throughput, higher is better, for scalability, lower is better. Each series represent 15 independent runs, the dotted lines are extremes while the solid line is the medium.} 392 \caption[Churn Benchmark on Intel]{Churn Benchmark on Intel\smallskip\newline Throughput and scalability as a function of \proc count. 393 For throughput, higher is better, for scalability, lower is better. 394 Each series represent 15 independent runs, the dashed lines are the maximums of each series while the solid lines are the median and the dotted lines are the minimums.} 379 395 \label{fig:churn:jax} 380 396 \end{figure} … … 382 398 \subsection{Results} 383 399 384 Figures~\ref{fig:churn:jax} and Figure~\ref{fig:churn:nasus} show the throughput on Intel and AMD respectively. 385 386 The performance cost of crossing the cache boundaries is still visible at the same \proc count. 387 388 Scalability is notably worst than the previous benchmarks since there is inherently more communication between processors. 389 Indeed, once the number of \glspl{hthrd} goes beyond a single socket, performance ceases to improve. 400 Figures~\ref{fig:churn:jax} and Figure~\ref{fig:churn:nasus} show the results for the churn experiment on Intel and AMD, respectively. 401 Looking at the left column on Intel, Figures~\ref{fig:churn:jax:ops} and \ref{fig:churn:jax:ns} show the results for 100 \ats for each \proc, and all runtimes obtain fairly similar throughput for most \proc counts. 402 \CFA does very well on a single \proc but quickly loses its advantage over the other runtimes. 403 As expected, it scales decently up to 48 \procs, drops from 48 to 72 \procs, and then plateaus. 404 Tokio achieves very similar performance to \CFA, with the starting boost, scaling decently until 48 \procs, drops from 48 to 72 \procs, and starts increasing again to 192 \procs. 405 Libfibre obtains effectively the same results as Tokio with slightly less scaling, \ie the scaling curve is the same but with slightly lower values. 406 Finally, Go gets the most peculiar results, scaling worst than other runtimes until 48 \procs. 407 At 72 \procs, the results of the Go runtime vary significantly, sometimes scaling sometimes plateauing. 408 However, beyond this point Go keeps this level of variation but does not scale further in any of the runs. 409 410 Throughput and scalability are notably worst for all runtimes than the previous benchmarks since there is inherently more communication between processors. 411 Indeed, none of the runtimes reach 40 million operations per second while in the cycle benchmark all but libfibre reached 400 million operations per second. 412 Figures~\ref{fig:churn:jax:ns} and \ref{fig:churn:jax:low:ns} show that for all \proc counts, all runtimes produce poor scaling. 413 However, once the number of \glspl{hthrd} goes beyond a single socket, at 48 \procs, scaling goes from bad to worst and performance completely ceases to improve. 414 At this point, the benchmark is dominated by inter-socket communication costs for all runtimes. 415 390 416 An interesting aspect to note here is that the runtimes differ in how they handle this situation. 391 Indeed, when a \proc unparks a \at that was last run on a different \proc, the \at could be appended to the ready-queue local \proc or to the ready-queue of the remote \proc, which previously ran the \at. 392 \CFA, Tokio and Go all use the approach of unparking to the local \proc while Libfibre unparks to the remote \proc. 393 In this particular benchmark, the inherent chaos of the benchmark in addition to small memory footprint means neither approach wins over the other. 417 Indeed, when a \proc unparks a \at that was last run on a different \proc, the \at could be appended to the ready queue of the local \proc or to the ready queue of the remote \proc, which previously ran the \at. 418 \CFA, Tokio and Go all use the approach of \glslink{atsched}{unparking} to the local \proc, while Libfibre unparks to the remote \proc. 419 In this particular benchmark, the inherent chaos of the benchmark, in addition to the small memory footprint, means neither approach wins over the other. 420 421 Looking next at the right column on Intel, Figures~\ref{fig:churn:jax:low:ops} and \ref{fig:churn:jax:low:ns} show the results for 1 \at for each \proc, and many of the differences between the runtimes disappear. 422 \CFA outperforms other runtimes by a minuscule margin. 423 Libfibre follows very closely behind with basically the same performance and scaling. 424 Tokio maintains effectively the same curve shapes as \CFA and libfibre, but it incurs extra costs for all \proc counts. 425 While Go maintains overall similar results to the others, it again encounters significant variation at high \proc counts. 426 Inexplicably resulting in super-linear scaling for some runs, \ie the scalability curves display a negative slope. 427 428 Interestingly, unlike the cycle benchmark, running with fewer \ats does not produce drastically different results. 429 In fact, the overall throughput stays almost exactly the same on the left and right columns. 394 430 395 431 \begin{figure} … … 407 443 } 408 444 409 \subfloat[][ Latency, 100 \ats per \proc]{445 \subfloat[][Scalability, 100 \ats per \proc]{ 410 446 \resizebox{0.5\linewidth}{!}{ 411 447 \input{result.churn.nasus.ns.pstex_t} … … 413 449 \label{fig:churn:nasus:ns} 414 450 } 415 \subfloat[][ Latency, 2 \ats per \proc]{451 \subfloat[][Scalability, 2 \ats per \proc]{ 416 452 \resizebox{0.5\linewidth}{!}{ 417 453 \input{result.churn.low.nasus.ns.pstex_t} … … 419 455 \label{fig:churn:nasus:low:ns} 420 456 } 421 \caption[Churn Benchmark on AMD]{\centering Churn Benchmark on AMD\smallskip\newline Throughput and latency of the Churn on the benchmark on the AMD machine. 422 For throughput, higher is better, for scalability, lower is better. Each series represent 15 independent runs, the dotted lines are extremes while the solid line is the medium.} 457 \caption[Churn Benchmark on AMD]{Churn Benchmark on AMD\smallskip\newline Throughput and scalability as a function of \proc count. 458 For throughput, higher is better, for scalability, lower is better. 459 Each series represent 15 independent runs, the dashed lines are the maximums of each series while the solid lines are the median and the dotted lines are the minimums.} 423 460 \label{fig:churn:nasus} 424 461 \end{figure} 425 462 426 Like for the cycle benchmark, here all runtimes achieve fairly similar performance. 427 Performance improves as long as all \procs fit on a single socket. 428 Beyond that performance starts to suffer from increased caching costs. 429 430 Indeed on Figures~\ref{fig:churn:jax:ops} and \ref{fig:churn:jax:ns} show that with 1 and 100 \ats per \proc, \CFA, libfibre, Go and Tokio achieve effectively equivalent performance for most \proc count. 431 432 However, Figure~\ref{fig:churn:nasus} again shows a somewhat different story on AMD. 433 While \CFA, libfibre, and Tokio achieve effectively equivalent performance for most \proc count, Go starts with better scaling at very low \proc counts but then performance quickly plateaus, resulting in worse performance at higher \proc counts. 434 This performance difference is visible at both high and low \at counts. 435 436 One possible explanation for this difference is that since Go has very few available concurrent primitives, a channel was used instead of a semaphore. 437 On paper a semaphore can be replaced by a channel and with zero-sized objects passed along equivalent performance could be expected. 438 However, in practice there can be implementation difference between the two. 439 This is especially true if the semaphore count can get somewhat high. 440 Note that this replacement is also made in the cycle benchmark, however in that context it did not seem to have a notable impact. 441 442 As second possible explanation is that Go may sometimes use the heap when allocating variables based on the result of escape analysis of the code. 443 It is possible that variables that should be placed on the stack are placed on the heap. 444 This could cause extra pointer chasing in the benchmark, heightening locality effects. 445 Depending on how the heap is structure, this could also lead to false sharing. 446 447 The objective of this benchmark is to demonstrate that unparking \ats from remote \procs do not cause too much contention on the local queues. 448 Indeed, the fact all runtimes achieve some scaling at lower \proc count demonstrate that migrations do not need to be serialized. 449 Again these result demonstrate \CFA achieves satisfactory performance. 463 464 Looking now at the results for the AMD architecture, Figure~\ref{fig:churn:nasus}, the results show a somewhat different story. 465 Looking at the left column first, Figures~\ref{fig:churn:nasus:ops} and \ref{fig:churn:nasus:ns}, \CFA, Libfibre and Tokio all produce decent scalability. 466 \CFA suffers particularly from larger variations at higher \proc counts, but largely outperforms the other runtimes. 467 Go still produces intriguing results in this case and even more intriguingly, the results have fairly low variation. 468 469 One possible explanation for Go's difference is that it has very few available concurrent primitives, so a channel is substituted for a semaphore. 470 On paper, a semaphore can be replaced by a channel, and with zero-sized objects passed through the channel, equivalent performance could be expected. 471 However, in practice, there are implementation differences between the two, \eg if the semaphore count can get somewhat high so objects accumulate in the channel. 472 Note that this substitution is also made in the cycle benchmark; 473 however, in that context, it did not have a notable impact. 474 475 A second possible explanation is that Go may use the heap when allocating variables based on the result of the escape analysis of the code. 476 It is possible for variables that could be placed on the stack to instead be placed on the heap. 477 This placement could cause extra pointer chasing in the benchmark, heightening locality effects. 478 Depending on how the heap is structured, this could also lead to false sharing. 479 I did not investigate what causes these unusual results. 480 481 Looking next at the right column, Figures~\ref{fig:churn:nasus:low:ops} and \ref{fig:churn:nasus:low:ns}, as for Intel, all runtimes obtain overall similar throughput between the left and right column. 482 \CFA, Libfibre and Tokio all have very close results. 483 Go still suffers from poor scalability but is now unusual in a different way. 484 While it obtains effectively constant performance regardless of \proc count, this ``sequential'' performance is higher than the other runtimes for low \proc count. 485 Up to 32 \procs, after which the other runtimes manage to outscale Go. 486 487 In conclusion, the objective of this benchmark is to demonstrate that \glslink{atsched}{unparking} \ats from remote \procs does not cause too much contention on the local queues. 488 Indeed, the fact that most runtimes achieve some scaling between various \proc counts demonstrates migrations do not need to be serialized. 489 Again these results demonstrate that \CFA achieves satisfactory performance compared to the other runtimes. 450 490 451 491 \section{Locality} 492 493 As mentioned in the churn benchmark, when \glslink{atsched}{unparking} a \at, it is possible to either \unpark to the local or remote ready-queue.\footnote{ 494 It is also possible to \unpark to a third unrelated ready-queue, but without additional knowledge about the situation, it is likely to degrade performance.} 495 The locality experiment includes two variations of the churn benchmark, where a data array is added. 496 In both variations, before @V@ing the semaphore, each \at calls a @work@ function which increments random cells inside the data array. 497 In the noshare variation, the array is not passed on and each thread continuously accesses its private array. 498 In the share variation, the array is passed to another thread via the semaphore's shadow queue (each blocking thread can save a word of user data in its blocking node), transferring ownership of the array to the woken thread. 499 Figure~\ref{fig:locality:code} shows the pseudo code for this benchmark. 500 501 The objective here is to highlight the different decisions made by the runtime when \glslink{atsched}{unparking}. 502 Since each thread unparks a random semaphore, it means that it is unlikely that a \at is unparked from the last \proc it ran on. 503 In the noshare variation, \glslink{atsched}{unparking} the \at on the local \proc is an appropriate choice since the data was last modified on that \proc. 504 In the shared variation, \glslink{atsched}{unparking} the \at on a remote \proc is an appropriate choice. 505 506 The expectation for this benchmark is to see a performance inversion, where runtimes fare notably better in the variation which matches their \glslink{atsched}{unparking} policy. 507 This decision should lead to \CFA, Go and Tokio achieving better performance in the share variation while libfibre achieves better performance in noshare. 508 Indeed, \CFA, Go and Tokio have the default policy of \glslink{atsched}{unparking} \ats on the local \proc, whereas libfibre has the default policy of \glslink{atsched}{unparking} \ats wherever they last ran. 452 509 453 510 \begin{figure} … … 493 550 \end{lrbox} 494 551 495 \subfloat[ Thread$_1$]{\label{f:CFibonacci}\usebox\myboxA}552 \subfloat[Noshare]{\label{fig:locality:code:T1}\usebox\myboxA} 496 553 \hspace{3pt} 497 554 \vrule 498 555 \hspace{3pt} 499 \subfloat[ Thread$_2$]{\label{f:CFAFibonacciGen}\usebox\myboxB}500 501 \caption[Locality Benchmark : Pseudo Code]{Locality Benchmark: Pseudo Code}556 \subfloat[Share]{\label{fig:locality:code:T2}\usebox\myboxB} 557 558 \caption[Locality Benchmark: Pseudo Code]{Locality Benchmark: Pseudo Code} 502 559 \label{fig:locality:code} 503 560 \end{figure} 504 561 505 As mentioned in the churn benchmark, when unparking a \at, it is possible to either unpark to the local or remote ready-queue.506 \footnote{It is also possible to unpark to a third unrelated ready-queue, but without additional knowledge about the situation, there is little to suggest this would not degrade performance.}507 The locality experiment includes two variations of the churn benchmark, where an array of data is added.508 In both variations, before @V@ing the semaphore, each \at increment random cells inside the array.509 The @share@ variation then passes the array to the shadow-queue of the semaphore, transferring ownership of the array to the woken thread.510 In the @noshare@ variation the array is not passed on and each thread continuously accesses its private array.511 512 The objective here is to highlight the different decision made by the runtime when unparking.513 Since each thread unparks a random semaphore, it means that it is unlikely that a \at will be unparked from the last \proc it ran on.514 In the @share@ version, this means that unparking the \at on the local \proc is appropriate since the data was last modified on that \proc.515 In the @noshare@ version, the unparking the \at on the remote \proc is the appropriate approach.516 517 The expectation for this benchmark is to see a performance inversion, where runtimes will fare notably better in the variation which matches their unparking policy.518 This should lead to \CFA, Go and Tokio achieving better performance in @share@ while libfibre achieves better performance in @noshare@.519 Indeed, \CFA, Go and Tokio have the default policy of unpark \ats on the local \proc, where as libfibre has the default policy of unparks \ats wherever they last ran.520 521 562 \subsection{Results} 522 563 564 Figures~\ref{fig:locality:jax} and \ref{fig:locality:nasus} show the results for the locality experiment on Intel and AMD, respectively. 565 In both cases, the graphs on the left column show the results for the share variation and the graphs on the right column show the results for the noshare. 566 Looking at the left column on Intel, Figures~\ref{fig:locality:jax:share:ops} and \ref{fig:locality:jax:share:ns} show the results for the share variation. 567 \CFA and Tokio slightly outperform libfibre, as expected, based on their \ats placement approach. 568 \CFA and Tokio both \unpark locally and do not suffer cache misses on the transferred array. 569 Libfibre, on the other hand, unparks remotely, and as such the unparked \at is likely to miss on the shared data. 570 Go trails behind in this experiment, presumably for the same reasons that were observable in the churn benchmark. 571 Otherwise, the results are similar to the churn benchmark, with lower throughput due to the array processing. 572 As for most previous results, all runtimes suffer a performance hit after 48 \procs, which is the socket boundary, and climb again from 96 to 192 \procs. 573 523 574 \begin{figure} 524 575 \subfloat[][Throughput share]{ … … 547 598 \label{fig:locality:jax:noshare:ns} 548 599 } 549 \caption[Locality Benchmark on Intel]{Locality Benchmark on Intel\smallskip\newline Throughput and scalability as a function of \proc count. For throughput, higher is better, for scalability, lower is better. Each series represent 15 independent runs, the dotted lines are extremes while the solid line is the medium.} 600 \caption[Locality Benchmark on Intel]{Locality Benchmark on Intel\smallskip\newline Throughput and scalability as a function of \proc count. 601 For throughput, higher is better, for scalability, lower is better. 602 Each series represent 15 independent runs, the dashed lines are the maximums of each series while the solid lines are the median and the dotted lines are the minimums.} 550 603 \label{fig:locality:jax} 551 604 \end{figure} 605 552 606 \begin{figure} 553 607 \subfloat[][Throughput share]{ … … 576 630 \label{fig:locality:nasus:noshare:ns} 577 631 } 578 \caption[Locality Benchmark on AMD]{Locality Benchmark on AMD\smallskip\newline Throughput and scalability as a function of \proc count. For throughput, higher is better, for scalability, lower is better. Each series represent 15 independent runs, the dotted lines are extremes while the solid line is the medium.} 632 \caption[Locality Benchmark on AMD]{Locality Benchmark on AMD\smallskip\newline Throughput and scalability as a function of \proc count. 633 For throughput, higher is better, for scalability, lower is better. 634 Each series represent 15 independent runs, the dashed lines are the maximums of each series while the solid lines are the median and the dotted lines are the minimums.} 579 635 \label{fig:locality:nasus} 580 636 \end{figure} 581 637 582 Figures~\ref{fig:locality:jax} and \ref{fig:locality:nasus} shows the results on Intel and AMD respectively. 583 In both cases, the graphs on the left column show the results for the @share@ variation and the graphs on the right column show the results for the @noshare@. 584 585 On Intel, Figure~\ref{fig:locality:jax} shows Go trailing behind the 3 other runtimes. 586 On the left of the figure showing the results for the shared variation, where \CFA and Tokio slightly outperform libfibre as expected. 587 And correspondingly on the right, we see the expected performance inversion where libfibre now outperforms \CFA and Tokio. 588 Otherwise the results are similar to the churn benchmark, with lower throughput due to the array processing. 589 Presumably the reason why Go trails behind are the same as in Figure~\ref{fig:churn:nasus}. 590 591 Figure~\ref{fig:locality:nasus} shows the same experiment on AMD. 592 \todo{why is cfa slower?} 593 Again, we see the same story, where Tokio and libfibre swap places and Go trails behind. 638 Looking at the right column on Intel, Figures~\ref{fig:locality:jax:noshare:ops} and \ref{fig:locality:jax:noshare:ns} show the results for the noshare variation. 639 The graphs show the expected performance inversion where libfibre now outperforms \CFA and Tokio. 640 Indeed, in this case, unparking remotely means the unparked \at is less likely to suffer a cache miss on the array, which leaves the \at data structure and the remote queue as the only source of likely cache misses. 641 Results show both are amortized fairly well in this case. 642 \CFA and Tokio both \unpark locally and as a result, suffer a marginal performance degradation from the cache miss on the array. 643 644 Looking at the results for the AMD architecture, Figure~\ref{fig:locality:nasus}, shows results similar to the Intel. 645 Again the overall performance is higher and slightly more variation is visible. 646 Looking at the left column first, Figures~\ref{fig:locality:nasus:share:ops} and \ref{fig:locality:nasus:share:ns}, \CFA and Tokio still outperform libfibre, this time more significantly. 647 This advantage is expected from the AMD server with its smaller and narrower caches that magnify the costs of processing the array. 648 Go still has the same poor performance as on Intel. 649 650 Finally looking at the right column, Figures~\ref{fig:locality:nasus:noshare:ops} and \ref{fig:locality:nasus:noshare:ns}, like on Intel, the same performance inversion is present between libfibre and \CFA/Tokio. 651 Go still has the same poor performance. 652 653 Overall, this benchmark mostly demonstrates the two options available when \glslink{atsched}{unparking} a \at. 654 Depending on the workload, either of these options can be the appropriate one. 655 Since it is prohibitively difficult to dynamically detect which approach is appropriate, all runtimes much choose one of the two and live with the consequences. 656 657 Once again, these experiments demonstrate that \CFA achieves equivalent performance to the other runtimes, in this case matching the faster Tokio rather than Go, which is trailing behind. 594 658 595 659 \section{Transfer} 596 660 The last benchmark is more of an experiment than a benchmark. 597 661 It tests the behaviour of the schedulers for a misbehaved workload. 598 In this workload, one of the\at is selected at random to be the leader.662 In this workload, one \at is selected at random to be the leader. 599 663 The leader then spins in a tight loop until it has observed that all other \ats have acknowledged its leadership. 600 664 The leader \at then picks a new \at to be the next leader and the cycle repeats. 601 The benchmark comes in two flavours for the non-leader \ats:665 The benchmark comes in two variations for the non-leader \ats: 602 666 once they acknowledged the leader, they either block on a semaphore or spin yielding. 603 604 The experiment is designed to evaluate the short-term load-balancing of a scheduler. 605 Indeed, schedulers where the runnable \ats are partitioned on the \procs may need to balance the \ats for this experiment to terminate. 606 This problem occurs because the spinning \at is effectively preventing the \proc from running any other \at. 607 In the semaphore flavour, the number of runnable \ats eventually dwindles down to only the leader. 608 This scenario is a simpler case to handle for schedulers since \procs eventually run out of work. 609 In the yielding flavour, the number of runnable \ats stays constant. 610 This scenario is a harder case to handle because corrective measures must be taken even when work is available. 611 Note, runtime systems with preemption circumvent this problem by forcing the spinner to yield. 612 613 In both flavours, the experiment effectively measures how long it takes for all \ats to run once after a given synchronization point. 614 In an ideal scenario where the scheduler is strictly FIFO, every thread would run once after the synchronization and therefore the delay between leaders would be given by: 615 $ \frac{CSL + SL}{NP - 1}$, where $CSL$ is the context switch latency, $SL$ is the cost for enqueueing and dequeuing a \at and $NP$ is the number of \procs. 616 However, if the scheduler allows \ats to run many times before other \ats are able to run once, this delay will increase. 617 The semaphore version is an approximation of the strictly FIFO scheduling, where none of the \ats \emph{attempt} to run more than once. 618 The benchmark effectively provides the fairness guarantee in this case. 619 In the yielding version however, the benchmark provides no such guarantee, which means the scheduler has full responsibility and any unfairness will be measurable. 620 621 While this is a fairly artificial scenario, it requires only a few simple pieces. 622 The yielding version of this simply creates a scenario where a \at runs uninterrupted in a saturated system, and starvation has an easily measured impact. 623 However, \emph{any} \at that runs uninterrupted for a significant period of time in a saturated system could lead to this kind of starvation. 667 Figure~\ref{fig:transfer:code} shows pseudo code for this benchmark. 624 668 625 669 \begin{figure} … … 641 685 // pick next leader 642 686 leader := threads[ prng() % len(threads) ] 643 // wake every one687 // wake everyone 644 688 if ! exhaust { 645 689 for t in threads { … … 660 704 } 661 705 \end{cfa} 662 \caption[Transfer Benchmark : Pseudo Code]{Transfer Benchmark: Pseudo Code}706 \caption[Transfer Benchmark: Pseudo Code]{Transfer Benchmark: Pseudo Code} 663 707 \label{fig:transfer:code} 664 708 \end{figure} 665 709 710 The experiment is designed to evaluate the short-term load balancing of a scheduler. 711 Indeed, schedulers where the runnable \ats are partitioned on the \procs may need to balance the \ats for this experiment to terminate. 712 This problem occurs because the spinning \at is effectively preventing the \proc from running any other \at. 713 In the semaphore variation, the number of runnable \ats eventually dwindles to only the leader. 714 This scenario is a simpler case to handle for schedulers since \procs eventually run out of work. 715 In the yielding variation, the number of runnable \ats stays constant. 716 This scenario is a harder case to handle because corrective measures must be taken even when work is available. 717 Note that runtimes with preemption circumvent this problem by forcing the spinner to yield. 718 In \CFA preemption was disabled as it only obfuscates the results. 719 I am not aware of a method to disable preemption in Go. 720 721 In both variations, the experiment effectively measures how long it takes for all \ats to run once after a given synchronization point. 722 In an ideal scenario where the scheduler is strictly FIFO, every thread would run once after the synchronization and therefore the delay between leaders would be given by, $(CSL + SL) / (NP - 1)$, 723 where $CSL$ is the context-switch latency, $SL$ is the cost for enqueueing and dequeuing a \at, and $NP$ is the number of \procs. 724 However, if the scheduler allows \ats to run many times before other \ats can run once, this delay increases. 725 The semaphore version is an approximation of strictly FIFO scheduling, where none of the \ats \emph{attempt} to run more than once. 726 The benchmark effectively provides the fairness guarantee in this case. 727 In the yielding version, however, the benchmark provides no such guarantee, which means the scheduler has full responsibility and any unfairness is measurable. 728 729 While this is an artificial scenario, in real life it requires only a few simple pieces. 730 The yielding version simply creates a scenario where a \at runs uninterrupted in a saturated system and the starvation has an easily measured impact. 731 Hence, \emph{any} \at that runs uninterrupted for a significant time in a saturated system could lead to this kind of starvation. 732 666 733 \subsection{Results} 667 \begin{figure} 734 735 \begin{table} 736 \caption[Transfer Benchmark on Intel and AMD]{Transfer Benchmark on Intel and AMD\smallskip\newline Average measurement of how long it takes for all \ats to acknowledge the leader \at. 737 DNC stands for ``did not complete'', meaning that after 5 seconds of a new leader being decided, some \ats still had not acknowledged the new leader.} 738 \label{fig:transfer:res} 739 \setlength{\extrarowheight}{2pt} 740 \setlength{\tabcolsep}{5pt} 668 741 \begin{centering} 669 \begin{tabular}{r | c c c c | c c c c } 670 Machine & \multicolumn{4}{c |}{Intel} & \multicolumn{4}{c}{AMD} \\ 671 Variation & \multicolumn{2}{c}{Park} & \multicolumn{2}{c |}{Yield} & \multicolumn{2}{c}{Park} & \multicolumn{2}{c}{Yield} \\ 742 \begin{tabular}{r | c | c | c | c | c | c | c | c} 743 Machine & \multicolumn{4}{c |}{Intel} & \multicolumn{4}{c}{AMD} \\ 744 \cline{2-9} 745 Variation & \multicolumn{2}{c|}{Park} & \multicolumn{2}{c |}{Yield} & \multicolumn{2}{c|}{Park} & \multicolumn{2}{c}{Yield} \\ 746 \cline{2-9} 672 747 \procs & 2 & 192 & 2 & 192 & 2 & 256 & 2 & 256 \\ 673 748 \hline … … 678 753 \end{tabular} 679 754 \end{centering} 680 \caption[Transfer Benchmark on Intel and AMD]{Transfer Benchmark on Intel and AMD\smallskip\newline Average measurement of how long it takes for all \ats to acknowledge the leader \at. DNC stands for ``did not complete'', meaning that after 5 seconds of a new leader being decided, some \ats still had not acknowledged the new leader.} 681 \label{fig:transfer:res} 682 \end{figure} 683 684 Figure~\ref{fig:transfer:res} shows the result for the transfer benchmark with 2 \procs and all \procs, where each experiment runs 100 \at per \proc. 755 \end{table} 756 757 Table~\ref{fig:transfer:res} shows the result for the transfer benchmark with 2 \procs and all \procs on the computer, where each experiment runs 100 \ats per \proc. 685 758 Note that the results here are only meaningful as a coarse measurement of fairness, beyond which small cost differences in the runtime and concurrent primitives begin to matter. 686 As such, data points that are the on the same order of magnitude as each other should be basicallyconsidered equal.687 Th e takeaway of this experiment is the presence of very large differences.688 The semaphore variation is denoted ``Park'', where the number of \ats dwindles downas the new leader is acknowledged.759 As such, data points within the same order of magnitude are considered equal. 760 That is, the takeaway of this experiment is the presence of very large differences. 761 The semaphore variation is denoted ``Park'', where the number of \ats dwindles as the new leader is acknowledged. 689 762 The yielding variation is denoted ``Yield''. 690 The experiment was only run for the extremes of the number of cores since the scaling per core behaves like previous experiments. 691 This experiments clearly demonstrate that while the other runtimes achieve similar performance in previous benchmarks, here \CFA achieves significantly better fairness. 692 The semaphore variation serves as a control group, where all runtimes are expected to transfer leadership fairly quickly. 693 Since \ats block after acknowledging the leader, this experiment effectively measures how quickly \procs can steal \ats from the \proc running leader. 694 Figure~\ref{fig:transfer:res} shows that while Go and Tokio are slower, all runtime achieve decent latency. 763 The experiment is only run for a few and many \procs since scaling is not the focus of this experiment. 764 765 The first two columns show the results for the semaphore variation on Intel. 766 While there are some differences in latencies, \CFA is consistently the fastest and Tokio the slowest, all runtimes achieve fairly close results. 767 Again, this experiment is meant to highlight major differences so latencies within $10\times$ of each other are considered equal. 768 769 Looking at the next two columns, the results for the yield variation on Intel, the story is very different. 770 \CFA achieves better latencies, presumably due to no synchronization with the yield. 771 Go does complete the experiment, but with drastically higher latency: 772 latency at 2 \procs is $350\times$ higher than \CFA and $70\times$ higher at 192 \procs. 773 This difference is because Go has a classic work-stealing scheduler, but it adds coarse-grain preemption 774 , which interrupts the spinning leader after a period. 775 Neither Libfibre nor Tokio complete the experiment. 776 Both runtimes also use classical work-stealing scheduling without preemption, and therefore, none of the work queues are ever emptied so no load balancing occurs. 777 778 Looking now at the results for the AMD architecture, the results show effectively the same story. 779 The first two columns show all runtime obtaining results well within $10\times$ of each other. 780 The next two columns again show \CFA producing low latencies, while Go still has notably higher latency but the difference is less drastic on 2 \procs, where it produces a $15\times$ difference as opposed to a $100\times$ difference on 256 \procs. 781 Neither Libfibre nor Tokio complete the experiment. 782 783 This experiment clearly demonstrates that \CFA achieves significantly better fairness. 784 The semaphore variation serves as a control, where all runtimes are expected to transfer leadership fairly quickly. 785 Since \ats block after acknowledging the leader, this experiment effectively measures how quickly \procs can steal \ats from the \proc running the leader. 786 Table~\ref{fig:transfer:res} shows that while Go and Tokio are slower using the semaphore, all runtimes achieve decent latency. 787 695 788 However, the yielding variation shows an entirely different picture. 696 Since libfibre and Tokio have a traditional work-stealing scheduler, \procs that have \ats on their local queues willnever steal from other \procs.697 The result is that the experiment simply does not complete for these runtime .698 Without \procs stealing from the \proc running the leader, the experiment will simply neverterminate.789 Since libfibre and Tokio have a traditional work-stealing scheduler, \procs that have \ats on their local queues never steal from other \procs. 790 The result is that the experiment simply does not complete for these runtimes. 791 Without \procs stealing from the \proc running the leader, the experiment cannot terminate. 699 792 Go manages to complete the experiment because it adds preemption on top of classic work-stealing. 700 However, since preemption is fairly costlyit achieves significantly worst performance.793 However, since preemption is fairly infrequent, it achieves significantly worst performance. 701 794 In contrast, \CFA achieves equivalent performance in both variations, demonstrating very good fairness. 702 Interestingly \CFA achieves better delays in the yielding version than the semaphore version, however, that is likely due to fairness being equivalent but removing the cost of the semaphores and idle -sleep.795 Interestingly \CFA achieves better delays in the yielding version than the semaphore version, however, that is likely due to fairness being equivalent but removing the cost of the semaphores and idle sleep.
Note:
See TracChangeset
for help on using the changeset viewer.