On Optimal Proactive and Retention-Aware Caching with User Mobility

Caching popular contents at edge devices is an effective solution to alleviate the burden of the backhaul networks. Earlier investigations commonly neglected the storage cost in caching. More recently, retention-aware caching, where both the downloading cost and storage cost are accounted for, is attracting attention. Motivated by this, we address proactive and retention-aware caching with user mobility, optimizing the sum of the two types of costs. This is a combinatorial optimization problem. However, we derive a stream of analytical results and they together lead to an algorithm that guarantees global optimum with polynomial-time complexity. Numerical results show significant improvements in comparison to popular caching and random caching.


I. INTRODUCTION
The explosive mobile data traffic growth is putting a heavy burden on backhaul links, causing delays in downloading contents. However, a large portion of the mobile traffic is due to duplicate downloads of a few popular contents. Caching technology has been considered as an effective solution to reduce the burden of the backhaul, by storing the contents on edge devices [1]. This enables the mobile users to download their requested contents from the nearby devices instead of downloading the contents from the core network. In modeling such scenarios, most of research efforts focused on downloading cost. However, storing a content may be subject to a cost as well. A storage cost may be due to flash rental cost incurred by cloud service providers or flash damage caused by writing a content to the memory device [2]. In both cases, the storage cost typically depends on the time duration of storage, hereafter referred to as the retention time. Intuitively, with longer retention time, the requested contents can be obtained with higher probability from the cache, thus avoiding the cost of downloading from the network. But longer retention time results in a higher storage cost. Therefore, what to cache and for how long are both key aspects in optimal caching. Few works in studying optimal caching have considered the impact of storage cost. The works such as [3]- [5] considered only the downloading cost. The study in [3] proposed an approximation algorithm with performance guarantee for multicast-aware proactive caching. The authors in [4] considered cost-optimal caching with user mobility. They presented an extension in [5] by providing a linear lower bound of the objective function.
In these works, storage cost was neglected. The study in [6] chose to represent storage cost using a random variable. Later, the work in [7] suggested that the storage cost can be better modeled by an increasing linear/convex function. Another limitation of [6] is that the retention time is fixed. Later, this assumption was relaxed in [8] and the retention time was treated as an optimization variable in a time-slotted system. We remark that in [8], a user is associated with only one cache. A generalization of a multiple-path routing model with retention-aware caching was studied in [9].
For mobility scenarios, contents are often cached at mobile devices. They can exchange the requested contents when they move into the communication range of each other. Making the best of mobility information between mobile users can significantly improve the caching efficiency [4], [10], [11]. However, considering both downloading and storage costs, with presence of user mobility, calls for further research. To this end, our main contributions are as follows.
• We formulate a Proactive Retention-Aware Caching Optimization (PRACO) problem with user mobility in a timeslotted system, taking into account both the downloading and storage costs. • This problem is a combinational optimization in its nature. However, we provide mathematical analysis in order to facilitate the computation of global optimum time-efficiently, namely, we first prove that for any content, the optimal caching decisions over the time slots can be derived, given the initial number of mobile users caching the content; the above analysis is then embedded into a dynamic programming algorithm and we prove it is both globally optimal and of polynomial-time complexity.
• The numerical results show significant improvements in comparison to two conventional algorithms, namely, popular caching and random caching.

