Many existing works have focused on the caching capabilities of small base stations (SBSs), neglecting the role of portable devices, which have an important influence on the edge caching system. Although an individual device has a relatively limited buffer space, putting several devices together (i.e., crowd participation) can provide enough content to satisfy various applications [

15]. As an example,

Figure 2 shows a system architecture in mobile edge computing, where some advertisement information, such as special bar recommendations and coupon distributions, can be pre-cached in the SBSs and diffused through user terminals (UT). In general, there are three basic questions that should be answered in such a system:

#### 2.1. Cache Size: How Big Is the Buffer Space?

Since the connection between nodes in MEC cannot be guaranteed, the edge nodes must store part of the content in advance and cache some copies of the content temporarily in the buffer space. A fundamental question hence arises: how much buffer space should each node reserve? We think that an upper bound exists for the node buffer size, which is the smallest value that can guarantee the desired performance such as the caching hit ratio and transmission delay. In our study, the transmission process and the intermittently connected links are modeled by an edge-Markovian dynamic graph [

16], and we analyze the buffer limitation from the percolation theory perspective. The inter-contact time series reproduced by this model show a similar power law and exponential tail distribution as those observed in many real data traces. In the model, each edge has two states: active and inactive, which are distributed with an arbitrary initial probability. Based on a two-state Markovian process, one edge changes its state with an active probability

p and an inactive one

q between two sequent slots. Specifically, if an edge is active at slot

t, it switches to the inactive state at slot

t + 1 with a probability

q. On the other hand, if it is inactive at slot

t, it becomes active at the next slot with a probability

p. Based on the percolation theory, there is a special state for the network, called the supercritical case, in which there exists a connected giant group at any moment when the density of nodes goes to infinity. The precondition for the supercritical case is

$p>{p}_{c}$ (i.e., in an ultra-dense environment such as the cell networks we discussed), where

${p}_{c}$ =

$c\frac{logn}{n}$,

n is the number of nodes and

c is a constant. We find that, in the supercritical case, there exits an upper bound on the node’s buffer size, which is independent of the inactive probability

q [

17].

#### Upper Bound Analysis

In the supercritical case, depending on whether the nodes belong to the giant cluster or not, they can be classified into two types: connected nodes and disconnected nodes. The former belongs to the giant cluster, while the latter does not. The connected nodes constitute a connected group, where packets are forwarded fast. On the contrary, buffer sizes of disconnected nodes are larger than those of the connected nodes, because packets in the disconnected nodes need to wait a longer time until the edges turn active. The worst case is that both the source node

s and destination node

d are separated by the giant cluster. This leads to the maximum time and buffer space being required to store the packets, as shown in

Figure 3. There are three phases in the transmission process in this case: the source flooding phase, the shortest path phase and the destination flooding phase [

18].

(1) Source flooding phase: In general, the flooding strategy has the lowest transmission delay and highest packet delivery ratio; at the same time, it results in the largest buffer space, which is necessary for this paper, since we focus on the fundamental bounds on node buffer size, especially in the worst case. In the flooding scheme, if both the source

s and its neighbors belong to disconnected nodes, packets must be flooded to each other when the link between them is active. That is, if there is a packet at node

u at time slot

$t-1$, node

u will send the packet to all its neighbors at time slot

t. We use an infectious-disease-diffusion algorithm to characterize the flooding process [

19] and classify nodes into a susceptible state and an infected state. A node is called infected if it carries a packet; otherwise, we call it susceptible.

Based on the disease-diffusion algorithm, the source node

s first transmits multiple copies of a packet

m to neighbors. The newly infected nodes then repeat this process until one or more connected nodes belonging to the giant component receive

m, as shown in

Figure 3a. At the end of this phase, one connected node and several disconnected nodes consist of the source expanding tree,

$SET$.

(2) Shortest path phase: In this case, a connected path for each source-destination pair exists with a high probability in the giant cluster; the packets therefore can be transmitted along this path. In other words, if there is a packet at time slot

$t-1$ at node

u, node

u will instantaneously send the packet to the next hop along the shortest path at the next time slot

t, only if the edge between them is active. Thus, the packets will quickly reach the node

v as shown in

Figure 3b.

(3) Destination flooding phase: After the node

v receives the packet

m, it floods

m among the disconnected nodes until one of the infected nodes encounters the destination node

d. Finally, all infected nodes in this phase constitute the destination expanding tree,

$DET$ as shown in

Figure 3c.

From the above discussion, we can infer that the buffer occupation in the disconnected nodes is low. The reason behind this is that there exists a giant cluster, leading to a finite size of $SET$ and $DET$ in each time slot. Hence, the disconnected nodes only need to cache packets coming from nearby sources or going to nearby destinations.

