{'fraction_non_alphanumeric': 0.03749537909060503, 'fraction_numerical': 0.006724523386202405, 'mean_word_length': 4.696750902527076, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Proactive and AoI-aware Failure Recovery for Stateful NFV-enabled Zero-Touch 6G Networks: Model-Free DRL Approach

In this paper, we propose a Zero-Touch, deep reinforcement learning (DRL)-based Proactive Failure Recovery framework called ZT-PFR for stateful network function virtualization (NFV)-enabled networks. To this end, we formulate a resource-efficient optimization problem minimizing the network cost function including resource cost and wrong decision penalty. As a solution, we propose state-of-the-art DRL-based methods such as soft-actor-critic (SAC) and proximal-policy-optimization (PPO). In addition, to train and test our DRL agents, we propose a novel impending-failure model. Moreover, to keep network status information at an acceptable freshness level for appropriate decision-making, we apply the concept of age of information to strike a balance between the event and scheduling based monitoring. Several key systems and DRL algorithm design insights for ZT-PFR are drawn from our analysis and simulation results. For example, we use a hybrid neural network, consisting long short-term memory layers in the DRL agents structure, to capture impending-failures time dependency.

I. INTRODUCTION

A. Motivation and State of The Art
Nowadays, with the exponential growth of data traffic and new emerging services with ultra-responsive real-time network connectivity and high-reliability requirements such as remote healthcare, self-driving cars, and industrial automation, consistency, and reliability of a network become more important than ever [1]. Fulfilling these service requirements in an efficient and flexible manner is challenging. To this end, the next generation of wireless communication called sixth-generation (6G), with the support of artificial intelligence, ultra-reliability, and zero-touch network management, is expected to emerge in near future [2], [3]. To tackle this challenge, network function virtualization (NFV) and software defined network (SDN) have emerged as promising technologies to provide flexible and scalable network and efficient resource management [4]. NFV decouples network functions (NFs) from the proprietary hardware, which allows service providers to run virtualized NFs (VNFs) with different functionalities on top of a common physical node as software. Based on the desired services, a tenant requests a set of network services in the form of a service function chain (SFC). SFC is a sequence of VNFs fulfilling end-to-end (E2E) service demands in a specific order. Packets processed in each VNF are steered to other VNF in the sequence for further processing until the last VNF [5].
Despite flexibility and resource efficiency achieved by network softwarization, it poses new concerns especially in terms of reliability and consistency of services [6]. VNFs are software running on physical nodes, which are vulnerable to various faults and problems such as physical node failure and software malfunctions [7]. To encounter failure problems and enhance network reliability and performance, deploying backup instances is indispensable [6]. Many VNFs are state-dependent and states are updated according to the traffic traversing through them, for example, a virtual network address translation (NAT) updates its states based on IP and MAC addresses of the new connected devices [8]. If a failure happens in a stateless VNF, software defined network (SDN) controller will simply reconfigure the flow path through a deployed backup instance. But for a stateful VNF to maintain robustness and consistency of SFC, backup VNF's state must be synchronized with the active VNF 1 . Therefore, state synchronization for seamless failure recovery in stateful VNFs is necessary and challenging. In this paper, we focus on the case where all VNFs are stateful.
Generally, two schemes for the failure recovery exist which are called proactive failure recovery (PFR) and reactive failure recovery (RFR) [9], [10]. Failure recovery is a procedure that consists of three main stages as 1) launching backup VNF and image migration, 2) flow reconfiguration, and 3) state synchronization. Executing each stage imposes a considerable delay resulting in not only network performance degradation but also service level agreement (SLA) violation due to high service interruption time. By failure prediction, PFR method can decrease recovery delay by engaging some stages of the failure recovery procedure before the failure manifest. For example, PFR can save flow rescheduling and backup lunch delay, by initiating these stages beforehand [10]. At this point, if we manage to recover failed VNF in a PFR manner, the network performance could be greatly enhanced by reducing the failure recovery interruption time. This motivates us to propose a PFR framework for future softwarized networks.
At the same time, a fully automated and self-managed network is a new paradigm for future networks, e.g, sixgeneration (6G) 2 , which can be realized by machine learning (ML) and softwarization [12], [13]. Recently, deep reinforcement learning (DRL), as an important branch of ML, has made a significant breakthrough and achieved superhuman results, even without human knowledge in strategic games [14]- [16]. Also, DRL has achieved good results in the context of NFV such as SFC embedding [17]- [19]. An SFC-driven network could include plenty of physical and virtual entities, and the dynamic changes in each entity's status would cause a highdimensional and complex state space. Therefore to mitigate the failure consequences in high-dimensional state space, a variety of actions would be possible.
To ensure demanded network reliability and robustness in emerging network technologies, immediate reactions for the dynamic changes and events in the networks are necessary. Because of the mentioned challenges, it is difficult for a human orchestrator to predict the likelihood of failures, based on the received information, and to take simultaneous and optimal actions in the network. Benefiting from deep neural networks, DRL is capable of handling high-dimensional state-action spaces and automatic reactions for the changes in network status. By exploring the underlying environment, e.g., NFVbased network, and evaluating the network status, based on the monitored information, DRL can effectively evaluate the underlying physical/virtual network entities. By experience gained from the exploration, DRL can learn to adjust and conduct better actions in each situation. Therefore, we expect DRL to enlighten the solution of our PFR framework. Moreover, modeling the network dynamic is difficult and maybe impossible in practical cases. Therefore, we tend to use modelfree DRL, in order to learn network dynamics by training on sample-based experience to make zero-touch automatic decisions. Besides, to realize PFR, the DRL agent 3 , should access all relevant and necessary information of underlying physical/virtual network to make appropriate decisions in each state [20]. Therefore, the freshness of this information becomes crucial. We apply age of information (AoI) concept to quantify the freshness [21] via introducing maximum AoI as a tolerable freshness constraint.
By combining our PFR framework and the model-free DRL method, we propose a novel intelligent PFR for stateful VNFs, which is called Zero-Touch PFR (ZT-PFR). 4

