Diffusion Model of Preemptive-Resume Priority Systems and Its Application to Performance Evaluation of SDN Switches

The increasing use of Software-Defined Networks brings the need for their performance analysis and detailed analytical and numerical models of them. The primary element of such research is a model of a SDN switch. This model should take into account non-Poisson traffic and general distributions of service times. Because of frequent changes in SDN flows, it should also analyze transient states of the queues. The method of diffusion approximation can meet these requirements. We present here a diffusion approximation of priority queues and apply it to build a more detailed model of SDN switch where packets returned by the central controller have higher priority than other packets.


Introduction and an Overview of Existing Results
Software-Defined Networking (SDN), flexible in service of various applications, becomes an alternative to the classical Internet. Traffic and its routing are supervised here by a programmable central controller; its frequent decisions adapt the routing to the current load observed in the network switches, aiming to avoid their congestion. The controller may also activate and deactivate switches to save energy. The network supports multiple classes of traffic having different statistical behavior with different QoS requirements. The service differentiation and QoS provisioning techniques may lead to non-stationarity in the overall traffic of the network. Therefore, traffic intensity in SDN switches is frequently changing. It is recommended that an investigation of performance based on queueing models should allow the transient analysis of packet queues in the switches.
SDN is already an advanced technique. The article [1] presents the history and evolution of programmable networks starting from telephone networks, through packet networks, then Internet, and finally to SDN networks over almost 50 years. An overview of the SDN network, its scalability, elasticity, reliability, and availability are shown in [2]. Reference [3] discusses SDN performance within a data center. Improvements are classified following data, control, and application planes and network type: cloud, wireless and wide-area. The article [4] reviews SND's significant benefits and possible applications. A comparison of various SDN programming languages, such as Flow-based Management Language, then Nettle, Procera, Frenetic, Netcore, Frenetic-OCaml, Pyretic, and NetKAT, is given in [5]. Paper [6] presents an industry survey conducted among IT professionals on network virtualization and SDN within cloud computing, discussing its scalability and roadmap.
Several papers focus on control and data planes issues of SDN controllers; e.g., Reference [7] addresses the problem of logical consistency within data plane nodes when policy assumed that the average number of packets at steady state is equal to the average number of packets in non-stationary queue at equilibrium point [42]. Such a model is approximate and limited to mean values (but not distributions) of queues and delays, and it cannot give us, e.g., loss probabilities.
In general, to model stations in a transient regime, the choice of the method includes numerical solution of Markov models, fluid flow approximation, e.g., Reference [43], and diffusion approximation [44]. In Markov models solved numerically, the interarrival and service time distributions may be represented by a system of exponentially distributed phases and fitted to any distribution. Special tools can do this automatically, e.g., Reference [45]. However, this approach is bounded by state explosion; the number of the differential equations (one equation per one state of the model) becomes intractable. Fluid flow approximation, e.g., Reference. [46], similar to the approach presented in [41], may be applied to large topologies. However, it is less exact than the third approach, which is diffusion approximation. We opt for the latter method as it combines transient solutions with the possibilities of including general distributions into the model, and its results are in the form of distributions, not only mean values.
Recently, we have already applied diffusion approximation in modeling a single SDN switch [47] and a network of switches [48]. These models represent an SDN switch as a G/G/1/N station, disregarding communication between the switch and the controller. Here, we develop a diffusion model of a priority station using ideas we proposed in [49], test its quality, and apply it to investigate the communication between the switch and controller. When the flow of an arriving to the switch packet is not identified (it does not exist in the table of flows of the switch), the packet is sent through the uplink channel to the controller to decide on its routing. Then, it returns to the switch with information on its itinerary and is served on a priority basis. Except for the use of the same method, the models and results in [47,48] and here are different. The extension of the presented model into a more complex system of switches and controllers is straightforward.
The rest of the article is organized as follows. Section 2 presents the known diffusion model of a single FIFO station and proposes a new one with priority queues. Section 3 investigates the quality of the priority model using numerical examples, Section 4 presents the rules of a network model composed of single-station models, Section 5 presents an example where diffusion models are implemented to analyze the performance of SDN switch and its communications with the SDN controller, and conclusions are presented in Section 6.