A. System Model
We consider a vehicular network scenario which consists of a content server having all the contents, a number of vehicles, and road side units (RSUs) providing signal coverage for the vehicles. Denote by R the set of vehicles that are interested in requesting contents, referred to as requesters, whose index set is represented by R = {1, 2, . . . , R}. Denote by H the set of vehicles that we call helpers. Each helper is equipped with a cache of size s, that can supply the requesters with contents from the cache, and therefore to mitigate backhaul congestion. We consider a library of C contents, whose index set is C = {1, 2, . . . , C}. The sizes of all the contents are the same and are assumed to be one. In addition, each content is either fully stored or not stored at all at a helper. Figure 1 shows the system scenario. The event that vehicles move into the transmission range of each other is called a contact, during which communication between them can occur. We consider that the contact between any two vehicles follows a Poisson distribution. Poisson distribution can characterize the mobility pattern of vehicles as the tail behavior of the inter-contact time distribution can be characterized as an exponential distribution by analyzing the real-world vehicle mobility traces, see [12]. Here, we assume a homogeneous contact rate for all the vehicles, denoted by λ. This assumption is in fact common [13], [14]. As a consequence, it is not necessary to explicitly consider the content cached by each helper, as there is no difference between the helpers in the perspective of the requesters. Thus, the caching performance is fully determined by the number of helpers for each content. Moreover, it is obvious that a content is cached by no more than H helpers. Therefore, in modeling cache capacity, it is sufficient to constrain that the total number of the cached contents of all the helpers does not exceed S = sH.
We consider a time-slotted system where each time slot 1 is of duration δ. The time period subject to optimization consists of T time slots. In each slot, all the requesters are active and ask for some content. Also, no requester becomes helper in the next slots or vice versa. Each requester has its content request probabilities, of which the distribution is independent of time slot. The probability that content c is requested by requester r is denoted by w rc , with c∈C w rc = 1. The contents, if cached by the helpers, are fetched at the beginning of the time period. When a requester asks for a content in a slot, the requester will first try to collect the content from the encountered helpers. If the requester fails to obtain the content at the end of this slot, it downloads the content from the server. In the latter case, a downloading cost is incurred.

B. Cost Model
Denote by x our caching decision which is a C × T matrix for the C contents and the T slots. The entry at location (c, t), i.e., x ct , denotes the number of helpers storing content c in slot t, x ct ∈ {0, 1, . . . , H}. The caching optimization process, applied at the beginning of the time period, will determine the number of helpers for each content as well as the retention time. The latter is represented by the number of helpers over the time slots, and this number either remains or decreases from one time slot to the next.
Downloading a content from the server results in a downloading cost. Also, caching a content in a helper has a storage cost due to storage rental cost and flash memory damage. Same as [8] and [9], we neglect the cost of the helpers to fill their caches at the beginning of the time period. In addition, for the requesters, the downloading cost from helpers is negligible in comparison to that from the server. Therefore, the total cost consists of the downloading cost from the server for the requesters and the storage cost for the helpers.
Denote by f (t) the storage cost due to storing a content in a helper's cache in slot t. A longer retention time needs a higher threshold voltage, which results in a higher memory damage and consequently gives a higher storage cost, for more detailed discussions, see [2]. Motivated by this, we assume that f (t) is an increasing function.
When content c is requested by requester r in slot t, the probability that the requester has to download the content from the server is denoted by p crt . If r does not meet any helper having c within the slot, the only way of obtaining c is to download from the server. As the contacts between the users follows a Poisson distribution, p crt is given by: Thus, the total cost, denoted by Cost(x), reads as: where α is the weighting factor of the two cost types.

C. Problem Formulation
The proactive retention-aware caching optimization (PRACO) problem can be formulated as (2).
Constraints (2b) guarantees that the total number of stored contents in each time slot does not exceed the total cache capacity, i.e., S. The formulation does not explicitly require the number of helpers of any content does not increase over time. This aspect is analyzed later on in Section III.

