Commit e9c9a29bbb2dfb4bd84ad35d582e044a8feec7bb
1 parent
48ed9276
Certainty section.
Showing
1 changed file
with
40 additions
and
48 deletions
certainty.tex
| @@ -86,7 +86,7 @@ ways for the developer to guide and control any step in the process. | @@ -86,7 +86,7 @@ ways for the developer to guide and control any step in the process. | ||
| 86 | \subsubsection{Runtime control} | 86 | \subsubsection{Runtime control} |
| 87 | 87 | ||
| 88 | To begin, we briefly outline how our Android prototype implements the | 88 | To begin, we briefly outline how our Android prototype implements the |
| 89 | -\texttt{maybe} statement. We (1) rewrite each \texttt{maybe} code block to an | 89 | +\texttt{maybe} statement. We (1) rewrite each \texttt{maybe} statement to an |
| 90 | \texttt{if-else} statement controlled by a call into the \texttt{maybe} | 90 | \texttt{if-else} statement controlled by a call into the \texttt{maybe} |
| 91 | system and (2) generate a similar setter for each \texttt{maybe} variable. | 91 | system and (2) generate a similar setter for each \texttt{maybe} variable. |
| 92 | Variable values and code branches are now all under the control of a separate | 92 | Variable values and code branches are now all under the control of a separate |
| @@ -120,13 +120,12 @@ are difficult to know \textit{a priori}, particularly when new apps or | @@ -120,13 +120,12 @@ are difficult to know \textit{a priori}, particularly when new apps or | ||
| 120 | functionalities are being investigated. So in most cases we believe | 120 | functionalities are being investigated. So in most cases we believe |
| 121 | post-deployment testing will be required. | 121 | post-deployment testing will be required. |
| 122 | 122 | ||
| 123 | -However, pre-deployment testing may still be a valuable approach, particularly | ||
| 124 | -when a large amount of uncertainties are present and a correspondingly-large | ||
| 125 | -number of \texttt{maybe} statements are being used. Since this can explode | ||
| 126 | -the adaptation space, simulation may be able to help guide the developer's | ||
| 127 | -choices of which \texttt{maybe} statements may have a significant impact on | ||
| 128 | -performance and should be assessed first. Other \texttt{maybe} statements | ||
| 129 | -can be assessed later or eliminated altogether. | 123 | +However, pre-deployment testing may still be a valuable approach, |
| 124 | +particularly when a large number of \texttt{maybe} statements are being used. | ||
| 125 | +Since this can explode the adaptation space, simulations may be able to help | ||
| 126 | +guide the developer's choices of which \texttt{maybe} statements may have a | ||
| 127 | +significant impact on performance and should be assessed first. Other | ||
| 128 | +\texttt{maybe} statements can be assessed later or eliminated. | ||
| 130 | 129 | ||
| 131 | \subsubsection{Split testing} | 130 | \subsubsection{Split testing} |
| 132 | 131 | ||
| @@ -164,9 +163,8 @@ battery level; and so on. | @@ -164,9 +163,8 @@ battery level; and so on. | ||
| 164 | 163 | ||
| 165 | \end{itemize} | 164 | \end{itemize} |
| 166 | % | 165 | % |
| 167 | -This dataset is periodically uploaded to the \texttt{maybe} server by the | ||
| 168 | -\texttt{maybe} service and used to drive the adaptation approaches discussed | ||
| 169 | -next. | 166 | +This dataset is periodically uploaded to the \texttt{maybe} server and used |
| 167 | +to drive the adaptation approaches discussed next. | ||
| 170 | 168 | ||
| 171 | \subsubsection{Simultaneous split testing} | 169 | \subsubsection{Simultaneous split testing} |
| 172 | 170 | ||
| @@ -174,24 +172,23 @@ While large-scale split testing is intended to provide good coverage over all | @@ -174,24 +172,23 @@ While large-scale split testing is intended to provide good coverage over all | ||
| 174 | possible sources of uncertainty we have discussed, it still normally requires | 172 | possible sources of uncertainty we have discussed, it still normally requires |
| 175 | that only one choice be made at any given time---implying that two | 173 | that only one choice be made at any given time---implying that two |
| 176 | alternatives may \textit{never} be evaluated under identical conditions. For | 174 | alternatives may \textit{never} be evaluated under identical conditions. For |
| 177 | -\texttt{maybe} code blocks, however, we are exploring the idea of performing | 175 | +\texttt{maybe} statements, however, we are exploring the idea of performing |
| 178 | \textit{simultaneous} split testing. In this model the app forks at the top | 176 | \textit{simultaneous} split testing. In this model the app forks at the top |
| 179 | -of the \texttt{maybe} block, executes and scores all alternatives, and then | 177 | +of the \texttt{maybe} statement, executes and scores all alternatives, and then |
| 180 | continues with the outputs from the best alternative at the bottom of the | 178 | continues with the outputs from the best alternative at the bottom of the |
| 181 | \texttt{maybe} statement. On single-core devices this can be done in serial, | 179 | \texttt{maybe} statement. On single-core devices this can be done in serial, |
| 182 | while the growing number of multi-core smartphones provides the option of | 180 | while the growing number of multi-core smartphones provides the option of |
| 183 | doing this in parallel. The benefit of this approach is that each alternative | 181 | doing this in parallel. The benefit of this approach is that each alternative |
| 184 | is executed under near-identical conditions. The drawbacks include the | 182 | is executed under near-identical conditions. The drawbacks include the |
| 185 | overhead of the redundant executions and the possibility for interference | 183 | overhead of the redundant executions and the possibility for interference |
| 186 | -between alternatives executing in parallel. However, we are excited to | ||
| 187 | -explore this option in our prototype. | 184 | +between alternatives executing in parallel. |
| 188 | 185 | ||
| 189 | \subsection{\texttt{\large maybe} Endgames} | 186 | \subsection{\texttt{\large maybe} Endgames} |
| 190 | 187 | ||
| 191 | The entire \texttt{maybe} approach is predicated on the fact that there does | 188 | The entire \texttt{maybe} approach is predicated on the fact that there does |
| 192 | exist, among the alternatives, a right choice, even if it depends on many | 189 | exist, among the alternatives, a right choice, even if it depends on many |
| 193 | factors and uncertainties. We continue by discussing how the dataset | 190 | factors and uncertainties. We continue by discussing how the dataset |
| 194 | -generated by post-deployment testing can be consumed to determine how to | 191 | +generated by post-deployment testing can be used to determine how to |
| 195 | correctly choose \texttt{maybe} alternatives at runtime. | 192 | correctly choose \texttt{maybe} alternatives at runtime. |
| 196 | 193 | ||
| 197 | \subsubsection{Simple cases} | 194 | \subsubsection{Simple cases} |
| @@ -203,11 +200,10 @@ testing of that alternative and even automatically rewrite that portion of | @@ -203,11 +200,10 @@ testing of that alternative and even automatically rewrite that portion of | ||
| 203 | code to remove the \texttt{maybe} statement. However, it is also possible | 200 | code to remove the \texttt{maybe} statement. However, it is also possible |
| 204 | that the situation may change in the future when a new device, or Android | 201 | that the situation may change in the future when a new device, or Android |
| 205 | version, or battery technology is introduced, and so the programmer may also | 202 | version, or battery technology is introduced, and so the programmer may also |
| 206 | -choose to preserve the alternatives to enable continuous adaptation as | ||
| 207 | -described in Section~\ref{subsec-continuous}. | 203 | +choose to preserve the flexibility in case it is useful in the future. |
| 208 | 204 | ||
| 209 | The slightly more complicated case is when testing reveals that alternatives | 205 | The slightly more complicated case is when testing reveals that alternatives |
| 210 | -provide stable tradeoffs between energy and performance---one block always | 206 | +provide stable tradeoffs between energy and performance---one alternative always |
| 211 | saves energy at the cost of performance. In this case the system only has to | 207 | saves energy at the cost of performance. In this case the system only has to |
| 212 | determine whether to prioritize energy or performance. While this decision | 208 | determine whether to prioritize energy or performance. While this decision |
| 213 | seems simple, it is itself complicated by differences in battery capacity, | 209 | seems simple, it is itself complicated by differences in battery capacity, |
| @@ -226,11 +222,10 @@ second, somewhat easier case. | @@ -226,11 +222,10 @@ second, somewhat easier case. | ||
| 226 | 222 | ||
| 227 | If the alternative is determined through static adaptation then the correct | 223 | If the alternative is determined through static adaptation then the correct |
| 228 | choice is a function of some unchanging (or very-slowly changing) aspect of | 224 | choice is a function of some unchanging (or very-slowly changing) aspect of |
| 229 | -the deployed environment. Examples include the model of the device, overall | ||
| 230 | -network conditions in the country in which the device is being used, the | ||
| 231 | -other apps installed on the device, or some slowly-changing user | ||
| 232 | -characteristic such as gender, age, or charging habits. In this case it is | ||
| 233 | -possible that the correct alternative can be determined through some | 225 | +the deployed environment. Examples include the device model, average network |
| 226 | +conditions, the other apps installed on the device, or some slowly-changing | ||
| 227 | +user characteristic such as gender, age, or charging habits. In this case it | ||
| 228 | +is possible that the correct alternative can be determined through some | ||
| 234 | clustering based on these features, and once determined will remain the best | 229 | clustering based on these features, and once determined will remain the best |
| 235 | choice over long time intervals. | 230 | choice over long time intervals. |
| 236 | 231 | ||
| @@ -243,37 +238,34 @@ single alternative can be chosen even for a single user. Instead, the | @@ -243,37 +238,34 @@ single alternative can be chosen even for a single user. Instead, the | ||
| 243 | \texttt{maybe} system allows developers to evaluate one or more strategies to | 238 | \texttt{maybe} system allows developers to evaluate one or more strategies to |
| 244 | drive the runtime alternative selection process. | 239 | drive the runtime alternative selection process. |
| 245 | 240 | ||
| 246 | -Note that \texttt{evaluate} blocks are \textit{not} intended to accomplish this | ||
| 247 | -kind of adaptation. First, they run after the \texttt{maybe} block has been | ||
| 248 | -executed, not before. Second, a single strategy defeats the flexibility | ||
| 249 | -inherent to the \texttt{maybe} approach and would devolve into the same | ||
| 250 | -fragile decision-making logic we are trying to avoid. | ||
| 251 | - | ||
| 252 | -Instead, the \texttt{maybe} system allows developers to experiment with and | ||
| 253 | -evaluate a variety of different dynamic adaptation strategies deployed in a | ||
| 254 | -companion library, with the choice guided by post-deployment testing. For | ||
| 255 | -example, if the performance of an alternative is discovered to be correlated | ||
| 256 | -with the presence of a network link with over a certain bandwidth, then that | ||
| 257 | -adaptation strategy can be connected with that particular \texttt{maybe} | ||
| 258 | -block. | 241 | +Note that \texttt{evaluate} blocks are \textit{not} intended to accomplish |
| 242 | +this kind of adaptation. First, they run after the \texttt{maybe} statement | ||
| 243 | +has been executed, not before. Second, per-\texttt{maybe} strategy defeats | ||
| 244 | +the flexibility inherent to the \texttt{maybe} approach and would devolve | ||
| 245 | +into the fragile decision-making we are trying to avoid. Instead, the | ||
| 246 | +\texttt{maybe} system allows developers to experiment with and evaluate a | ||
| 247 | +variety of different dynamic adaptation strategies deployed in a companion | ||
| 248 | +library, with the choice guided by post-deployment testing. For example, if | ||
| 249 | +the performance of an alternative is discovered to be correlated with a link | ||
| 250 | +providing a certain amount of bandwidth, then that adaptation strategy can be | ||
| 251 | +connected with that particular \texttt{maybe} statement. | ||
| 259 | 252 | ||
| 260 | Observe that in some cases of dynamic adaptation, what begins as a | 253 | Observe that in some cases of dynamic adaptation, what begins as a |
| 261 | -\texttt{maybe} statement may end as effectively \texttt{if-else} block | ||
| 262 | -switching on some of the same static thresholds that we attacked to motivate | 254 | +\texttt{maybe} statement may end as effectively \texttt{if-else} statement |
| 255 | +switching on a static threshold---the same approach we attacked to motivate | ||
| 263 | our system. However, through the process of arriving at this point we have | 256 | our system. However, through the process of arriving at this point we have |
| 264 | -determined several things that were initially unknown: What the alternatives | 257 | +determined several things that were initially unknown: what the alternatives |
| 265 | accomplish, that a single threshold works for all users, and what that | 258 | accomplish, that a single threshold works for all users, and what that |
| 266 | -threshold is. And if the developer chooses to maintain that statement as a | ||
| 267 | -\texttt{maybe} block, they can continue to perform testing and modify their | ||
| 268 | -adaptation strategy as devices and users change. | 259 | +threshold is. And by maintaining the choice as a \texttt{maybe} statement, |
| 260 | +they can continue the adaptation process as devices, users, and networks | ||
| 261 | +change. | ||
| 269 | 262 | ||
| 270 | Another benefit of this approach is that time-varying decisions can be | 263 | Another benefit of this approach is that time-varying decisions can be |
| 271 | outsourced to developers with expertise in the particular area driving | 264 | outsourced to developers with expertise in the particular area driving |
| 272 | -adaptation policy decisions. For example, if the developer chooses to make a | ||
| 273 | -energy-performance tradeoff dynamically based on the energy conditions at | ||
| 274 | -that time, they can connect that \texttt{maybe} statement to a sophisticated | ||
| 275 | -machine learning algorithm written by an expert in energy adaptation, instead | ||
| 276 | -of being forced to implement their own simplistic approach. | 265 | +adaptation policy decisions. For example, by exposing an energy-performance |
| 266 | +tradeoff through a \texttt{maybe} statement, a developer allows it to be | ||
| 267 | +driven by a sophisticated machine learning algorithm written by an expert in | ||
| 268 | +energy adaptation, instead of their own ad-hoc approach. | ||
| 277 | 269 | ||
| 278 | \subsubsection{Manual adaptation} | 270 | \subsubsection{Manual adaptation} |
| 279 | 271 |