B. Main Contributions and Research Outcomes
In this paper, we propose a novel ZT-PFR scheme to maximize the stateful SFC reliability and ensure network service consistency. Considering resource limitations and maximum tolerable service interruption time caused by failure, our aim is to maintain a highly reliable and resource-efficient network.
We devise state-of-the-art soft actor-critic (SAC) [22] and proximal policy optimization (PPO) [23] model-free DRL methods to automate and optimize our proposed framework. Moreover, to construct an environment simulator to train and test our proposed DRL-based framework, we propose a simulated model of impending-failure in NFV-based networks. Besides, to capture the time dependent features, we equip the agents with long short-term memory (LSTM) layers. Additionally, To provide the DRL agent with the needed information for appropriate decision making, we model an event triggered and scheduling-based AoI-aware monitoring scheme, to observe the network status and guarantee the necessary freshness of information.
The main contributions of this paper are listed as: • Considering the dynamics of NFV-enabled networks, we model a PFR framework for embedded stateful SFCs. To this end, we consider a 3-stage failure recovery procedure aiming to manage resource efficiency and to minimize SLA violations caused by service interruptions. Moreover, we formulate the PFR as an optimization model aiming to minimize a weighted cost including resource cost and wrong decision penalty. • To realize the proposed ZT-PFR, we adopt state-of-theart model-free agents, i.e., PPO [23] and SAC [22], and customize them for our model. In addition, we use a hybrid neural network (NN) consisting of long short-term memory (LSTM) layers. Accordingly, in order to train and test our agents, we design a novel simulated network environment considering the impending-failure concept. • We propose an AoI-aware event-triggered and scheduling-based monitoring scheme, to provide the necessary information freshly to decision-maker (controller), based on the network dynamic. • Several simulation scenarios are provided to assess our ZT-PFR algorithm. Several key DRL algorithm design insights are drawn from our analysis and simulation results. For example, we use LSTM layers in the DRL agent's NN structure to capture impending-failure's time dependent features. Also, we evaluate the discount-factor influence on sequenced decision making [16] for ZT-PFR. Our model shows promising performance in resource efficiency and ZT-PFR in a fair comparison with baselines.

C. Paper Organization
The rest of this paper is organized as follows. The related works are discussed in Section II. System mode and problem formulation are stated, respectively, in Section III and Section IV. Sections V presents the proposed solution. Finally, simulation level evaluation and conclusion remarks are expressed in Sections VI and VII, respectively.
II. RELATED WORKS The proposed ZT-PFR is built upon backup placement, SFC flow reconfiguration, and failure recovery procedure. In this section, we review recent studies on these topics. There are a few studies on backup placement and recovery in recent years, and most of them focus on stateless backup placement and availability optimization [24]- [27]. For example, the authors of [24] propose a stateless backup provisioning scheme that starts by deciding on the number of shared backups and their placements. To improve the resource utilization efficiency, the authors of [25] introduces a new sharing mechanism of redundancy and multi-tenancy technology. [26] proposes a backup resource allocation model for middleboxes considering the importance of functions and both failure probabilities of functions and backup servers. [27] studies a reliabilityaware resource allocation algorithm using the shared protection scheme with active-standby redundancy for SFC. Considering stateful VNFs, [6] studies optimization problems on fault-tolerant stateful VNF placement in cloud networks. The authors consider the VNFs and backup resources demand of incoming SFC request as a constraint to optimize the deployment problem. The author takes VNF state synchronization into consideration, however, VNF state update bandwidth demands and SLA violations due to service interruption are not investigated. Moreover, in [5], the authors study a seamless stateful flow reconfiguration and state synchronization problem considering the interruption time and bandwidth limits.
The aforementioned studies do not consider the failure prediction approach to solving the recovery problem. However, there are studies on the failure prediction with data-driven ML methods in NFV and cloud-based networks [9], [28]- [30]. To the best of our knowledge, only [9] and [30] take the failure prediction into account and study a proactive path restoration strategy in the NFV-based networks. The mentioned studies propose a master-slave VNF structure to ensure service consistency and consider that each active VNF (master) is supported by some backup VNF instances (slaves). To mitigate the interruption delay, [30] proposes launching virtual machines (VMs) and flow reconfiguration before failure manifests and migrating the real-time master VNF's image to a successive slave, afterwards. In best-case scenario, the SFC would be interrupted during image migration. In contrast to [9] and [30], to reduce the interruption delay even more and to take service SLA into account, we propose a detailed image migration process based on [5], [8], and break this process into two stages namely snapshot migration and statelet 5 synchronization. In order to limit the interruption time to a manageable low statelet synchronization delay, the snapshot migration should be done before failure manifest. Furthermore, we take resource efficiency and DRL-based automation into account.
As concluded from the aforementioned related works and to the best of our knowledge, there is no work on the DRL-based ZT-PFR in softwarized high-reliability future networks.

III. SYSTEM MODEL AND FAILURE RECOVERY
PRELIMINARY In this section, we describe the considered system model for the proposed proactive recovery procedure. First of all, we present the main symbol notations as follows. Vector and matrix variables are indicated by bold lower-case and uppercase letters, respectively. | · | indicates the absolute value, and N + indicates the positive integer values. E{.} denotes the statistical expectation, and ⊕ denotes the logical XOR function. 5 Statelets are compact representations of information in incoming packets that change the state of a VNF after snapshot migration [8]. As depicted in Fig. 1, the considered physical network is presented as graph G P = N , L , where N and L represent the sets of all physical nodes and links, respectively. Furthermore, m, n ∈ N represent two different nodes and l mn ∈ L represents the physical link connecting nodes m and n. In the network, N consists of NFV-nodes and SDN-enabled forwarding devices, where all are orchestrated and managed by a centralized orchestrator. The NFV nodes provide processing resources for VNFs, and switches, i.e., forwarding devices, forward traffic from incoming links to outgoing links. The main parameters are listed in Table I. Note that the parameters superscripted with a prime symbol are related to backup VNF properties. Also, we assume that the continuous-time is slotted into positive numbers indexed by t ∈ N + .