III. PROBLEM ANALYSIS
We prove that for each content, the optimal number of helpers caching the content decreases over the time slots. Next, we present an algorithm, which, with respect to the possible initial numbers of helpers of a content, computes the optimal number of helpers for this content over time. We then prove that the algorithm's optimality and its polynomial time complexity.
Lemma 1. For any content c and time slot t, if k helpers minimizes the total cost for t, then for any t ′ > t, the total cost of using k ′ > k helpers is higher than using k helpers.
Proof. The total cost for content c and time slot t is: As the minimum of ∆(x ct ) occurs for x ct = k, we have: is an increasing function. Thus: (4) and (5), we obtain: for x ′ ct ′ > k. By rearranging the terms of (6), we have Next, we prove that for a content, if the initial number of helpers is given, the optimum can be obtained in polynomial time. The procedure is in Algorithm 1, see Lines 6 and 7. x * k1 ← x k1 5: for t = 2 to T do 7: x * kt ← arg min{∆(x kt )} In the algorithm, for each content k ∈ C, a vector z k of size (H + 1) is used to store the optimal cost for all possible initial numbers of helpers. Line 3 considers all possible initial numbers of helpers in the range [0, H]. Lines 6 and 7 compute the optimal values of x c2 , . . . , x cT , denoted by x * c2 , . . . , x * cT respectively, for given x c1 . The computation is of complexity O(HT R). For any content c and any possible initial number of helpers h, the optimal cost over all the slots are saved in z c (h). The overall complexity of Algorithm 1 is O(max{CH 2 T, CT HR}), given ∆ computed.
Note that Lines 6 and 7 are greedy by construction. Namely, for time slot t, Line 7 determines the number of helpers that minimizes the cost of that specific time slot. Even though this is intuitive, it is not obvious that the greedy choice is globally optimal for the given initial number of helpers. The optimality analysis is formalized in Lemma 2.
Lemma 2. For any content c ∈ C, if x c1 is given, then the optimal values of x ct i.e., x * ct , t = {2, 3, . . . , T } are computed via Lines 6 and 7 in Algorithm 1 in polynomial time.
Proof. For any c, consider x * c2 , . . . , x * cT , the numbers of helpers over the time slots returned by Algorithm 1 when x c1 is given. Consider another sequence x ′ c2 , . . . , x ′ cT that differs from the first sequence and offers a lower total cost. First consider the case that x * ct < x ′ ct for some t ∈ {2, . . . , T }, and x * ct remains smaller than the values of the second sequence in consecutive time slots until time slot t + n where 0 ≤ n ≤ T − t. That is, the second sequence has elements x ′ ct , x ′ c(t+1) , . . . , x ′ c(t+n) all being greater than x * ct , whereas for slot t + n + 1, . , x ′ c(t+n) to x * ct in sequence two, while keeping the values of all other time slots of this sequence. The updated sequence is feasible because x ′ c(t+n+1) ≤ x * ct . Thus, monotonicity remains for the updated sequence. The update reduces the cost of the second sequence by Lemma 1, hence a contradiction. A special case is t + n = T , for which t + n + 1 does not exist. However the same update and conclusion apply. One case remains, namely there is no time slot t with x * ct < x ′ ct , yet sequence two is different from sequence one. In other words, , . . . , T }, be the first time slot with strict inequality, i.e., x * ct > x ′ ct . Such a time slot must exist, because, otherwise the two sequences coincide. Consider increasing x ′ ct to x * ct . Sequence two remains feasible in terms of being monotonically decreasing, because . The cost of t, due to the update, becomes lower because when t is considered by the algorithm, x * ct is the optimum. Therefore in this case the second sequence cannot be better either. Hence the result.
By Algorithm 1, x * ct , t = 2, 3, . . . , T , can be computed if x c1 , c ∈ C, is given. Consequently, solving PRACO is equivalent to finding the optimal values of x c1 , c ∈ C. We drop the second subscript and use x c , c ∈ C as optimization variables for the initial numbers of helpers, and reformulate PRACO as follows. The cost of x c , i.e., z c (x c ) is from Algorithm 1. Constraint (7b) models the cache capacity.

A. Dynamic Programming
We use dynamic programming (DP) to obtain the optimal values of x c , c ∈ C. Denote by a * (k, i) the cost of optimal caching of the first k contents with a total cache capacity of i units. Thus, by definition, a * (C, S) is the overall optimal cost. The values of a * (k, i), k = 1, . . . , C, i = 0, . . . , S, submit to recursion, as formalized in the lemma below. Lemma 3. The value of a * (k, i) can be derived from the recursive formula shown in (9) for k = 2, . . . , C, with: x k ∈{0,1,...,min{i,H}} (9) Proof. We use induction. For k = 1, the result is obvious for any i = 0, 1, . . . , H. Suppose that a * (k, i) is the optimal value for some k, with i in any range of interest. By (9), we have:

min{i,H}}
For k + 1, the initial number of helpers x k+1 must be one of the values in {0, 1, . . . , min{i, H}. For any value of x k+1 , z k+1 (x k+1 ) is the optimal cost for content k + 1 (Lemma 2), and the corresponding cache capacity for contents up to k is i − x k+1 . For the latter, a * (k, i − x k+1 ) is optimal. These, together with the min-operator give the optimum for k+1.

B. Algorithm Description and Optimality
Algorithm 2 describes the DP approach. The input parameters consist of z, C, S, and H. Here, z is from the output of Algorithm 1. Apart from a * as defined earlier, b * is used to store the optimal caching solution. Lines 3-10 compute a * (k, i) and b * (k, i) for k < C, whereas Lines 12 and 13 compute a * (C, S) and b * (C, S) for k = C. Finally, b * is mapped to optimal values of x, denoted by x * , using Lines 14-20. Proof. The optimality follows from Lemma 2 and the recursion of which the correctness is established in Lemma 3. As for time complexity, the steps in Algorithm 2 together require a complexity of O(HCS) = O(H 2 Cs). However, a prerequisite is that the z-values are given. Computing these values with Algorithm 1, given ∆ computed, has complexity O(max{CH 2 T, CT HR}). Hence the overall complexity is of O(max{H 2 Cs, CH 2 T, CT HR}). Finally, note that, even though s is not a parameter for input size, its values is bounded by C, because otherwise the capacity constraint is redundant and the problem decomposes by content (and solved without the need of DP). Hence the complexity is of O(max{H 2 C 2 , CH 2 T, CT HR}), which is polynomial in input size.

V. PERFORMANCE EVALUATION
We compare the DP algorithm to two conventional caching algorithms, i.e., random caching [15] and popular caching [16]. Both algorithms consider contents for caching one by one. In the former, the contents are considered randomly, but with respect to the files' request probabilities; a content with higher request probabilities will be more likely selected for caching. In the latter, popular contents, i.e., contents with higher request probabilities, will be considered first. For the content under consideration, the cache decision is the number of helpers with minimum total cost.   if k = C then 16: 20: e ← e − b * (k, e) 21: return x * We use a Zipf distribution with shape parameter γ to characterize the content request probability for any requester. Thus, w rc = c −γ k∈C k −γ , r ∈ R. Same as [8], the time period is set to 24 hours, and the duration of each time slot (δ) is 1 hour. The storage cost is simulated using f (t) = t 2 .
Figures 2-5 provide the results and show the impacts of parameters H, α, s, and γ on the cost, respectively. It can be seen that the cost decreases with respect to all the mentioned parameters. This is quite expected. For example, when H increases, the requesters have more opportunity to meet helpers, leading to lower cost. The same conclusion can be made for cheaper storage (small α), and higher capacity (larger s). For parameter γ, a higher value means more variation in the contents' request probabilities, thus it is easier for the algorithms to identify caching solutions such that the helpers more likely store the requested contents.
The DP algorithm outperforms the two conventional caching algorithms. In Figures 2-4, the improvement is significant when H and δ increase and α decreases. For example, when H increases from 4 to 20, the DP algorithm outperforms the popular caching algorithm by 13% to 24%, and outperforms the random caching algorithm by 27% to 35%. This is because the DP algorithm uses the storage capacity of helpers optimally in comparison to the conventional algorithms.
Recall that small α means low storage cost. When α = 0.01, which is a fairly large value in the context, the optimal strategy tends to not to store contents -it is more preferable to download from the server. Hence cache optimization is less relevant and the algorithms are similar in performance. When α decreases, the difference between the performance of the DP and the other algorithms becomes apparent, as the DP algorithm uses the storage capacity optimally while the conventional algorithms are not able to accomplish this.

VI. CONCLUSIONS
The paper has studied a proactive retention-aware caching problem, considering user mobility, storage cost, and cache size. We have provided analysis and algorithm development, proving that global optimum is within reach in polynomial time. Simulation results have manifested significant improvements by the proposed algorithm in comparison to two conventional caching algorithms. In our future work, we consider a more general system scenario including non-homogeneous contact rates, helpers with different cache sizes, and contents with different sizes. Thus, the problem becomes more challenging and new solution approaches need to be developed.