# NetAP: Adaptive Polling Technique for Network Packet Processing in Virtualized Environments
## 3 Design
### Adaptation Using Golden-Section Search
#### 3.4.1 Considerations for Alternative Algorithms
Simultaneous multi-threading was disabled, and an additional 1 GbE NIC for controlling the host system was installed to increase the reliability of the experiment. The Linux kernel used corresponded to version v5.1.5, released in May 2019. We ran several VMs on this host system and performed \(Netperf\) benchmarks on each VM that was connected to a separate Netperf server system. In the experiment, 64B packets were transmitted using TCP, and we measured the aggregated network bandwidth in Mbps. In this preliminary experiment, We executed one, two, three, and six Netperf threads on each of one, two, three, and six VMs. We increased the polling interval by 500 every 60 s, from 500 us to 5000 us, and observed the performance change that corresponded to each interval for each workload. We did not evaluate each interval separately, but continuously changed the interval. This is to determine how rapidly the effect of changing the polling interval becomes apparent. Figure 2 shows the result. The first item on the X-axis shows the performance of unmodified VirtIO without applying the periodic polling technique. Furthermore, the figure shows the performance that corresponds to up to 5000 us with gradual increments of 500 us. The performance is shown at five-second intervals. The overall trend forms a unimodal function in every case, and we can find the point where the performance is maximized. As summarized in Table 1, intervals up to a maximum of 3000 us maximized the performance for all workloads. The bandwidth comparison in Table 1 is the relative performance of the best network bandwidth as compared to the performance of unmodified VirtIO. Through the preliminary examination, we determined that the golden-section search algorithm can be applied to find the near-optimal polling interval in NetAP. We also found that the network performance changed immediately after the polling interval was changed. #### 3.4.3. Golden-Section Search Algorithm

Algorithm 2 obtains the near-optimal interval using golden-section search. First, \(R\) is the so-called golden ratio, which is 0.618, and \(MaxInterval\) and \(MinInterval\) are the predetermined maximum and minimum intervals, respectively. \(MinDistance\) is a predetermined minimum distance to stop the algorithm. The \(golden\_section\_searching()\) function is called by Algorithm 1 with the round, bytes, and previous interval as arguments. In the first and second rounds, \(interval_{low}\) and \(interval_{high}\) are set using \(MaxInterval\) and \(MinInterval\), respectively, with the same values of \(distance\), and the performance is collected for a \(round\_length\). From the third round, the function checks which value of \(interval_{low}\) or \(interval_{high}\) achieved higher performance. If \(interval_{low}\) has higher performance, \(interval_{high}\) is replaced by \(interval_{low}\), and \(interval_{low}\) is replaced by \((interval_{high}+distance)\). Conversely, if \(interval_{high}\) provides higher performance, \(interval_{low}\) is replaced by \(interval_{high}\), and \(interval_{high}\) is replaced by \((interval_{low}-distance)\). Subsequently, the updated interval is returned. Furthermore, \(distance\) is decreased by the golden ratio in each round. When \(distance\) is less than \(MinDistance\), the algorithm terminates, and the previous interval is returned without an update. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multicolumn{6}{c}{**Best Polling Interval (Us)**} & \multicolumn{6}{c}{**Bandwidth Comparison**} \\ \hline
**Threads** & **1** & **2** & **4** & **6** & **1** & **2** & **4** & **6** \\ \hline
1 VM & 2500 & 1500 & 500 & 500 & 136\% & 139\% & 119\% & 128\% \\ \hline
2 VMs & 3000 & 1500 & 500 & 500 & 142\% & 131\% & 116\% & 107\% \\ \hline
3 VMs & 3000 & 2500 & 2000 & 1000 & 163\% & 142\% & 111\% & 109\% \\ \hline
6 VMs & 3000 & 2500 & 2000 & 1500 & 163\% & 142\% & 111\% & 109\% \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Polling interval maximizing the bandwidth, and comparison with unmodified VirtIO.