A. Physical Network
We consider each NFV-node n provides P types of resources indicated by set P, where p ∈ P = {1, . . . , P } defines the types of resource, e.g., CPU, memory, and storage. We use C p n to represent the maximum customizable amount of resource type p, in each NFV-node n. Also, C BW mn denotes the bandwidth capacity of physical link l mn . We use W p n (t) ∈ [0, 1] and W BW mn (t) ∈ [0, 1], to indicate the available ratios of resource type p in node n (available portion of C p n ) and available bandwidth in link l mn , at each time slot t, respectively. The SFCs properties are characterized in the following. Assumption 1. We assume that the SFC embedding problem is previously solved and all requirements such as average delay are ensured. Therefore, the SFC embedding problem is not the focus of this paper. VNF embedding optimization can be done similar to VNF embedding methods proposed in [5], [17]- [19].

B. Embedded Services Properties
Let K = {1, . . . , K} be the set of K embedded SFCs in the network, indexed by k. Each SFC has a specific VNF sequence and SLA requirements indicated by a tuple as follows: where H k = {1 k , . . . , h k , . . . , H k } denotes the set of sequenced VNFs in SFC k and ∆ k ∈ N + is the maximum tolerable down time 6 . Moreover, σ k denotes the traffic traversing SFC k in packets per second. We define the set V consisting of all embedded VNFs in the network and E as the set of all logical links between each two logically connected VNFs. Also, we use V k h ∈ V to denote the h-th VNF in SFC k. Besides, each VNF's reliability could be enhanced by backup provisioning [25].
It is worthwhile to mention that the reliability of a service highly depends on the reliability of underlying SFCs. At the same time, the reliability of each SFC is obtained from the dependant VNFs. Therefore, failure and fault occurrence would result in VNF service quality degradation and SFC SLA violation. As discussed, our effort in this paper is to design a proactive failure recovery. Next, we discuss our failure model.

C. Failure Model
Following [7], failures can occur in VNFs and physical nodes due to numerous reasons such as natural disasters in the location of physical servers, software malfunctions, CPU overload, and temperature threshold violation. Typically, when a failure occurs in a SFC, users will automatically retry to continue the connection, and if the orchestrator could mitigate the failure impact before a recognizable time interval 7 , users would not experience the service interruption caused by failures [7]. This is the point where we try to minimize the interruption time as one of the main results of PFR [10], [30]. Most failures could be forecast by monitoring status information (e.g, resource overload and temperature) of VNFs. In this paper, these types of failures are denoted as impendingfailures [29]. Accordingly, we propose a model to simulate the notion of the impending-failure in a NFV-enabled network as follows: 1) VNF States and State Transition Model: An impendingfailure in NFV-based networks could be predicted by ML approaches using network infrastructure information, and observing event severity and service degradation patterns [7], [9], [29], [30]. Our aim in this paper is to prepare the DRL-agent to deal with impending-failures proactively.
• VNF States Model: The model is inspired by ITU standard X.733 8 [33] and ETSI NFV; Resiliency Requirements 9 [7] where dormant fault, active fault, and fault management in NFV are defined. Also, four levels of severity of alarms have been defined in ITU standard X.733: Critical, Major, Minor, and Warning. The critical alarm appears when the service can no longer be provided to the user. Major alarm indicates the service affective condition while minor means no current service degradation is there, but if not corrected may develop into a major fault. A warning is an impending service affecting fault or performance issue. In the defined model, each VNF could be in one of three defined states namely normal, warning, and critical. The current state of each VNF depends on the occurred events severity, e.g., overload severity and temperature threshold violation severity. Accordingly, based on the state of each VNF, the orchestrator should make the corresponding decision on the suitable action for each VNF, simultaneously. The properties of the mentioned states are defined as follows: In the normal state, the VNF works normally, event severity is at a tolerable level and service is not degraded. In the warning state, some technical and physical events cause VNF service degradation, and the service needs some maintenance efforts to prepare for a possible failure. Finally, in the critical state, the event severity reaches a crucial level that we assume that the VNF would fail during the time slot, and immediate recovery action is necessary. To simulate the impending-failure concept, we assume each VNF state transition follows the model illustrated in Fig. 2. The transition probabilities in each time slot illustrate each VNF's next state likelihood. 10 • State Transition Model: As characterized in Fig. 2 and Table II, following our proposed model, if the VNF's state is normal at the beginning of time slot t, the VNF continues in the normal state during the mentioned time slot with probability of P nn , or its state changes to warning with probability of P nw = 1 − P nn . Note that, to simulate impending-failure in our model, we assume that, if a normal state turns to a warning state during a time slot, the VNF will stay in the warning state for at least q v time slots after the incident 11 . Moreover, if the VNF is in warning state at the beginning of time slot t and q v time slots are passed, the VNF continues in warning state with probability P ww , or the state turns to critical with probability P wc , or turns back to the normal state with probability P wn . Because of continuous service degradation, i.e., impendingfailure [7], we consider that, the more time slots VNF stays in warning state, consequently it would be more probable to turn to critical state. Therefore we assume P wc will grow by P wc ×(number of steps in warning state−q v ) ≤ 1 12 . Notably, P ww , P wc , and P wn must add up to 1. Finally, if a VNF's state changes to critical, it stays there unless the recovery procedure is completed. After recovery procedure, the VNF's state turns back to normal, and continues its service.
2) Monitoring and State Freshness: According to our DRL approach to PFR, the orchestrator must be provided with all the needed information for decision making [16]. We assume an event-triggered and dynamic scheduling based monitoring scheme [36], [37]. If a transition to the new state occurs in VNF, or its scheduling time arrives, the VNF transmits its own current state information to the orchestrator.
On the orchestrator side, the information is received with a time stamp. The intention of considering manageable scheduling-based monitoring besides event triggering is: 1) to guarantee the required information freshness on the orchestrator's side and 2) to develop a robust monitoring scheme, in case of data loss and unexpected delays. Manageable monitoring schedule time could improve the efficiency of monitoring resource usage. For example, if a VNF state proceeds to normal, the information freshness is less urgent than in other state types. Therefore, the dedicated resource for intense monitoring could be released.
Based on VNF's state, the relevant information on the orchestrator side should be relatively fresh. To take the freshness of these states information into account, we quantify the information's freshness by the AoI metric. Therefore, the below subsection is dedicated to explaining the proposed AoI model. 3) AoI Model: As recognized from the name of AoI, it is the difference between the received time and the generation time of the last generated information (packet). Let θ v (t) denote the AoI of information of VNF v at time t. From the time each information is generated to get to the orchestrator, 10 We consider three states for each VNF by merging the ITU.X733 alarm reporting concept and ETSI NFV-Resiliency service degradation. 11 The reason for this assumption is to simulate the impending-failure concept and possible fault and error correction time [7], [33] 12 This factor is defined to simulate the possibility of continuous service degradation leading to a failure [7], [33].  it suffers a delay (e.g., queueing and propagation) until successfully received. But we assume the network is delay free 13 . After receiving a state information, AoI increases with steps as the duration of the time slots. Therefore, the evolution of AoI is characterized by: If it is transmitted at the beginning of time slot t where θ v (0) = ∞ 14 and δ is quantified as the length of each time slot. According to the state of each VNF, it is important to optimize the age of its information. We consider an AoI constraint in which the AoI should not violate a predefined threshold in each time slot given by where κ s v (t) is defined as constant 15 . Its value depends on the VNF v and its state s at time slot t. For example, if VNF is in warning state, κ s v (t) ≤ q v × δ should be satisfied to guarantee necessary data freshness. Moreover, if VNF is in critical state, κ s v (t) ≤ δ should be satisfied. The orchestrator needs to know if its actions mitigated the critical state. Note that AoI optimization, i.e., ensuring network information freshness, is done by tuning the monitor scheduling time.
As discussed before, failures can occur at any time, degrading or interrupting services. Hence, VNF backup provisioning to guarantee service reliability and consistency is indispensable in such networks. In this regard, the failure recovery procedure is described in the following.

