Revision 44840f76 doc/arch/aquarium.tex

b/doc/arch/aquarium.tex
28 28
\maketitle
29 29
\begin{abstract}
30 30
    This paper describes the architecture for the Aquarium cloud infrastructure
31
    software.
31
    software. Aquarium is a new software we have built whose main function is to associate cloud resources usage with charging policies.
32 32
\end{abstract}
33 33

  
34 34
\category{D.3.3}{Programming Languages}{Language Constructs and Features}[Control structures]
......
134 134
failure, Aquarium must not corrupt any billing data under any circumstances,
135 135
while it should reach an operating state very fast after a service restart.
136 136

  
137
\section{Architecture}
138
\input{arch}
137
\section{Domain Modeling}
139 138

  
139
\subsection{Basic terminology}
140
We have already mentioned several entities in our description so far. Let us be a bit more specific on several key terms.
140 141

  
141
\section{Implementation}
142

  
142
\begin{description}
143
\item[Credits]
144
The analog of money. Credits are the `universal money` within Aquarium.
143 145

  
144
\subsection{The configuration DSL}
145
\label{sec:dsl}
146
The configuration requirements presented above were addressed by creating a new
147
domain specific language ({\sc dsl}), based on the YAML format.  The DSL
148
enables administrators to specify billable resources, billing policies and
149
price lists and combine them arbitrarily into agreements applicable to specific
150
users, user groups or the whole system. 
151
The DSL supports inheritance for policies, price lists and agreements and composition in the case of agreements.
152
It also facilitates the
153
definition of generic, repeatable debiting rules, which are then used by the
154
system to refill the user's account with credits on a periodic based.
146
\item[Resource]
147
A billable/chargeable entity. We generally need credits to use a resource. When a resource is used,  then consume credits. Examples of resources are the `download bandwidth` and, respectively,  the 'upload bandwidth', the `disk space` and the `VM time` to name a few. Generally speaking, the ``resource'' term specifies the type. A resource may have several properties attached, i.e. it name, unit of measure, a description of how its consumption translates to credit and whether it can have more than one instances.
155 148

  
156
The DSL is in itself based on five top-level entities, namely:
149
\item[Resource instance]
150
A user may have several instances of a resource type. For example, regarding a ``Virtual Machine'' resource, a user may have more then one of them. They are distinguished by their unique resource instance identifier. We call resources that can have more than one instance ``complex'' resources.
157 151

  
158
\begin{description}
152
\item[Resource event]
153
An event that is generated by a system, which is responsible for the resource.
154
The resource event describes a state change for the resource. In particular, a resource event records the time when that state change occurred (`occurredMillis` attribute) and the changed value (`value` attribute).
159 155

  
160
    \item[Resources] specify the properties of resources that Aquarium knows
161
        about. Apart from the expected ones (name, unit etc), a resource has
162
        two properties that affect billing: \textsf{costpolicy} defines the
163
        algorithm to be used to calculate the resource usage, while the
164
        \textsf{complex} attribute defines whether a resource can have one or
165
        many instances per user.
156
\item[Cost policy]
157
A cost policy refers to a resource and it is the policy used in order to charge credits for resource usage. Cost policies come in three flavors, namely \textsf{continuous}, \textsf{discrete} and \textsf{onoff}.
158
          
159
\item[Pricelists] assign a price tag to each resource, within a timeframe.
166 160

  
167
    \item[Pricelists] assign a price tag to each resource, within a timeframe.
168
    
169
    \item[Algorithms] specify the way the billing operation is done in response
170
        to a billing event. The simplest (and default) way is to multiply the 
171
        billable quantity with the applicable price. To enable more complex billing
172
        scenarios, the Aquarium DSL supports a simple imperative language with
161
\item[Charging algorithms] specify the way a resource event can generate consumed credits. 
162
A charging algorithm can be as simple as a direct multiplication of the 
163
        chargeable resource quantity with the applicable price. We offer the option, though, to define more complex charging  scenarios, the Aquarium DSL supports a simple imperative language with
173 164
        a number of implicit variables (e.g. \texttt{price, volume, date}) 
174 165
        that enable administrators to specify, e.g. billing algorithms that
175
        scale with billable volume. Similarily to pricelists, algorithms
166
        scale with billable volume. Similarily to price lists, charging algorithms
176 167
        have an applicability timeframe attached to them.
177

  
178
    \item[Crediplans] define a number of credits to give to users and a repetition
168
        
169
\item[Credit plans] define a number of credits to give to users and a repetition
179 170
        period.
180 171

  
181
    \item[Agreements] assign a name to algorithm, pricelist and creditplan triplets,
172
\item[Agreements] assign a name to a charging algorithm, pricelist and creditplan triplets,
182 173
        which is then assigned to each user.
174
        
175

  
176
\item[Resource instance state]
177
A value which is associated with a resource instance. Usually a floating point number, as in the $10.5$ MB designation regarding a possible ``total current downloading bandwidth''.
178

  
179
\item[User]
180
An owner of resources and credits. Users are defined externally of Aquarium.
181

  
182
\item[Resource event store]
183
A datatabase, in the general sense, where resource events are stored.
184

  
185
\item[User bill]
186
A, usually, periodic statement of how many credits the user has consumed. It may contain detailed analysis that relates consumed credits to resources.
187
  
