\section{Preliminaries} \label{Concepts}
In this section we present the general concepts associated with the SOA paradigm, implementation and relationship between SOA users, highlighting the legal clauses usually agreed among them, particularly those related with DB performance guarantees. 

In order to provide a way for improve the SOA contracts negotiation, we also introduce the technical foundation used for that. 
In particular, we briefly describe GSPN and probability distributions concepts, essentials to develop the proposed model for DB performance evaluation. 


\subsection{SOA and Related Concepts}

SOA emerges as a new paradigm for information planning and business processes integration. SOA is not a tool, but principles or concepts. This architecture is defined on the basis of three fundamental technical concepts~\cite{Josuttis2008}, as follows:

\textbf{Functionality as services}: service is a SOA element that operates independently from the other components of the system. Usually, a services receives one or more requests, processes them, and returns its contributions, through an interface;

\textbf{Enterprise Service Bus (ESB)}: is the infrastructure that provides interoperability between different distributed systems and services. From a more practical perspective, the ESB can be understood as a mean by which a client invokes one or more services provided by suppliers;

\textbf{Loose coupling}: by focusing on large distributed systems, SOA supports the reduction of dependence between services, avoiding that a failure or maintenance affects significantly other services.


The most widely used language for SOA systems orchestrations is BPEL~\cite{BPEL}. Through simple primitives and a distributed nature, BPEL provides facilities for orchestrating modern business logic flow, where complex operations are supported by nesting basic activities. The basic structures of BPEL are {\em Invoke, Receive, Assign, Wait} and {\em Reply}. The composite structures involve {\em Sequence, If, Pick, RepeatUntil/While/ForEach} and {\em Flow}. 

In the SOA world, the service commitments between customers and providers are expressed by contracts, known as Service Level Agreements (SLA)~\cite{Sturm2000}. 
A SLA expresses responsibilities and rights with respect to QoS levels, such as but not limited to response time, availability, cost, etc. \cite{DireitoDigital}. 
It also foresees the penalties for the cases where the quality falls below the promised standard \cite{Massarelli2008}. 

One can imagine how difficult is to fulfill this type of commitment, when dealing with highly variable environments, as is the case of the SOA scenarios. 
Successful examples have been achieved by adopting predictive models to support the SLA planning for network and web service transactions. 
Here, we suggest an approach that helps to define SLA clauses for SOA databases performance, which is disregarded by the existent alternatives. 
Before that, however, it is essential to clarify the main concepts related with our proposal, like those presented in the following.


\subsection{Generalized Stochastic Petri Nets - GSPN}

Among the several extensions of the Petri Nets, the timed ones \cite{Merlin1976} \cite{Murata1989} are shown to be powerful for the modeling of time-dependent process, as communication protocols, systems performance, hardware design and so on. 

For the cases where the explored timed processes demand a non-deterministic representation, an efficient alternative is to adopt GSPN (Generalized Stochastic Petri Nets \cite{Marsan1995}) extensions, which associate timed and non-timed (immediate) transitions, in a way that the time is represented through random variables \cite{MaloyGSPN}. 

The GSPN are extensively used, specially for systems performance evaluations since, in these cases, the analyzed behaviors are naturally stochastic. 
The model proposed in this paper, was built and simulated through GSPN structures. 
Alternatively, extensions like CPN - Coloured Petri Nets \cite{Jensen1997} could be considered. 
However, CPN express the time through integer values, handled directly in the model, by the designer. 
Meanwhile, in GSPN it is implicit into continuous variables, which is much more efficient and useful.

In a GSPN structure, these variables are represented by timed transitions, with exponential distribution. 
Nevertheless, there may be modeling situations that require representing non exponential behaviors. 
Thus, it is essential to discuss the main distributions that a random variable can assume. 
In the GSPN model, it is represented by combining arrangements of exponential transitions, as discussed in the following.  


\subsection{Probability Mass Functions - PMF}\label{Distrib}
Assuming a discrete scope, a Probability Mass Function (PMF) is a stochastic function that associates each random variable with each one of its possibly assumed values \cite{Cassandras2008} \cite{Jain1991}. 
Among the most common distributions are the Binomial, Geometric, Poisson, Erlang, Hyper-exponential, Hypo-exponential and Exponential, where the last four mentioned ones, are depicted in Fig.~\ref{imgDistrib} \cite{Desrochers1994}.
%###################################
\begin{figure}[h]
         \centering
        \includegraphics[height=5.5cm, width=14cm]{IMG/Distrib.png}
         \caption{Example of Probability Distributions}
         \label{imgDistrib}
\end{figure}
%###################################   

In the following, we briefly discuss each of them, using average ($\mu$) and standard deviation ($\sigma$) parameters to characterize them. 


\subsubsection{Exponential}
This distribution is indicated for situations where:
$$
\frac{\mu}{\sigma} = 1.
$$ 

In GSPN, representing an exponential distribution requires assigning $\mu$ as the temporal parameter ($\lambda$) for a timed transition. 

\subsubsection{Hyper-Exponential}
It is commonly used in a behavioral situation where: 
$$
\frac{\mu}{\sigma} < 1.
$$ 

Thus, a GSPN Hyper-Exponential structure receives the following parameters:
$$
\lambda_h = \frac{2\mu}{(\mu^2 + \sigma^2)};
~~~~~~~~~~
r_1 = \frac{2\mu^2}{(\mu^2 + \sigma^2)};
~~~~~~~~~~
r_2 = 1 - r_1.
$$

\subsubsection{Erlang}
Erlang consists in a special case of an exponential distribution, that is triggered several times. 
Usually an Erlang is adopted for the cases whose behavior is characterized by:
$$
\frac{\mu}{\sigma} \in \mathbb{Z}  ~\wedge~  \frac{\mu}{\sigma} \neq 1.
$$  
The parameters of this distributions are as follows:
$$
\gamma = (\frac{\mu}{\sigma})^2; ~~~~~~~~~ \lambda = (\frac{\gamma}{\mu}).
$$


\subsubsection{Hypo-exponential}
This distribution is particularly important for this work, since it is used for conduct the case study. A Hypo-exponential distribution is normally adopted to represent behaviors where:
$$
\frac{\mu}{\sigma} > 1 ~\wedge~ \frac{\mu}{\sigma} \neq \mathbb{Z}.
$$ 

Its parameters are obtained according to the following equations:
$$
			\left(
			\begin {array}{ll}
			\frac{\mu}{\sigma}
			\end{array}
			\right)^2 - 1 \leq \gamma < 
			\left(
			\begin {array}{ll}
			\frac{\mu}{\sigma}
			\end{array}
			\right)^2;
~~~~~~~~~
\lambda_1 = \frac{\gamma + 1}{\mu \mp \sqrt{\gamma(\gamma + 1) \sigma^2 - \gamma \mu^2}};
~~~~~~~~~
\lambda_2 = \frac{\gamma + 1}{\gamma \mu \pm \sqrt{\gamma(\gamma + 1) \sigma^2 - \gamma \mu^2}}.
$$

As can be seen, a Hypo-exponential function matches Exponential and Erlang distributions. 
Observe that $\lambda_1$ represents an exponential approximation, while $\lambda_2$ maps an Erlang distribution, since the $\gamma$ parameter is used as a sequencer of Exponential triggers. 