D. Failure Recovery Procedure
As discussed in Section I, there exist two schemes for the failure recovery which are called proactive and reactive [9], [10]. For a successful stateful VNF recovery, some steps are essential. These steps are discussed in the following.
The first step is launching a new backup instance for the VNF including allocating the required resources of backup VNF 16 and migrating the latest VNF image (snapshot) [8]. The second step is flow reconfiguration, i.e, rescheduling the routing path of backup VNF in the SFC. The final step is statelet synchronization (similar to [8]) for the stateful VNF [10]. Executing each of the steps imposes a delay which is considerable in the real network and causes network performance degradation and service interruption. Obviously, by executing some of the above steps before failure occurrence, the recovery delay would be significantly reduced. This concept is indicated as proactive failure recovery, which is discussed as follows.
• Proactive Failure Recovery: In this recovery scheme, the orchestrator could predict the failure in the next time slot. Therefore, it can limit overall recovery delay to synchronization delay by running steps 1 and 2 of the recovery procedure beforehand. Note that we could not save synchronization delay, because every statelet produced until failure must arrive at the backup instance [8]. Our second goal is to run the proactive failure recovery procedure at an appropriate time to minimize SFC interruption delay, as explained before. • Reactive Failure Recovery: As recognized by the name reactive, in this case, all steps of the recovery procedures (specified before) are executed after failure occurrence. Therefore, it imposes more recovery delay resulting in high service interruption time and network performance degradation.

E. Proposed Proactive Failure Recovery
We consider a dynamic active-standby failure recovery mechanism where few standby backup instances can be placed and removed in each NFV-node. In case of a VNF failure, the orchestrator transforms the respective backup VNF to an active VNF, and the flow which travels through the failed VNF will be redirected to the new active VNF, i.e., respective backup VNF [10]. Each backup utilizes an amount of resource type p denoted by φ p (k,h) for h-th VNF in SFC k. In practical cases, most VNFs are stateful which means their states update frequently by traversing data. With regards to this, in our case, as seen in Fig. 3, we consider that an active VNF's states must be continuously transferred to the backup instance as statelets to provide a seamless flow migration in case of failure [8]. Moreover, we assume that the statelet update rate of each VNF is linearly proportional to its packet rate σ k . Accordingly, each backup instance will acquire a logical synchronization link connecting it to the respective 16 In our model, this concept is managed by active-standby method, similar to [6], [10], [  active VNF. Due to the limited resources, in the backup placement procedure, each logical synchronization link's bandwidth denoted by b k h (t), should take a small predefined amount of bandwidth for VNFs in a non-critical state, denoted by φ BW (k,h) , to maintain the logical synchronization link active, for statelet transfer purposes. Additionally, based on the VNF's type, statelet generation rate and its synchronization sensitivity, the value of the parameter φ BW (k,h) could be tuned to different values.
We assume that the accumulative statelet size in each time slot is observed by the orchestrator, and Z k h (t) indicates accumulated statelet size of V k h in bits till the end of time slot t − 1, that needs to be transferred in time slot t. Hence, the accumulated statelet size in each time slot is the result of constant bandwidth and packet rate fluctuation. This leads to a synchronization delay between the active and backup instances. We use d k , in time slot t. This is a dummy delay when VNF works correctly, but in case of failure, this delay must be smaller than the maximum tolerable interruption time ∆ k to prevent SLA violation. For example, ∆ k to prevent the synchronization delay from exceeding maximum tolerable interruption time [5].