188
\item[Billing period]
189
A time period at the end of which we issue a user bill.
190
A billing period is made of a starting date and a duration that is a multiple of a week.
191
A usual billing period starts on a particular month date (eg. 3rd) and lasts for a month.
192
Each resource type designates what happens to its accumulated value (if any) at the beginning of the billing period. Usually, at the beginning of the billing period, the accumulating amounts of resources are set accumulating amount. For example, for a monthly billing period, the total uploading bandwidth is reset to zero every month.
193
   
194
\item[User state]
195
The user state is made of the following distinct parts, of which the first two can be integrated to a unifying ``resource'' concept.
196

  
197
\begin{enumerate}
198
\item User credit state, that is the total credit amount for the user.
199

  
200
\item User resource state, which refers to the state of each resource instance that the user owns.
201

  
202
\item Processing state \TODO
203
\end{enumerate}
204

  
205
\item[Resource event processing]
206
The set of algorithmic steps by which a resource event leads to state changes of the user state.
183 207

  
184 208
\end{description}
185 209

  
186 210

  
211
\subsection{The configuration DSL}
212
\label{sec:dsl}
213
The configuration requirements of Aquarium  were addressed by creating a new
214
domain specific language ({\sc dsl}), based on the YAML format.  The DSL
215
enables administrators to specify chargeable resources, charging policies and
216
price lists and combine them arbitrarily into agreements applicable to specific
217
users, user groups or the whole system. 
218
The DSL supports inheritance for policies, price lists and agreements and composition in the case of agreements.
219
It also facilitates the
220
definition of generic, repeatable debiting rules, which are then used by the
221
system to refill the user's account with credits on a periodic base.
222

  
223
From the previously specified term, the following five are used in the DSL:
224

  
225
\begin{enumerate}
226
\item Resources
227
\item Charging algorithms
228
\item Pricelists
229
\item Credit plans
230
\item Agreements
231
\end{enumerate}
232

  
233

  
187 234
\begin{figure}
188 235
\lstset{language=c, basicstyle=\footnotesize,
189 236
stringstyle=\ttfamily, 
......
257 304
the user's balance, Aquarium performs account updates asynchronously and
258 305
concurrently for all users.
259 306

  
260
Before delving into the details of what things Aquarium computes and how these computations are performed, some terminology is needed. The following are the basic entities  involved.
261

  
262
\begin{description}
263
\item[Credits]
264
The analog of money. Credits are the `universal money` within Aquarium.
265

  
266
\item[Resource]
267
A billable/chargeable entity. We generally need credits to use a resource. When a resource is used,  then consume credits. Examples of resources are the `download bandwidth` and, respectively,  the 'upload bandwidth', the `disk space` and the `VM time` to name a few. Generally speaking, the ``resource'' term specifies the type.
268

  
269
\item[Resource instance]
270
A user may have several instances of a resource type. For example, regarding a ``Virtual Machine'' resource, a user may have more then one of them. They are distinguished by their unique resource instance identifier.
271

  
272
\item[Resource instance state]
273
A value which is associated with a resource instance. Usually a floating point number, as in the $10.5$ MB designation regarding a possible ``total current downloading bandwidth''.
274

  
275
\item[User]
276
An owner of resources and credits. Users are defined externally of Aquarium.
277

  
278
\item[Resource event]
279
An event that is generated by a system, which is responsible for the resource.
280
The resource event describes a state change for the resource. In particular, a resource event records the time when that state change occurred (`occurredMillis` attribute) and the changed value (`value` attribute).
281

  
282
\item[Resource event store]
283
A datatabase, in the general sense, where resource events are stored.
284

  
285
\item[Cost policy]
286
A cost policy refers to a resource and it is the policy used in order to charge credits for resource usage.
287
  
288
\item[User bill]
289
A, usually, periodic statement of how many credits the user has consumed. It may contain detailed analysis that relates consumed credits to resources.
290
  
291
\item[Billing period]
292
A time period at the end of which we issue a user bill.
293
A billing period is made of a starting date and a duration that is a multiple of a week.
294
A usual billing period starts on a particular month date (eg. 3rd) and lasts for a month.
295
Each resource type designates what happens to its accumulated value (if any) at the beginning of the billing period. Usually, at the beginning of the billing period, the accumulating amounts of resources are set accumulating amount. For example, for a monthly billing period, the total uploading bandwidth is reset to zero every month.
296
   
297
\item[User state]
298
The user state is made of the following distinct parts, of which the first two can be integrated to a unifying ``resource'' concept.
299

  
300
\begin{enumerate}
301
\item User credit state, that is the total credit amount for the user.
302 307

  
303
\item User resource state, which refers to the state of each resource instance that the user owns.
304

  
305
\item Processing state \TODO
306
\end{enumerate}
307

  
308
\item[Resource event processing]
309
The set of algorithmic steps by which a resource event leads to state changes of the user state.
310
\item[]
311

  
312
\item[]
313

  
314
\item[]
315

  
316
\item[]
317

  
318
\item[]
319

  
320

  
321
\end{description}
322 308

  
323 309
Per resource, the charging operation is affected by the cost policy and complexity
324 310
parameters. Specifically, the 3 available cost policies affect the calculation 
......
399 385
\subsection{User State}
400 386
\label{sec:ustate}
401 387

  
388
\section{Architecture}
389
\input{arch}
390

  
402 391
\section{Performance}
403 392

  
404 393
To evaluate the performance and scalability of Aquarium, we performed two

Also available in: Unified diff