We can obtain the expected waiting time before the links become active through the property of the edge-Markov chain and derive the expectation of the buffer size for a random selected node. Based on the edge-Markov model, it can be inferred that the time when the packet is first sent from the source node into the connected nodes does not exceed $logn/pM$, and the expectation of the buffer occupation of node u will be the sum of the above two parts: $E\left({B}_{u}\left(t\right)\right)={c}_{1}r{T}_{d}\left(logn/\phantom{lognpM}\phantom{\rule{0.0pt}{0ex}}pM\right)$ where M is the size of the giant cluster and ${c}_{1}$ is determined by ${S}_{n}$ and ${D}_{n}$, which are two parameters that denote the number of infected nodes in the source-flooding stage and destination-flooding stage, respectively.

#### 2.2. Content Copies: How Many Copies Should Be Stored?

The gain of edge caching is actually larger than that of cellular communication. The performance improvement reaped via retrieving the content from the adjacent edge nodes should be derived theoretically. However, even if we consider the storage abilities of both user terminals and small base stations, a wide gap exists between the limited caching capacity and the continuously increasing data traffic from the wireless links. It is hence important to decide which content and how many content copies must be cached based on a holistic method for the maximization of profitability, i.e., we should prefetch content by integrating its potential popularity, transmission gains and locations of existing copies over the network topology. We can use the traditional knapsack algorithm to model the optimization caching problem and further convert it into a resource-allocation problem with a global learning rate. Then, the tech-oriented solutions can be found so as to decide what to cache and how many copies to cache by analyzing the global user earning performance.

We introduce the system model shown in

Figure 2, which includes a single macro cell,

${N}_{1}$ SBSs and

N mobile UTs. The macro base station (MBS) can be regarded as a content server with the largest storage capacity, which means that it can access all files from a library. For the sake of simplicity, all files are limited to the same length. SBSs and UTs are modeled as mutually independent Poisson point distributions. The suitable content will be pre-stored to serve the requests through device-to-device (D2D) communication over short distances. The pre-store procedure will be controlled and implemented by the MBS during the off-peak hours. Each SBS is equipped with a cache of size up to

${m}_{1}$. Analogously, the UTs are equipped with a buffer size

m.

To decide the number of copies of each file and the edge nodes that store these files before they are requested, the caching hit ratio $\Phi \left(C\right)$, i.e., the expected probability from the requesting user terminals (RUT), can be regarded as the gain function and optimal goal. From the feasible placement vector, $C=\{{C}_{1},{C}_{2},\cdots {C}_{M}\}$, which denotes the number of content copies in the communication area of the MBS, and ${p}_{i}$, which denotes the average request probability of the i-th file, the caching hit ratio can be modeled as $\Phi \left(C\right)={\displaystyle \sum _{i=1}^{M}}{P}_{i}(1-{e}^{-\lambda \pi {r}^{2}{C}_{i}})$. Note that the SBSs and UTs must have different spatial intensities with parameters ${\lambda}_{s}$ and ${\lambda}_{u}$, i.e., the number of UTs distributed in the same space must be larger than that of SBSs for ${\lambda}_{u}>{\lambda}_{s}$. As the SBSs and UTs are equipped with different storage capacities, ${m}_{1}$ and m, respectively, the intensities of the edge nodes caching the i-th file in the communication radius of the RUT can be further described in terms of the constituent components as $\lambda =a({\lambda}_{s}{m}_{1}+{\lambda}_{u}m)$, where a is defined as an intensity factor of the caching probability. In fact, the mean number of SBSs and UTs in a macro-cell can be determined by their intensities ${\lambda}_{s}$ and ${\lambda}_{u}$ according to the theory of PPP, i.e., ${N}_{1}={\lambda}_{s}\pi {R}^{2}$ and $N={\lambda}_{u}\pi {R}^{2}$.

Aiming at the maximization of the hit ratio in the local network, we transform the optimization problem from a many 0-1 knapsack problem into a complete-knapsack problem with a decomposition style. Constraints $0\le {C}_{i}\le {N}_{1}+N$ and $0\le {\displaystyle \sum _{i=1}^{M}}{C}_{i}\le ({N}_{1}\ast {m}_{1}+N\ast m)$ can be derived from the incidence matrix, since the total number of i-th file copies cannot exceed the total number of nodes, i.e., each node is permitted to store no more than one copy of the i-th file, so that the total number of file copies cached in the edge nodes should be smaller than the total storage capacities. Recall that in a complete-knapsack problem, the number of the items associated with a value function is infinite, instead of one, as in a 0-1 knapsack problem. In other words, it is possible to fetch an arbitrary number of i-th file copies cached in edge nodes within the domain. The optimal caching vector can be found by dynamic programming or various polynomial approximation algorithms. Since the optimization objective is a sum of convex functions and all the constraints are linear, the optimization problem is obviously convex. Thus, one approximation exists by solving a continuous relaxation problem with the method of Lagrangian multipliers, which is dependent on the fractional knapsack problem.