IV. PROBLEM FORMULATION
In this section, we formulate the proposed PFR as an optimization problem. We assume that based on the orchestrator decisions, the backup instances could be placed and removed for efficient resource utilization purposes. In doing so, we first introduce optimization constraints and then introduce the proposed objective function.

A. Network Constraints
To ensure service consistency, if a VNF enters a critical state, the respective logical synchronization link bandwidth should be optimized to meet the synchronization delay limits. Let y h 's backup is embedded in physical node n during time slot t, and 0 otherwise. Moreover, y (k,h) mn (t) equals to 1 if V k h 's logical synchronization link is embedded in physical link L mn during time slot t. It is worth noting that y (k,h) n (t) equals 0 for all SDN enabled forwarding devices. At each time slot, sum of all allocated and released resources should not exceed the current available resources in NFV-nodes and physical links as: (t − 1)) would be +1, but in case of removing an existing backup and releasing its allocated resources, it would be −1.
We define m k h (t) as a binary variable which equals 1, if V k h is supported by a backup and recovery steps 1 and 2 are performed, and 0 otherwise. It is given by where, 1(.) is an indicative function, and it equals 1, if n∈N y (k,h) n (t) > 0, and 0 otherwise. In our model, an active VNF and its backup can not be in the same NFV-node, because, if the respective NFV-node fails, then both backup and active VNF would fail. This will make backup placement meaningless and the backup placement would be in vain. To ensure this matter, we introduce the following constraint: where y (k,h) n (t) equals 1 if V h k is embedded in NFV-node n in time slot t. Also in our model, we consider placing only one backup for each VNF due to resource limitations which is expressed by following constraint: When a VNF is in a critical state at time slot t, the corresponding synchronization link bandwidth must be reconfigured to prevent synchronization delay threshold violation, i.e., final step (step 3) in the recovery procedure, which is formulated as: where ρ k h (t) equals 1 if VNF V k h is in critical state in time slot t, and 0 otherwise. Also, is a small number for ensuring the constraint to be true when the entity works properly. In the case of a critical state, (9) ensures appropriate bandwidth for the logical synchronization link, to synchronize backup and active VNF's state in less than ∆ k .

B. Objective Function and Problem
To formulate our objective function, we design a weighted cost function to cover the different aspects of the network cost. First, in order to optimize and guarantee the backup placement before failure occurrence, we define the first part of our objective function as below: where Ψ b indicates the imposed cost by service interruption and SLA violations followed by a failure occurrence, which was not supported by a backup, i.e, the VNF's backup was not ready before failure manifest. Clearly, the backup placement allocates a redundant amount of resources in the network, so it is considered as an overhead to network resource usage. We assume each VNF's backup requires a distinct amount of resource, where this resource usage implicates a resource usage cost denoted by U k h . Therefore, the overall backup placement cost is formulated as follows: where α k h (t) is a VNF-specific coefficient managing the backup placement cost impact on overall utilization cost. According to the current state and resource requirements of VNF V k h , the value of α k h (t) could be different in each time slot t. It is worthwhile to mention that the cost for backup placement in near-critical states should be less than in normal states. This would ensure efficient resource usage based on different states. For example, in the normal states, where the VNF works properly and without any service degradation, the best decision would be to release the allocated resources to the backup VNFs. Therefore, in normal states the cost of the utilized resource for backup is considered to be high.
As mentioned, if the orchestrator detects a critical state in an entity, it should run failure recovery procedure. We define β k h (t) equals 1 if the orchestrator runs the failure recovery procedure, and 0 otherwise. For the case that the critical detection was wrong, the resource used by the failure recovery procedure would be in vain. Therefore, we assume each wrong critical state detection will cause a penalty cost Ψ f to the network, which is defined as bellow: In this paper, our objective is to minimize the weighted cost via solving the following proposed optimization problem: , and η T = [η 1 η 2 η 3 ] are the fitting parameters. 8 V. SOLUTION ALGORITHM Problem (13) is a non-linear integer programming (NLIP) which is generally complicated to solve. Actually, the optimization variables in (13) include sequential decisions. Nowadays, it is shown that DRL has tremendous performance on the long term sequential decision-making problems without human knowledge [14], [15]. At the same time, to realize the decisions in an automatic and zero-touch manner, DRL-based solutions are necessary. In addition, benefiting from deep neural networks, DRL is capable of handling high-dimensional state-action spaces. These motivate us to propose policy-based model-free DRL solutions, discussed in the following. As mentioned before in Sections III and IV, the focus of this paper is to realize PFR considering resource usage efficiency. The embedding variables used in Section IV guarantee the resource limits. As mentioned in Assumption 1, VNF (backup VNF) embedding optimization is not the focus of this paper. Therefore, our actions are related to the PFR steps defined next.