First-In-First-Out G/G/1/N Station
With this method, proposed in [44], the distribution of the number of queued packets in the buffer is represented by the density function of a diffusion process.
The idea comes from the observation that the queue N(t)-a discrete stochastic process-and the diffusion proces X(t)-a continuous stochastic process-both have normally distributed changes. For any distribution A(x) of interarrival times, with mean 1/λ and variance σ 2 A , the number of arrivals during an interval ∆ tends to the normal distribution with mean λ∆ and variance σ 2 A λ 3 . For any distribution B(x) of service times with mean 1/µ and variance σ 2 B , the number of completed services during ∆ tends to the normal distribution with mean µ∆ and variance σ 2 B µ 3 ∆. Therefore, after the interval ∆, the changes in the number of customers present in the queue are subject to the normal distribution with (λ − µ)∆ and variance (σ 2 A λ 3 + σ 2 B µ 3 )∆. The diffusion process with density function, if unrestricted, given by Equation (1) has normally distributed changes in δt with mean βt and variance αdt; therefore the choice of these parameters where C 2 A = σ 2 A λ 2 and C 2 B = σ 2 B µ 2 are the square coefficients of variation of A(x), B(x) distributions, enhances similarity of N(t) and X(t).
The diffusion process should be constrained by barriers, following the limitations of a real queue: one barrier is placed at x = 0 and the other (if the queue size is limited to N customers) at x = N; X(t) = 0 means that the queue is empty at time t (idle period of the station), and X(t) = N means that the queue is saturated and the arriving customers are rejected (saturation period). We assume that they correspond to interarrival and service times, but in fact these are rather their residual lifetimes; e.g., the idle time is not the interarrival time but the time between the moments when the last customer in the previous busy period left the system and the first in the next busy period came. Following [44], we assume that the process after a stay at x = 0 jumps to x = 1 with intensity λ (arrival of a first customer in the new busy period) and jumps from N to N − 1 with intensity µ (departure of a customer de-blocking the queue). In this case, p 0 (t) and p N (t) denote the probabilities that the process is at a barrier at time t, and their terms refer to the jumps from barriers. The probabilities of being in the barriers are defined by additional balance equations: The steady-state solution of the above equations, when the system is in stochastic equilibrium and state probabilities do not depend on time, is given in [44] where z = 2β α . Normalization gives us probabilities p 0 and p N . The transient solution of Equations (3)-(5) may be obtained with an analyticalnumerical algorithm proposed in [50], used and discussed, e.g., in [51] and recently in [48]. First, the diffusion equation is solved with absorbing barriers at x = 0 and x = N; i.e., the process is ended when it reaches a barrier. The solution φ(x, t; x 0 ) is [52] φ(x, t; where: Then, the density of the diffusion process having barriers with jumps is expressed with the use of functions φ(x, t; where g 1 (t) and g N (t) are derived with the use of balance Equations (4) and (5). This is the transient solution, but it assumes constant parameters of equations. If they are changing with time, e.g., if the flow intensity λ is time-dependent, and, in consequence, we have α(t) and β(t), the diffusion equation is solved in short time intervals where the parameters of the equation are considered constant and change their values only with the change in the interval. The solution at the end of an interval is used as the initial condition for the next interval.
The solution f (x, t) approximates the distribution of the queue length. The density of the queue latency (response time) is obtained with the use of the first passage time; i.e., the time the process needs to walk a certain distance. The density function γ x 0 ,0 (t) of the first passage time from x = x 0 to x = 0, A new customer who joins the queue at time t has, with probability density f (x, t), x customers ahead him. The queueing delay is equivalent to the time the process needs to go from the initial point x to 0 (corresponding to the customer service). The pdf of the delay introduced by the queue length distribution with density f (ξ, t; ψ) is then The input traffic may be non-homogeneous, composed of independent flows called classes, k = 0, 1, . . . K that have input parameters λ (k) , σ (k) A 2 specific to each class and ser- waiting for service in the common FIFO queue. In this case, the number of all class customers coming to the system has a normal distribution with mean and variance being the sum of corresponding means and variances. The input and service parameters for the total flow of customers are [53] where λ (k) /λ is the probability that a customer belongs to a class k. The diffusion process where α and β have the above parameters gives the approximation of p(n) and the distribution of the total number of customers in the station, and then for any class k, the distribution p (k) (ν)

Preemptive-Resume G/G/1/N/PRIOR Station
The above classic model of G/G/1/N station with FIFO queue may be extended to the case of multiple classes of customers, with each class having its own priority. Depending on the type of priorities, the service of these clients is different. There are three categories of interrupted service queues: (1) postponable, (2) preemptive-resume, and (3) preemptive repeat. The first category assumes that when a new client with higher priority comes to the system, he waits for the end of the service of the currently serviced client (the current service is not interrupted). The second and third category assume interruption with the service of the currently serviced client and the start of the service of the new client. However, after the end of the service of the higher privileged clients, the preemptive-resume interruption continues the service of the client and preemptive-repeat starts the client service from the beginning. A good review of classical models of priority systems is given in [54]. It refers in general to M/G/1/PRIOR steady-state models. Below, we deal with preemptive-resume priorities. Our model, similarly to in the case of one class of customers, assumes general distributions of interarrival times and service times at each priority level and limited to N number of customers of each priority.
We keep the notation described in the previous section of adding upper index (k) to identify the priority class k = 0, 1, . . . L, k = 0 as the highest priority, and k = L as the lowest. This way, 1/λ (k) and σ (k) 2 A refer to the mean and variance of interarrival times of class k customers, and 1/µ (k) and σ (k) 2 B refer to the mean and variance of their service times; p (k−1) 0 (t) is probability that at time t there are no customers of class k in the system. We will also consider a diffusion process X K (t), which refers to the joint number of customers of classes 0 . . . K in the system; parameters α K and β K refer to its movement, and f K (x, t; x 0 ) denotes its pdf. With the same arguments as for one class in the previous section, we may say that the number of customers of several classes counted jointly at arrival and departure has a normal distribution. The diffusion process may describe the evolution of this number of customers in the system. However, only the input processes of these classes are independent. The output process of a class k is dependent on the processes of all higher classes: the service of a customer of class k may be finished only if customers of classes 0 . . . k − 1 are absent in the system. Therefore, the parameters α K , β K may be written as where Let v (K) (n, t) denote the probability that n customers of class K are present at time t in the system, and let p K−1 (n, t) denote the probability that n customers of all classes 0, . . . K − 1 are present at time t in the system. Obviously, for the highest priority class and for other classes Note that index K refers to classes 0, . . . , K and index (K) to the single class K.
Denote by E[n (k) (t)] the mean number of customers class k present in the system and by E[n K (t)] the mean number of customers class 0 . . . K in the system A sketch of the algorithm is as follows: • K = 0: we consider the highest priority class k = 0 alone and use the single class model presented in the previous section. The customers of lower classes are transparent for k = 0 class; therefore, the solution is correct.
Note that for the mean values, Before analyzing the waiting times, we have to define the distribution of the completion time. The completion time is the period between the start and the end of any customer service. On the highest priority level, the completion time is equal to the service time; for other classes, it also includes interruptions caused by the arrival and service of higher-priority customers. Suppose T is the service time of a customer of class k. If n customers of classes 1, . . . , k − 1 arrive during the time T, the service will be interrupted n times; n has an approximately normal distribution with the mean ∑ k−1 l=0 λ (l) T and the variance ∑ k−1 l=0 λ (l) C (l) 2 A T. The duration of any of n breaks is distributed like the busy period γ (k−1) of the system serving customers of classes 0, . . . , k − 1. The busy period starts with the arrival of a customer to the empty system and lasts until the moment when the system becomes empty. Its duration may be seen as the first passage time from x 0 = 1 (first customer arrives) to x = 0 (nobody in the system) and is given by Equation (9) with parameters corresponding to the diffusion process with K − 1 classes. For the sake of simplicity, we neglect here the weak probability that the process, before it comes to zero, may reach the upper barrier at N, stay there, jump to N − 1, come back to N, etc.
The total time of breaks in T has the pdf where p n|T is the probability of n breaks in T and γ (k−1)( * n) (t) is the n-fold convolution of where 1(t) = 0 for t < 0 and 1(t) = 1 for t ≥ 0, and from its Laplace transform where Λ (k) = ∑ k l=0 λ (l) . When all input streams are Poisson, i.e., C (l) 2 A = 1, l = 1, . . . , k, the results are identical to the exact formulae given for this case in [54].
Finally, similarly as in Equation (10), we can define the pdf of the delay (response time) at every priority level k: In the pdf of the first passage time γ ξ,0 (x) for a priority k, the mean and variance of the service time should be replaced by the mean and variance of the completion time c (k) . Mean waiting time E[w (k) ] to start the service is

Validation of the Priority Model
Diffusion approximation remains a heuristic approach, and we do not know strict bounds on its errors; therefore, we should check its quality in various cases. The errors of the method in case of FIFO queue as presented in Section 2.1 were discussed, e.g., in [46,51]. Below, we investigate the quality of the diffusion priority model, considering a few numerical examples differing in the number of priorities, input intensities, and type of interarrival and service time distributions.
The first three cases concentrate on various input intensities and two priority classes. The fourth case investigates a system with three priorities. The fifth and final scenario is dedicated to non-exponential interarrival distribution. In all cases, the results of the diffusion model have been validated by comparison with the ones obtained with OMNeT++ discrete network simulator [55]. The standard OMNET++ package can only collect steadystate results; therefore, we adapted it to the needs of transient analysis by modifying packet generators, algorithms of collecting statistics, and handling message mechanisms. The simulation results are averaged over 100,000 independent runs.

Two Priorities, Low Input Intensities
This scenario considers two classes of customers. The arrival rate of the priority class changes in the following way: [20,30], [40,50], . . ., and λ (0) = 0 between these intervals. Time is expressed in generic units. The nonpriority customers arrive with constant intensity λ (1) = 0.4. Both queues are limited to N (0) = N (1) = 20; i.e., the system can host up to 20 customers of each class but no more than 20 in total. When active, the input streams are Poisson; exponential service time distributions for both classes are the same: µ (0) = µ (1) = 1. The system is stable because its maximum utilization factor is ρ = 0.8, but the considered intervals are too short to allow it to attain a steady-state.
The total number of customers of both classes displayed in Figure 1 increases when the priority customers come into the system. In the remaining periods of time, the service (µ = 1) is fast enough to countermeasure the non-priority intensity (λ = 0.4) and makes the queue effectively decrease until new priority clients arrive at the system.       Similarly, probabilities p   Figure 4. As the probability of buffer overflow is weak, we observe that the series of 100,000 simulation runs is not sufficient to determine it properly. No overflow is observed in simulation for the priority class, and the simulation results for the non-priority class are distorted. There is no numerical problems in case of diffusion approximation, even if results are in the order of 10 −18 .

Two Priorities, Medium Input Intensities
We keep the same pattern of the traffic but increase its intensity. The rate of priority traffic is (λ (0) = 1.2), i.e., three times higher than previously in Section 3.1 in the same intervals t ∈ [0, 20], [40,60], [80, 100] and zero otherwise. The intensity of the non-privileged class is higher by 0.1 (λ (1) = 0.5), and constant.
The system is unstable during active periods of priority traffic; the service station is not able to serve all incoming priority customers. During every first 20 time-units in 40-unit cycles, the first-class customers are serviced and queued, unlike second-class customers, who are only queued. For the next seven time units, on average, the class 1 service continues, which results in further queuing of class 2. During the last 13 units of the cycle, on average, the service of priority clients ends, and the non-priority begins. However, the low traffic period is too short to allow the service of all accumulated non-priority customers. The lower priority queue is gradually increasing cycle by cycle, and the same is true for the total number of customers of both classes; see Figures 5 and 6.  The changes in the system highly affect the probability of both empty ( Figure 7) and full ( Figure 8) queues of classes 1 and 2. Again, the observation starts with an empty queue, but this time the probability of an empty queue for non-priority drops to zero. Moreover, the probability that the saturated non-priority queue increases with each cycle is grows a little bigger, signaling that the system will saturate in the future.

Two Priorities, High Input Intensities
The input intensity is two times higher (λ (0) = 2.4) than in the previous Section 3.2. The lower class intensity remains constant and is twice as high previously, (λ (1) = 1). The intervals and other assumptions remain the same as in Section 3.2.
Initially, both queues increase, as shown in Figure 9. After a while, the non-priority queue drops almost to zero because the buffer is monopolized by the higher class. Only when priority customers cease to arrive do lower-priority clients have a chance to enter the buffer, and their queue increases. Therefor the cycles of queue changes are interleaved: when the priority queue increases, the non-priority queue decreases, and vice-versa. There is not space enough in the buffer for both classes; Figure 10 shows that for most of the time, it is full or almost full. The system remains stable due to massive losses; see probabilities of the empty queue in Figures 11 and 12. The probability that the priority queue is full reaches its maximum at the ends of the customer arrival cycles and then decreases. Only at these moments do the lower-class clients see that the queue may be available.

Three Priorities; Mean Service Time Depends on Priority
This time, the server is designed to handle three priority levels. The highest-priority customers come with intensity λ (0) = 0.25 during the same intervals as in Sections 3.2 and 3.3 and otherwise λ (0) = 0. The intensity of medium-priority customers is constant, λ (1) = 0.5, while the lowest-priority customers have constant intensity λ (3) = 0.25. The service rates are µ (0) = µ (2) = 1 and µ (1) = 0.5. Queue capacities are limited to N (0) = N (1) = N (3) = 20. This means that the system as a whole is unstable.
The highest-priority class (class 0) has a small queue because the station is four times faster than the rate of its arrivals. For class 1, the utilization equals one; i.e., the medium priority queue will slowly increase up to the buffer limit. The lowest-priority class must wait for the first and second class to free the space; at the beginning, its mean queue increases, but then this class is gradually eliminated from service as the medium class fills the buffer. The process is presented in Figure 13.   The probability of the empty queue is close to one for the highest-priority class and changes periodically with the active and non-active traffic intervals of this class. For the other classes, this probability is constantly decreasing, as seen in Figure 15. The probability of a full queue is so small for the highest class (P0) that we did not receive it in simulations; see Figure 16. For medium and low priorities, this probability increases with time and is much faster in the case of P(2).

Two Priorities; General Interarrival and Service Time Distributions
This example considers a server with two priority levels; the input traffic is non-Poisson for both classes. The priority customers come with intensity λ (0) = 0.75, and the squared coefficient of variation of their interarrival time distribution is C The service rates are µ (0) = µ (1) = 1, and the distributions of service time have are not to be observed in real traffic: they are usually below 2. It is known that the errors of the approximation increase with the value of C 2 A , C 2 B [46,56]; therefore we wanted to check the accuracy of the model for an extreme set of parameters. In diffusion approximation, the type of distributions is not important, only the value of its first two moments. In simulation we used Cox distributions with the same moments. For another distribution, the simulation results would be slightly different. As in previous examples, we present mean queue lengths of priority and non-priority customers (Figure 17), mean queue length of both priority classes together (Figure 18), probabilities of empty queues for priority and non-priority classes (Figure 19), and probabilities of saturated queues for priority and non-priority classes ( Figure 20). The results confirm the deterioration of the approximation: diffusion results are not as close to simulations as was the case previously, when we assumed that C 2 A = C 2 B = 1; the impact of the squared coefficients of variation is visible. Note also that all model computations are performed inside small time intervals of one unit length, and the approximate distribution of the queue length at the end of one interval gives approximated initial conditions for the next one, increasing the deficiencies of the model. However, the results are still useful in the evaluation of a time-dependent behavior of the system and follow the general pattern given by simulation. A better match is observed for the priority class. It is also natural, as the evolution of the non-priority queue is based on the previous estimation of priority queue, and the errors add up.
The system is slightly unstable; therefore, mean queues slowly increase from one cycle to another (Figure 18). In addition, probabilities of queue saturation increase, as shown in Figure 19, and probabilities of the empty queue decrease with time, as shown in Figure 20.

Network of Priority and Non-Priority Queues
The steady-state diffusion model of an open network of G/G/1 or G/G/1/N queues was presented in [53], and it was adapted to transient states in, e.g., [57] and time-dependent routing in [48]. It is here extended to a time-dependent model of a network including both FIFO and priority stations. The approach is based on the decomposition of the network: we need to determine the input flow parameters at each station; then, we may use models of separate stations as discussed in Section 2.
Let M be the number of stations and L + 1 the number of classes, k = 0, 1, . . . L. The traffic intensity λ (k) i of class k at station i is determined by the system of M(L + 1) equations representing the balance of flows: where r lk ji is the probability that a customer who belongs to station j and to class l goes next to the station i as a class k customer and λ at all stations sending customers to station i. In addition, we need to express the variance of interdeparture times at any station by the variance of interarrival times at the same station.
Both dependencies mutually relating the input and output of the stations turn out to be linear with respect to C 2 Dj and C 2 Ai , and the simultaneous solution of the resulting system of equations brings us C 2 Ai or C (k) Ai 2 . In transient analysis of the whole network, these equations are to be solved in time intervals that are sufficiently short to consider the flows, routing probabilities, and station utilization as constant parameters. We also distinguish input and output flows of a station; the output is changing continuously with changes in utilization i (t).
Assuming that the arrivals to a station i from other stations and from outside the network are independent, and assuming the variances of the arrivals from all directions, we come to the expression (18); see, e.g., Reference [48] for details. The variance of interarrival times at each station is obtained due the equations defining the variance of interdeparture times as a function of the parameters of the interarrival times at each station: where C (l) 0j 2 and λ (l) 0j refer to the flows coming from outside the network to station j as the first station, or for all classes together: The second type of equations linking the variances of f Aj (x) and f Dj (x), where f Dj (x) is the pdf of interdepature times at station j, will be discussed separately for FIFO and priority stations.

The Output Stream at the FIFO Station
The equations are based on Burke theorem [58]: if a station is active (i.e., it occurs with probability ), the customers leave it in intervals equal to service times; otherwise we should wait for somebody to come and then serve them: where f Aj (x) and f Bj (x) are density functions of interarrival and service times distributions at station j and * is the convolution. If the input flow is not Poisson, the use of interarrival time density f Aj (x) is an approximation; in fact it should be the pdf of idle time distribution. From Equation (20), we obtain and

The Output Stream at the Priority Station
To use the same as the above schema in the case of priority stations, we need to develop an expression corresponding to Equation (21)-the distribution of interarrival times at each priority level. To simplify the notation, we omit here the index i denoting the station. Let us denote f where R (k) = ∑ l=k l=0 (l) , (l) = λ (l) /µ (l) . The components of this expression correspond to three situations that are possible after the departure of any customer of class k:

-
The next customer in the class k is in the system (this occurs with probability (k) 1−R (k−1) ) and will leave it after its completion time; -There are no customers of this class in the system, and we shall wait for the time described by F

(k)
A (x) until it appears and enters the server; -No customer of class k is present in the system, and a customer of higher class comes before him, so the busy period γ (k−1) must first be terminated.
From the above (23), we calculate the squared coefficient of the variation of interdeparture times for each priority customer, which is needed to integrate a single priority station into a network of such stations. The easiest way to obtain the moments of f (k) D (x) given by Equation (23) is to use its Laplace transformf (k) D (s) and a formula that is valid for any density function f X (t) and its Laplace transformf X (s) The final formula is as follows: where The Equation (24) corresponds to (21) in the case of G/G/1/N station: it defines how the variation in the interdeparture times of the class-k customers depends on the variations of the interarrival times of all classes that may influence the output of this class. The parameters of service time distributions are hidden in the coefficients of the equation.
Equations (18) and (24) taken together with (21) or (24) determine the input flow parameters for each class and each station, allowing us to analyze each station separately.

The SDN Switch
The SDN switches were modeled recently with the use of diffusion approximation in [47,48,57]. They considered the switch architecture discussed in [59] and simplified it to a single G/G/1/N station. They argued that since the input and output hardware of an SDN switch is fast, the main component of the switch introducing delay and therefore to be modeled, is the queue of packets waiting until the node identifies to which flow they belong and what output port they are to be sent. Suppose that the identification requires a linear search in a flow table with K entries, and T is the constant time to check one entry. Let be the probability that the router's flow table does not contain the flow rule for a given packet; this will be discovered after going through all K positions, i.e., after time KT. In this case, the service time is constant, with zero variance. Otherwise, with probability (1 − ), the time to find the existing entry is uniformly distributed in [T, KT] and has a mean (K + 1)T/2 and variance (K 2 − 1)T 2 /12.
In the cited models, if a packet is not identified, it disappears. Here, we follow its way to the controller and its return to the switch via uplink and downlink channels as well as its second service in the switch as a priority customer, similarly as is done in [28], but considering transient behavior of the system and general interarrival and service time distributions. The model gives us a chance to see the delays introduced by the communication with the controller and priority service of returning packets. We may study the behavior of the system as a function of its parameters, such as speed of the switch, the controller and communication channels, and hit ratio for the identification of incoming packets. This system is presented in Figure 21. The model is composed of four service stations: the switch is a G/G/1/N/Priority station, and other stations are modeled as G/G/1/N. We use Equations (17), (18), (21), and (24) to separate the stations; the structure of the network is simple and these general formulas are thereby greatly simplified. Figure 21. Model of SDN switch and its interactions with the SDN controller.
The length of the diffusion interval, i.e., the maximum size of the queue in the model, significantly affects the numerical solution time of the diffusion equation; the longer the interval, the greater the calculation time. To ease the calculations, we assume that the maximum volume of the switch buffer is N = 50 packets when = 0.2, but when = 0.5, this means the congestion is higher and queues are longer, and we assume that N = 100. The maximum size of other queues is N = 20 packets.
In the numerical example below, the changes in the input flow are displayed in Figure 22. They cover an interval of 1 s. We used parameters K = 950, T = 8 × 10 −7 s (giving µ 1 ≈ 2630 packets/s) to determine the distribution of service time at the switch and two values of the probability of missing a flow description. With this probability, a packet goes (only once) along the loop S2-S3-S4 and comes back to the switch S1 as a priority packet. We assumed for channels; i.e., stations S2, S4, µ The transient solution of diffusion equations is computed in time-intervals of the length 5 ms; i.e., we have 200 intervals with constant but different diffusion parameters following the state of the system. Inside an interval, diffusion parameters in single station models are constant; at the end of each interval, the Equations (17), (18), (21), and (24) furnish new traffic parameters for the the diffusion models at the next interval. The queue distributions at the end of an interval are used as initial conditions for the next one.
Below, a few figures illustrate the numerical results. Figure 23 displays the mean queue lengths at the switch for priority (P0) and non-priority (P1) packets as a function of time, reacting to the changes in the input traffic, for = 0.2. We used a logarithmic scale to show together the results for both priority and non-priority classes, which have significantly different values. The simulation and diffusion approximation results are displayed together. Figure 24 presents similar results for = 0.5. Comparing both figures, we see the impact of on the queues; its increase from 0.2 to 0.5 makes the switch maximum mean queue almost ten times longer.  The same may be observed in Figures 25 and 26, presenting mean response time of the switch as a function of time, for = 0.2 and = 0.5, diffusion, and simulation results. The change in greatly influences the delays. The spikes at the moments of traffic changes come from the fact that we used the Little's formula E[R] = E[N]/λ, which is correct at steady-state analysis but approximate in the transient one, to obtain the mean response time.
and the pdf of the R is Figures 29 and 30 present loss probability due to the queue saturation as a function of time, respectively, for = 0.2 and = 0.5, obtained by diffusion approximation and simulation. It is visible that 100,000 simulation runs are not enough to obtain reliable results; they are incomplete and mostly nonexistent, while diffusion approximation has no difficulties in modeling very small probability values.    The comparison of diffusion and simulation results gives us an estimation of errors introduced by the method, and we conclude that their size is acceptable in general. In addition, the dynamics of changes follows well the one observed in the simulation model. If the controller can change routing each 100 ms, the switch and a network of switches will operate in a transient regime for most of the time. Therefore, every performance evaluation or an optimization study should take a transient analysis into account. Diffusion approximation proves to be a convenient tool for this purpose.
Our original contributions are the following: • Proposing the diffusion model of a multiclass G/G/1/N/Priority station, i.e., a station with general interarrival and service time distributions, limited buffer, and with preemptive-resume priority queues. Each class of customers has its specified priority level and its own parameters of the interarrival and service time distribution. Within one priority class, the scheduling is based on the FIFO algorithm. General distributions, priority classes, transient analysis, flexible topology, the form of results which is not restricted to mean values but giving the distributions, make the proposed model broader than the existing ones.

Conclusions
The article proposes a queueing model of G/G/1/N/preemptive-resume priority station serving customers with any number of priority classes. The main features of this model are general distributions of interarrival and service times and transient analysis of the queues. The results of a single station model were verified and validated in detail by comparison with simulations for various patterns of time-dependent traffic. In addition, the results of the ring switch-uplink-controller-downlink were verified with the simulations. In most cases, the approximation quality is very good, especially when the squared coefficient of variation of interarrival and service time distributions is close to one. The factors negatively affecting the approximation are: the increasing number of priority levels, because the results for a certain class depend on results (and errors) for all higher classes, and very large variances of interarrival and service time distributions. Furthermore, the results for the network are worse than for a single station: the errors of determination of variation of flows and the errors of dynamics prediction in intermediate stations (uplink, controller, downlink) bring additional errors into the switch model.
The model gives an insight into the performance of a priority service station. The impact of the utilization of the system on queue lengths and response times at various priority levels is visible. A network model integrating any number of G/G/1/N/preemptiveresume and G/G/1/N stations, both for the steady-state and transient regime, is presented and used to study the performances of SDN switch receiving a flow of packets with the intensity, which is frequently changing due to the decision SDN controller. The model includes the communication between switch and controller for packets belonging to flows unrecognized by the switch. It may be used to study the impact of the speed of switch, controller, and communication between them on performances of the SDN network, including such quality of service factors as delay, jitter, and losses. It also allows us to evaluate the effect of the hit ratio (probability that a packet belongs to a flow that is known to the switch) on the switch response time, the possible starvation problem on the lower priority level, and loss probabilities of packets. Another advantage of the diffusion approach is that it gives us the distributions of queues and delays, not only their mean values. It also means that we determine the probability that a packet is lost because of the saturation of the buffer. The obtained numerical results indicate that the transient regime may take a significant part of the total switch operation time; therefore, the diffusion approach to study transient periods is fully justified. In future work, we will focus on validating the model of the entire SDN network with any number of switches.