A. Model-Free DRL and Agents
In this paper, we tend to use model-free DRL. Policy-based model-free methods directly parameterize the policy π(a|s; θ) which is defined as a distribution over actions a based on current state s and update the neural network parameters θ by performing gradient ascent on the expected reward. The expected reward is the reward that an agent receives in a whole episode. The intention is to create an orchestrator (agent) to learn a PFR policy, by observing the network and sampling from the environment. Then, the orchestrator should manage the service reliability and efficient resource usage, in order to minimize the defined cost function. As mentioned in Section III-C, service degradation or failures can happen any time and on any VNF or NFV node. Therefore, simultaneous actions are needed. Without any knowledge of the environment dynamics, e.g., transition probabilities, the agent starts exploring the environment with a random policy. Since the agent makes sequential decisions along the episodes, it observes the current state s and takes the action a based on its current policy. Then, the environment returns reward r and the new state s based on the taken action. These trajectories of experience are recorded in the agents experience buffer as the tuple (s, a, r, s ). They are used as training data to improve the policy. The states, actions, and reward function in our model are configured as follows.
• States: As discussed in Section III-C, the v'th VNF state, which we feed to the agent, can be in three types of classes, which is denoted by S v indicates the critical state, respectively. Since each VNF could be in one of the states in each time slot, the total state space is S Tot (t) = v∈V S v type (t). • Actions: We define our actions as three types for each VNF including the backup placement (BP), backup removal (BR), and statelet synchronization (SS). BP includes executing the first and the second steps of the failure recovery procedure. SS indicates executing the third step of recovery. Finally, the BR action indicates releasing all of the resources allocated by aforementioned actions. To realize PFR, the desired behavior would be to run BP when the state leading to the critical state and executing SS when the critical state is observed. In contrast, in the RFR, after a critical state is observed all three steps of the recovery have to be executed. Also, for resourceefficient PFR, the desired action for the normal state would be BR.
• Reward function: In order to minimize the predefined cost, i.e., the objective function (13a), the learned policy should take the appropriate actions based on the given state s. In each time slot t, which corresponds to state s(t), the agent samples action a(t) from π(a|s; θ), and receives next state s(t+1) and immediate reward r Tot (t) from the environment. The agent's goal is to maximize cumulative reward in each episode. Note that minimization of the cost function could be equivalently converted to a maximization problem. Accordingly, the first part of the reward function is constructed from the cost function (13a) as follows: (14) where Φ SLA , Φ RC , and Φ FA are defined by (10), (11), and (12), respectively.
To encourage the agent to take the desired actions, we also add positive reward r 2 (t) to the reward function, including terms as: 1) positive reward for BR action in the normal state, i.e, Φ BR , 2) positive reward for BP action before critical state manifest, i.e, Φ BP , 3) positive reward for SS in a critical state, i.e, Φ SS , and 4) positive reward for successfully completing the PFR on a failed VNF Φ PFR . Accordingly, the r 2 (t) is defined as bellow: Numerical values are specified in Section VI. The additional positive rewards are added to (14) to construct the total reward in each step of episode. Accordingly, the total reward is defined as: r Tot (t) = r 1 (t) + r 2 (t).
The aim of each DRL agent is to maximize the expected reward through an entire episode of the environment. Note that, maximizing the negative of cost function equals to minimizing it. Accordingly, as the DRL agent converges to a higher reward followed by higher accuracy, our objective function converges to a lower cost. It can be concluded that maximizing the expected reward by taking correct actions, minimizes the network cost. The numerical configuration is discussed in Section VI. Below, we provide details of the proposed method to find the policy.

B. Policy Optimization
In the most well known policy optimization method, called REINFORCE, the agent generates data for a whole episode, based on the current policy. Then, stochastic policy parameters update after each episode by ∇ θ log π a(t)|s(t); θ R(t), where ∇ θ denotes the gradient with respect to parameter θ, and π a(t)|s(t); θ indicates the stochastic policy, which is parameterized by θ. Therefore, the updates are highly variant, and unstable. It is possible to reduce the variance of this estimate while keeping it unbiased by subtracting a baseline denoted by b(t) [39] as: A learned estimate of the value function is commonly used as the baseline. Then, the quantity R(t) − b(t), used to scale policy gradient, can be seen as an estimate of the advantage of taking action a(t) in state s(t). Because R(t) is an estimate of Q π (a(t), s(t)), and b(t) is an estimate of V π (s(t)), where Q π (a(t), s(t)) and V π (s(t)) denote state-action value and state-value function, respectively. The advantage function is defined as: This approach is named as actor-critic architecture, where actor chooses action based on policy π and b(t) evaluates the action by the value of the state [40].
The REINFORCE method uses the log probability of the actions, to trace the impact of actions. But there are other functions for this matter [41]. Also, we do not want our policy parameter updates to be large in each iteration in on-policy methods, because the agent might get stuck in poor policy and generate data based on that policy. Thus, learning on that data could cause a wrecked policy. To mitigate this problem, [42] proposes a Trust Region Policy Optimization, which uses KLdivergence as a constraint or penalty to limit policy parameter updates. But this method has a complex computation and needs lots of processing power. In this paper, we use Proximal Policy Optimization [23] with Clipped Surrogate Objective (PPO-CSO), which is a first-order objective algorithm described next.
1) Proximal Policy Optimization (PPO): On the contrary to vanilla policy optimization, where updating parameters for more than one epoch may cause a large policy update, PPO-CSO can train K epochs for each iteration due to limited update of parameters. Thus, PPO-CSO method has better sample efficiency than vanilla policy optimization. Let p(t; θ) denote the probability ratio at time slot t over θ which is defined by p(t; θ) = π θ (a(t)|s(t)) π θ old (a(t)|s(t)) , p(t; θ old ) = 1, ∀t.
With limited policy update, we want to maximize the expected reward. Thus, the clipped surrogate objective L CLIP (θ) is defined as follows: clip p(t; θ), 1 − , 1 + Ξ (t)]}, (21) where is the limiting hyper-parameter. Moreover, a MSEbased objective function for state-value network at each time slot t parameterized over θ is defined as follows: Also, Υ π θ (s(t)) denotes an entropy bonus to ensure sufficient exploration [23]. Thus, combining these terms, the aim is to maximize the main objective function defined as: where c 1 > 0 and c 2 > 0 are influence coefficients.
2) Soft Actor-Critic (SAC): SAC is an off-policy actor-critic DRL method based on entropy maximization RL framework [22]. The algorithm adds an entropy term to the reward function to guarantee sufficient exploration while converging to the optimal solution. To adopt DRL-based solution, our agent needs to determine states, actions, and reward value function which are presented in the following [22]. f

VI. NUMERICAL EVALUATION
This section presents numerical results to validate and assess our proposed PFR framework and algorithm under various configurations to compare with baseline. We provide numerical results regarding different metrics such as desired action accuracy for different parameters.

A. Simulation Setup
We consider an NFV-enabled network containing 3 SFCs, i.e., K = 3, where each SFC is constructed from 3 VNFs, i.e., H k = 3, ∀k. Therefore, there would be 9 VNFs, i.e., V = 9, which are embedded on 5 NFV nodes, i.e., N = 5, unless otherwise stated. Also, we consider that each NFV node provides 3 types of resource, i.e., P = 3, including: CPU, storage, and memory. Moreover, we assume each BP and SS actions require a random amount of resource and statelet synchronization bandwidth for each VNF, respectively. BP and failure recovery require another random amount of resource and statelet synchronization bandwidth for each VNF, respectively.
The Python library Networkx is used to simulate our network's topology and structure. A network with fully connected NFV nodes is created by Networkx and SFCs are randomly embedded on top of the physical network. Each VNF working status is presented by the defined state transition model in Fig. 2 with random transition probabilities, generated at the beginning of an episode. Also, we define that each VNF stays in warning state for at least q v = 2 consecutive steps. Therefore we consider κ s v (t) = 2 for warning states. Moreover, we defined κ s v (t) = 1 for critical states to observe the results of the taken actions. Finally, we consider κ s v (t) ≥ 2 for normal states. As mentioned in Section III-C2, each VNF transmits its own state if an event occurs or a scheduling time interval arrives. It is worthwhile to note that the parameter κ s v (t) denotes the scheduling time. The episode length is 100 steps. To build the agents, we use a hybrid NN structure made of normal and LSTM layers, which is described in Table III, unless otherwise stated.
To numerically design the first part of the reward function, i.e, r 1 (t), we assume every backup has the same placement cost as U k h = 1. As discussed in Section IV, to enforce different costs for each state type, the value of α k h (t) is  considered 1, 0.1, and 0 for normal, warning and critical states, respectively. Moreover, values of Ψ b , Ψ f , η 1 , η 2 , and η 3 are defined to be 1. Also, as discussed in Section V-A, the second part of the reward function, i.e, r 2 (t), is designed as follows. +1 reward for BR action in the normal state, +1 reward for BP action before critical state manifest, +1 reward for executing failure recovery procedure in critical state, and finally +100 reward for successfully completing a PFR on a failed VNF. Accordingly, the total reward r Tot (t) would be constructed by adding up all the mentioned rewards.
To speed up the training and enhance exploration efficiency, we use a distributed learning method, where multiple agents run in parallel, on multiple instances of the environment. At each iteration, the PPO agent runs the environment in parallel for 32 times and the SAC agent runs the environment for 16 times in parallel. The generated data trajectories are saved in a buffer as a batched data-set. The agent trains its target policy with generated data for 32 epochs and moves on to the next iteration. For policy evaluation, after every 50 iterations, the agent runs the environment for 50 episodes with the most recent target policy and outputs the evaluation data averaged over episodes. It is worth noting that, to evaluate the policy integrity and robustness, during training, we sample the agent's target policy every 500 iterations, and evaluate it in a new environment with new random parameters. The results are discussed in the next.

B. Results Discussions
In this subsection, we discuss about the simulation results achieved for the following main scenarios: 1) Proposed LSTM PPO-agent PFR (LSTM-PPO): We propose the on-policy PPO-agent, where the agent's NN layers and hyperparameters are described in Table III,  and Table V, respectively. 2) Proposed LSTM SAC-agent PFR (LSTM-SAC): Also, we propose the off-policy SAC agent with the hybrid NN structure shown in Table III as the second approach. The agent's hyperparameters are described in Table VI. 3) No-LSTM PPO as a baseline (NLSTM-PPO): In this baseline, we do not use hybrid layers in the agent's network structure. The NN structure is described in Table IV.  We use multiple approaches and hyperparameters tuning to solve the problem in this paper to get the best outcome. Additionally, we examine our approaches with no discount factor, i.e, γ = 1, and with considering discount factor, i.e, γ = 0.99. The motivation is to emphasize the impact of the discount factor on the current action and the most rewarded action. Moreover, we used early stopping method when an agent achieves an acceptable level of accuracy, i.e., when the agent reaches a good performance in all normal, warning, and critical states, to prevent model over-fitting. Approaches and results are discussed as follows: 1) Analysis on the Orchestrator's Decisions: In this section, we discuss the agents decision-making in each state of every VNF.
• Analysis on Critical State: We define the critical state accuracy as the ratio of detecting critical state and taking desired actions, as follows:

CSA
Number of taking correct actions in critical state Total number of critical states occurrence , which is shown in Fig. 4. It can be seen from Fig. 4, LSTM-PPO outperforms LSTM-SAC, meaning that the agent properly understands the critical state and takes the desired actions (as defined before). Even the baseline NLSTM-PPO gets similar results as the LSTM-PPO. PPO is well-known for fast convergence [23], it does also converge faster to high critical state detection accuracy in our model as expected.
As mentioned before, the sampled policy of LSTM-PPO and LSTM-SAC in a new environment achieves approximately 99.7% and 96.6% CSA, respectively.
• Analysis on Warning State: Fig. 5  As shown in Fig. 5, the LSTM-SAC agent reaches better WSA compared to LSTM-PPO and prepares the service for possible failures. The baseline NLSTM-PPO shows a very poor functionality on understanding to prepare service for failures and service degradation. Accordingly, it seems that the LSTM-PPO gets stuck in a local optimal solution, which is a well-known issue for on-policy training. In the new environment analysis, the sampled policy shows similar functionality in the training  As discussed before, the correct action for this state is to remove the placed backup and failure preparations, which cost. In our model, the learning rate emphasizes the importance of taking the right action for all states as they take place. The agent with γ = 1 operates better, because its reward was not discounted during the progress of steps, and its correct action positive reward has better impact on training policy. As further explanation, our agent gets nearly 100 times better reward on realizing PFR. Therefore, the trained policy's higher priority is to achieve PFR to get the highest reward, and due to lesser rewards of correct action in the normal states, the BR action has lower priority. The discounted reward encourages this prioritized behavior. The motivation of using rewards with no discount was to smooth this prioritized behavior and to get better results even in the normal states. The normal states do not directly depend on impending-failure occurrence, i.e., direct normal to critical (failure) transition probability is considered zero [7]. Therefore, the achieved reward by the BR action is independent of achieving PFR rewards. As a result, using no-discount reward in PFR achieves better performance in this state.
2) Analysis on PFR: To give a clear comparison between the PFR and RFR behavior of our designed agent, first, we define PFR accuracy and RFR accuracy, respectively, as follows Portion of detected critical states recovered with PFR Number of all detected critical states , and Portion of detected critical states recovered with RFR Number of all detected critical states .
This accuracy comparison is shown in Fig. 7. The figure shows that LSTM-SAC with no discount reward seems to have small fluctuation around 25 × 10 3 iterations, but after 5 × 10 4 iterations, it converges to excellent performance, and approximately in all times, it manages to do PFR on detected critical states. LSTM-SAC with discounted reward shows a similar performance to the no discount version. Clearly, LSTM-PPO could not manage performance as well as LSTM-SAC, but the results are acceptable. Furthermore, even after 3 × 10 5 iterations, NLSTM-PPO shows a poor performance on figuring out the notion of PFR. Note that, when a VNF is recovered in a proactive manner, it means that the first two steps of the recovery procedure are executed before failure occurrence, and by modification of synchronization bandwidth, the recovery delay in SLA is not violated. Therefore, the higher PFR percentage implies that most of times failures are detected and fixed, which results in better NFV-based network performance and the user's quality of experience (e.g., by minimizing interruption times for a running services). Moreover, Fig. 8 illustrates how different agents learn the notion of PFR during time evolution, i.e., the number of iterations. As seen from the figure, as time grows, the agents with hybrid NN tend to perform PFR more than RFR which is the result of setting appropriate reward function.
3) Analysis on the Effect of Network Dimension: In Fig.  9, we evaluate the impact of the network dimension, i.e., K and V , on the aforementioned accuracy metrics. As shown in  Fig. 9, our proposed agents has done a better job on smaller network dimension. The reason is that we tried to correct every event in the network simultaneously, and as the network dimension grows, the action space and state space grow too. Therefore, the overall performance degrades. But, the results with LSTM-SAC, show reasonable performance on warning and critical detection, and also reasonable results on PFR are observed. It is worthwhile to mention that as the network dimension grows, more failures could occur along an episode, and therefore, the agent would get more collective reward by completing PFR on failed VNFs. As a result, in normal state, a poor functionality is observed due to higher priority of PFR incurred from different rewards corresponding PFR and BR actions. Accordingly, efficient network resource utilization is not guaranteed, i.e., more resources are utilized. 4) Summary of Discussion and Insights in DRL Algorithm Design: To summarize the workflow, as the first attempt to simulate our proposed ZT-PFR, we used the aforementioned NLSTM-PPO structure. But as discussed, the outcome was not reasonable and the agent could not figure out how to recover a failed VNF in the intended proactive manner. Due to the timedependent nature of our proposed model and the impendingfailure notion, we applied a hybrid NN consisting of LSTM layers, called LSTM-PPO, to capture time-dependent features to cover the impending-failure notion.
The results of LSTM-PPO indicate better performance in figuring out PFR and achieve a reasonable accuracy. But due to insufficient exploration in on-policy PPO methods, the agent gets stuck in a local optimum [16]. However, LSTM-PPO achieves a reasonable level of accuracy (shown in Figs. 4-6), but it does not get better through longer iterations. To achieve better accuracy and solve the exploration problem of on-policy methods, we devise the off-policy method named SAC. The results show a remarkable performance, where LSTM-SAC achieves a better performance in almost all of the metrics. It is worthwhile to mention that the PPO agent performs slightly better on detecting near critical states. In addition, the PPO agent takes less time to converge (approximately half of SAC convergence time). For further analysis, we tried to train the proposed LSTM-SAC and LSTM-PPO on a network with bigger dimensions. LSTM-SAC achieves a better performance. However, because of the higher dimension and problem complexity [22], the results are not as good as for smaller dimensions.

VII. CONCLUSIONS
We proposed a resource-efficient zero-touch PFR for stateful VNFs in the context of embedded SFC in an underlying NFV-enabled network. We formulated an optimization problem aiming to minimize a weighted cost including network resource usage cost and wrong decision penalty. As a solution, we customized state-of-the-art DRL-based algorithms such as SAC and PPO. We adopted a hybrid NN structure consisting of LSTM layers to capture the impending-failure time dependency, resulting in ZT-PFR performance improvement. We proposed a novel simulated environment considering impending-failure concept, inspired by ETSI [7] and ITU [33], to train and test our DRL agents. Moreover, we applied the concept of AoI to strike a balance between the event and scheduling-based monitoring to guarantee the network's tolerable freshness level. Several simulation scenarios are conducted to showcase the efficiency of our DRL algorithms and provide a fair comparison with baseline methods. The results illustrated that no-discount LSTM-SAC and LSTM-PPO outperform other algorithms with remarkable performance in ZT-PFR. However, we remark that NFV environments has an ever-changing nature. Hence, learning methods for such environments should be in an online fashion with fast training and higher sample efficiency, thus studying such methods could be an interesting research direction. For future works, we intend to examine our ZT-PFR model in practical network environments, extend our model to tackle dynamic and everchanging NFV environments, and improve its performance in a larger network dimensions.