Serving Graph Neural Networks With Distributed Fog Servers For Smart IoT
  Services
Graph Neural Networks (GNNs) have gained growing interest in miscellaneous
applications owing to their outstanding ability in extracting latent
representation on graph structures. To render GNN-based service for IoT-driven
smart applications, traditional model serving paradigms usually resort to the
cloud by fully uploading geo-distributed input data to remote datacenters.
However, our empirical measurements reveal the significant communication
overhead of such cloud-based serving and highlight the profound potential in
applying the emerging fog computing. To maximize the architectural benefits
brought by fog computing, in this paper, we present Fograph, a novel
distributed real-time GNN inference framework that leverages diverse and
dynamic resources of multiple fog nodes in proximity to IoT data sources. By
introducing heterogeneity-aware execution planning and GNN-specific compression
techniques, Fograph tailors its design to well accommodate the unique
characteristics of GNN serving in fog environments. Prototype-based evaluation
and case study demonstrate that Fograph significantly outperforms the
state-of-the-art cloud serving and fog deployment by up to 5.39x execution
speedup and 6.84x throughput improvement.
Liekang Zeng, Xu Chen, Peng Huang, Ke Luo, Xiaoxi Zhang, Zhi Zhou
# Serving Graph Neural Networks With Distributed Fog Servers For Smart IoT Services

###### Abstract

Graph Neural Networks (GNNs) have gained growing interest in miscellaneous applications owing to their outstanding ability in extracting latent representation on graph structures. To render GNN-based service for IoT-driven smart applications, traditional model serving paradigms usually resort to the cloud by fully uploading geo-distributed input data to remote datacenters. However, our empirical measurements reveal the significant communication overhead of such cloud-based serving and highlight the profound potential in applying the emerging fog computing. To maximize the architectural benefits brought by fog computing, in this paper, we present Foggraph, a novel distributed real-time GNN inference framework that leverages diverse and dynamic resources of multiple fog nodes in proximity to IoT data sources. By introducing heterogeneity-aware execution planning and GNN-specific compression techniques, Foggraph tailors its design to well accommodate the unique characteristics of GNN serving in fog environments. Prototype-based evaluation and case study demonstrate that Foggraph significantly outperforms the state-of-the-art cloud serving and fog deployment by up to 5.39\(\times\) execution speedup and 6.84\(\times\) throughput improvement.

 Fog computing, Graph Neural Networks, model serving, distributed processing

## I Introduction

Graphs are ubiquitous. Given the intuitionistic abstraction on relational structures, graphs drive the organization and computation of miscellaneous real-world data such as traffic sensory networks [1, 2], online social graphs [3, 4], and power grids [5, 6]. To facilitate deep learning using such form of data, recent advances in neural networks have extrapolated to the graph domain, resulting in a new stream of models called Graph Neural Networks (GNNs).

GNNs differ from traditional Deep Neural Networks (DNNs) by integrating graph embedding techniques with convolutions [7, 8, 9]. In essence, GNNs leverage an iterative aggregation to an input graph and, through neural network operators, to capture hierarchical patterns from subgraphs of variable sizes. This enables the model to learn the properties for specific vertices, edges, or the graph as a whole, and generalize to unobserved graphs. Benefited from such powerful expressiveness, GNNs achieve superior prediction performance in various graph-related tasks, and have emerged as a powerful data-driven tool for enabling a multitude of real-world IoT-driven smart applications, _e.g._, traffic flow forecasting [10, 11], location-based recommendation [12, 13], and vehicle trajectory prediction [14, 15].

To render smooth services for these applications, the _de facto_ standard methodology is to offload raw data and computation to central cloud servers [16, 17]. For instance, in Fig. 1, the massive sensory data from IoT devices are fully uploaded (in physical domain) and their corresponding GNN input graph (in data domain) is computed at a remote cloud. While this paradigm may act well for many CNN-based image processing tasks [18, 19, 20], however, it can reach suboptimal performance for GNN model serving due to its unique input characteristics. First, the input graph of GNN typically spans geographically with scattered data sources, _e.g._ the IoT sensory devices, as vertices. Unlike image or video from a single source, to obtain the complete input for one inference, GNN execution is obliged to wait until all correlated data points arrive, which considerably prolongs the total serving latency. Second, as the graph scales and the number of vertices increases, the input data size grows linearly and can become much larger than an ordinary CNN inference input, emphasizing the communication stress. Worse still, the transmission cost is further magnified due to the long transmission delay of Wide Area Network (WAN) and potential network congestion. Specifically, as we will show later in SSII-C, the data uploading phase could dominate the whole procedure by consuming \(>\)95% latency in a typical cloud-based GNN serving.

To tame such intractability, a promising solution is to exploit available computing resources in proximity to data sources

Fig. 1: An example scenario of GNN serving at the network edge. Instead of entirely offloading IoT sensory data to the cloud via the delay-significant Internet, Foggraph processes GNN workloads over fog nodes in proximity to enable real-time GNN serving.
with the emerging fog computing1 paradigm [21]. Concretely, as Fig. 1 illustrates, we can sink GNN workload from remote cloud into vicinal fog nodes2 (_e.g._ 5G fog servers) and manage data collection and computation within the Local Area Network (LAN). Consequently, the avoidance of unreliable WAN connections allows observably lower communication overhead, reducing at most 67% data collection latency in our experimental measurements. In brief, fog computing exhibits prospective potential for real-time GNN serving at the network edge.

Footnote 1: In the terminology of some literature, _fog computing_ also refers to _edge computing_. Since _edge_ has represented the links in graphs, throughout this paper, we use the term _fog_ to avoid ambiguity.

Footnote 2: We exclusively use _node_ to denote a fog server and leave _vertex_ for graphs.

Nevertheless, despite the advantages, efficient fog deployment yet suffers from a set of challenges. First, different from the cloud that takes computing resources as a whole, the fog environments usually consist of loosely coupled nodes [22]. To adapt complex GNN processing over them, a distributed counterpart is required, where input data need to be judiciously placed and routed to respective fog nodes for distributed execution. Second, fog environments are inherently heterogeneous [23], _e.g._ with computing facilities ranging from small-size gateways [24] to powerful cloudlets [25]; their available bandwidth allocated for serving also vary. To exploit the maximum parallelization from the diversity, a heterogeneity-aware data placement strategy with effective load balancing is highly desired. Further complicating the problem is dynamic factors like fog nodes' load levels, network conditions, _etc._, which may dramatically decline the performance of the whole pipeline. Unfortunately, existing GNN serving mechanisms cannot sufficiently meet these requirements.

To this end, we present Fograph, a novel distributed system that enables real-time GNN inference over multiple heterogeneous fog nodes. Fograph's contribution goes beyond merely applying fog computing to boost GNN serving, instead it addresses the above challenges at four levels. First, from an execution perspective, a holistic distributed workflow is introduced for enabling fog nodes to collaboratively serve GNN inference. Second, to attain efficient runtime, an inference execution planner is designed to optimize the data placement of the input graph, along with a GNN-oriented profiling methodology that allows accurately characterizing heterogeneous computing capabilities. Third, to alleviate the communication bottleneck and ameliorate the overall performance, a novel graph data packing technique is applied that leverages the topological properties and compresses transferred data with minimal impact on accuracy. Finally, to adapt to dynamic changes such as load fluctuation, a dual-mode workload scheduler is developed which progressively adjusts the graph data placement in order to acquire the best-performing configuration. Extensive evaluation against multiple benchmarks demonstrates Fograph's superior performance gain over traditional cloud serving and straw-man fog counterpart. In summary, this work makes the following key contributions.

* An empirical study on GNN serving latency with existing cloud and basic fog mechanisms. By breaking down the overheads of communication and execution, we observe a major cost reduction on the communication side, highlighting utilizing fog computing as a promising optimization opportunity (SSII).
* A regularized workflow for fog-enabled GNN serving that covers the full lifecycle from offline configuration to online data collection and distributed runtime. Data parallelism is applied and retrofitted by leveraging the execution characteristics of GNN inference in order to collaborate multiple fog nodes (SSIII-E).
* A heterogeneity-aware distributed GNN inference system Fograph that enables real-time performance. Reflecting on the diverse and fluctuated fog resources, we design an inference execution planner with load balancing for maximum parallelization (SSIII-B, SSIII-C), and a dual-mode workload scheduler to accommodate dynamics (SSIII-F).
* A GNN-specific packing mechanism that exploits the reduced-precision resilience and sparsity of GNN workloads to minimize data uploading overhead. Our communication optimizer combines a lossless compressor and a degree-aware lossy quantizer, which exposes previously unattainable designs for distributed GNN inference, while not sacrificing the prediction accuracy of the system (SSIII-D).
* A comprehensive evaluation of Fograph using multiple benchmarks, demonstrating its superiority over state-of-the-art cloud serving and straw-man fog deployment by up to 5.39\(\times\) execution speedup and 6.84\(\times\) throughput improvement (SSIV).

## II Background and Motivation

### _Graph Neural Networks_

The real-world graphs typically contain two kinds of data. One is the adjacency matrix, implying the global structural information, and the other is the feature vectors that describe vertices and edges' physical properties. GNNs take both data as input and learn a representation vector, called _embedding_ or _activation_, for each vertex. The learned representation can be used for downstream tasks such as vertex clustering, link prediction, and graph classification [7].

In Fig. 2, we illustrate a two-layer GNN instance from the perspectives of data flow during inference process. Fig. 2(a) depicts the input graph, with vertex \(A\) and its one-hop and two-hop neighbors in different color. Fig. 2(b) unfolds a layer's detail operations. Essentially, each GNN layer collectively aggregates the neighbor vertices' activations from the previous

Fig. 2: An GNN inference instance of computing vertex \(A\)’s embedding through two GNN layers.
layer's output, and then updates the target vertex's activation using a neural network operator such as convolution or multi-layer perceptron. Within the same layer, all vertices share the same weights in Aggregate and Update functions, while different layers may differ them. To compute embeddings through a \(K\)-layer GNN, vertices should retrieve information from their \(K\)-hop neighbors. Formally, the computation of the \(k\)-th GNN layer on vertex \(v\) can be described as:

\[a_{v}^{(k)} =\texttt{Aggregate}(\{h_{u}^{(k-1)}|u\in\mathcal{N}_{v}\}), \tag{1}\] \[h_{v}^{(k)} =\texttt{Update}(a_{v}^{(k)},h_{v}^{(k-1)}), \tag{2}\]

where \(h_{v}^{(k)}\) is the representation vector of vertex \(v\) at the \(k\)-th layer, \(h_{v}^{(0)}\) is initialized by the input features of \(v\), and \(\mathcal{N}_{v}\) denotes the vertices set of \(v\)'s direct neighbors.

**Examples.** Table I lists three popular GNN models to exemplify the above two functions. GCN [26] is one of the first graph learning models that bridge the gap between spectral transformation and spatial convolutions. Its Aggregate simply uses a summation and the Update puts weighted aggregation to an element-wise nonlinearity \(\sigma(\cdot)\). GAT [27] is the representative of another GNN category that incorporates attention mechanism into feature propagation. Its inference directly uses the learned attention parameters \(\alpha_{vu}^{(k)}\) to weight neighbors and passes the aggregation through the nonlinearity for output. GraphSAGE [28] is recognized as the classic inductive GNN variant. While its training adopts sampling-based techniques to trade accuracy with training speed, its inference fully collects the neighbor sets for aggregation and update. Here in Table I we formalize its mean aggregate version.

### _Emerging Real-Time GNN Applications_

GNNs have been submerged in many scenarios with real-time responsiveness requirements, particularly for many emerging IoT-enabled smart applications. In the following, we provide several motivating examples.

**Traffic flow forecasting.** Accurately forecasting traffic speed, volume or the density of roads is the fundamental problem in Intelligent Transportation Systems (ITS). To support such intelligence, GNNs construct spatial-temporal models to perform graph-level predictions. For instance, some models [10, 29, 30] consider traffic sensory networks as a spatial-temporal graph where the vertices are roadside detectors and the edges are roads. Each vertex is attached with a time-varying vector that records immediate properties such as traffic speed and occupancy. In such circumstances, timely prediction is of paramount importance given the speedily changing traffic and its publicly wide impacts, which requires real-time GNN processing.

**Location-based recommendation.** Recommending yet-unvisited Point of Interest (POI) to potentially interested users has been a core function for many commercial mobile applications (_e.g._ Airbnb, TripAdvisor). To utilize the rich semantic information like geographical constraints and social influences, a number of works [12, 31, 13] have built upon GNN models. Several graphs are created in these systems, including a spatial graph of geo-distributed POIs, a social graph of users, and a bipartite graph connecting POIs and users based on historical consuming records. Such kind of services typically exhibit a soft-realtime necessity - if the recommendation comes late, the results can be out of date as the user may have moved to other locations. In other words, low latency GNN inference is demanded for rendering effective user experience.

**Vehicles trajectory navigation.** Autonomous robotics has become a hot spot in recent years, and efficient and collision-free trajectory navigation is a key technology to ensure its mobility [32]. As an example, in precision agriculture [33, 34], a fleet of autonomous drones move along fields to measure and maintain the crops' health, spraying pesticides if there is an infestation. GNN-based methods [32, 35] enhance this procedure by mapping the vehicles as graphs and performing inference to help plan paths instantaneously. Each drone, as a vertex, captures sensory data (for flight height, ambient light intensity, _etc._) every few seconds as features. Any delay of the control may result in catastrophic crashes of the vehicles, for which fast inference is needed.

### _Examining GNN Serving Pipeline_

This subsection examines the serving latency of _de facto_ standard cloud serving and a vanilla fog deployment to investigate how much performance fog computing can promote.

**Methodology.** The measurement targets a location-based recommendation application [36] that runs GCN inference on the SIoT dataset [37] (dataset details in Table III and SSIV-A). The used graph includes 16216 devices from Spain as vertices with 146117 social connections, and each vertex attaches a 52-dimension feature that identifies its properties such as the device's type and brand. Initially, the data are randomly divided into equal parts and assigned to 8 Raspberry Pis. During the measurement, we launch the Pis to simultaneously send the respective graph data via 4G/5G/WiFi network, and then perform inference on the cloud/fog based on _PyTorch Geometric (PyG)_[38] once the complete graph is received. The cloud server is an Aliyun instance (8vCPUs \(\mid\) 32GB \(\mid\) Tesla V100 GPU \(\mid\) 1\(\mid\) Ubuntu 16.04) located in the nearest region, and its geographical distance to the Pis is about 200km. The fog cluster consists of six heterogeneous servers (specifications in SSIV-A) as computing nodes, all set on the same campus as the Pis. In particular, for single-fog serving, we select the
most powerful one to execute; for multi-fog serving, we apply the state-of-the-art technique in [39] to place the input data among fog nodes and perform collaborative execution. During the runtime, each node maintains a local graph, computes GNN layers, and exchanges vertices data with each other when needed. The 4G/5G network employs commercial operator services, where the 5G network is provided by the 5G base stations surrounded nearby under the non-standalone (NSA) mode.

**Measurements reported.** Fig. 3 (left) shows the serving latency of the cloud, single-fog and multi-fog mechanisms under different networking settings, and Fig. 3 (right) breaks down stage-wise costs in terms of data collection and inference execution. Regarding the load distribution in the multi-fog serving, Fig. 4 visualizes the number of assigned vertices and the execution latency of each fog node.

**Key observations.** First, the fog approaches enjoy better performance than the cloud alternative, demonstrating its efficiency in vicinal serving. Quantitatively, for 4G, 5G, and WiFi, the single-fog approach achieves 1.65\(\times\), 1.73\(\times\), and 1.40\(\times\) speedups over the cloud serving, respectively. The multi-fog counterpart attains even lower latency than the single-fog. The weaker the networking condition is, the more superiority the fog serving reaps.

Second, we observe that the favour of fog serving is mainly contributed by communication. As evidence, when switching from cloud to single-fog, the data collection latency can be reduced by 64%, 67%, and 61% under 4G, 5G, and WiFi, respectively. Such a similar degree of reductions implies the consistent advantages gained by the avoidance of remote Internet data transfer. Surprisingly, multi-fog serving achieves lower costs in data collection than single-fog. It is because employing more fog nodes provides more access points and therefore widens the bandwidth and relieves the networking contention. Nonetheless, data collection still occupies \(>\)50% costs in both fog approaches as in Fig. 3 (right), suggesting that communication is yet the major spending factor in the serving pipeline.

Third, while the fog data collection significantly saves the overhead, its execution can dramatically compromise the benefit. Nearly half of the costs are taken by execution in single-fog serving, while that in the cloud is \(<\)2%. Multi-fog serving alleviates that, but only reduces 33% execution cost upon single-fog with five more fog nodes. Such inferior performance indicates poor resource utilization, which comes from the gap between equally assigned data placement and heterogeneous computing resources. This can be clearer from the measurements in Fig. 4, where the existing data placement strategy merely yields an equilibrium in the number of assigned vertices but a severe imbalance in actual load distribution.

### _Opportunities and Challenges with Fog Computing_

The advanced ability of GNNs has spread themselves to a wide range of end adoptions with real-time requirements. Fog computing, as evident by the above realistic measurements, is revealed to be a potentially effective solution to address it, with both opportunities and challenges.

**Opportunities.** By relocating execution to the approximate computing nodes close to the data sources, fog computing manages all data communication within a local network and thus avoids the unreliable and delay-significant Internet connections. Such architectural wisdom, as proved by the above empirical measurements, is translated effectually into the reduction of communication time. In addition, the multi-node fog cluster provides more space for parallel GNN processing, which can further accelerate the serving pipeline.

**Challenges.** In spite of the opportunities, simply adopting fog computing is not competent. First, to effectively exploit the fog resources, it is imperative to accurately characterize the fog nodes' heterogeneity, decide the graph data placement, and orchestrate the data flow during the runtime. Second, regarding the major contribution of transmission cost, a communication-friendly compression technique is desired for expedited graph data collection. Third, to enable resilient serving in real-time, the system should be able to react dynamically to resource fluctuation.

## III Fograph System Design

As aforementioned, the objective is to fully unleash the architectural benefits of fog computing in rendering real-time GNN serving while adapting to fog nodes' heterogeneity and dynamic changes. To this end, we propose Fograph, a distributed GNN inference system. In what follows, we present Fograph modules following its workflow.

### _Workflow and Design Overview_

Fig. 5 and Fig. 6 show the high-level view of Fograph's workflow and system design, respectively, where the five modules in Fig. 6 work for the five steps in Fig. 5 correspondingly. In the setup phase, Fograph obtains a GNN model and uses the calibration dataset to sketch the computing capabilities of the heterogeneous fog nodes. This is accomplished by the offline profiler (Fig. 6), which builds latency estimation models for predicting the GNN performance. Moreover, it

Fig. 4: The number of vertices (left) and the inference execution latency (right) of each fog node in multi-fog serving.

Fig. 3: The latency measurements of three types of GNN serving (left) and their stage-wise breakdown (right).
records the static properties of the historical input like the adjacency matrix, acting as the initial graph skeleton. A dedicated fog node is selected as the metadata server that is responsible for registering metadata from all available fog nodes (SSIII-B). Next, Fograph's execution planner (SSIII-C ) applies the latency estimates and judiciously schedules a graph data placement to match the heterogeneity among fog nodes, aiming at maximum parallelization with effective load balance guarantee.

In the runtime phase, the participated fog nodes individually collect their assigned data partitions in light of the execution plan. To speed up device-to-fog data transfer, a novel GNN-specific compression technique is employed to exploit the features sparsity and GNN's resilience to progressively reduce data uploading costs (SSIII-D ). Once input graph data completely arrive, Fograph's runtime orchestrates distributed inference execution, handling all data exchange between fog nodes (SSIII-E ). Simultaneously, each fog node's online profiler monitors its resident execution across inferences, as well as the runtime conditions, and updates the offline performance profile, periodically transferring to the metadata server for execution plan refinement (SSIII-E ). In this way, the system can adapt to dynamic-changing environments, reconfigure its execution and maintain real-time serving.

### _Metadata Acquisition and Registration_

The aim of _metadata registration_ (Fig. 5 ) is to readily provision fundamental serving configurations and sensibly characterize the heterogeneity of fog nodes, providing necessary materials for the subsequent execution planning. To achieve that, we design a dynamic profiler, operating across the setup phase and the runtime phase.

**Setup phase.** Before deployment, the offline profiler (Fig. 6 ) performs two kinds of measurements, device-independent and device-specific. The former focuses on the static configurations stated by service providers. Concretely, it comprises 1) available bandwidth of fogs, 2) the employed GNN model (trained in advance), and 3) the invariant metrics of the input graph. Here we identify the invariance as the adjacency matrix/list that depicts the graph topology, and the size of a feature vector, which is determined once a given GNN model is trained. For instance, in smart transportation applications [1, 29, 30], we can interpret them as the traffic monitoring sensors' logical topology (_e.g._ sensors as vertices and roads as edges) and the form of sensory records, both of which are known before runtime. These parameters are independent of the running platforms and thus can be profiled only once for a given model.

For the latter, we intend to establish latency estimation models that are specific to each fog node, targeting quantifying their heterogeneous computing capability. The performance of computing GNN inference, however, relies heavily on the fundamental settings such as the underlying hardware and the used DL framework, where trivial estimations based on static configurations are rough and unfaithful. Therefore, to build performance models in a precious granularity, we employ a proxy-guided profiling process: First, we construct a calibration set by uniformly sampling subgraphs of varying cardinality from the initial graph. The cardinality, defined as \(\langle c\rangle=\langle|\mathcal{V}|,|\mathcal{W}_{\mathcal{V}}|\rangle\), shapes a subgraph's size from a GNN perspective with the number of vertices it includes and their one-hop neighbors. To reserve the actual degree distribution, for each cardinality axis we collect a group of 20 samples. Next, we measure the average execution latency for each fog node by passing the GNN through the calibration set, and build regression-based latency estimation models \(\omega\), _e.g._ linear regression model in Eq. (3) where \(\beta\) and \(\varepsilon\) are regression parameters.

\[\text{latency}=\omega(\langle c\rangle)=\beta\cdot\langle|\mathcal{V}|,| \mathcal{N}_{\mathcal{V}}|\rangle+\varepsilon. \tag{3}\]

**Runtime phase.** At run time, the profiler keeps tracking the execution time of each fog node to update the offline estimates and derives the balance indicators in order to gauge the global performance. To keep the profiler lightweight, instead of adopting a more accurate but prohibitively costly estimator, we employ a two-step linear estimation to predict the inference latency on the fly. In the first step, the profiler measures the actual execution time of the local \(c\)-cardinality graph, denoted by \(T_{(c)}^{\text{real}}\), during each inference. Next, it calculates a load factor \(\eta\) as the ratio between the actual time and the offline

Fig. 5: Fograph workflow overview. In the setup phase, Fograph first profiles and registers metadata, _e.g._ model parameters and capability estimates, to the metadata server, and next decides a graph data placement among fog nodes through the execution planner. In the runtime phase, fog nodes collect graph data from devices, and perform collaborative execution for inference results. Simultaneously, Fograph monitors the load variation of fog nodes and dynamically adjusts the data placement to ensure resilient efficient serving.

Fig. 6: Fograph design overview, where the five modules correspondingly work for the five steps in Fig. 5.
latency estimate of cardinality \(c\), _i.e._\(\eta=\frac{T_{c}^{\text{enc}}}{\omega(c)}\). As the second step, the profiler treats the load factor as a reflection on the present load level, and uses it to predict the latency of all other cardinalities. Thus, the latency of a different cardinality \(c^{\prime}\) is estimated as \(\eta\cdot\omega(\langle c^{\prime}\rangle)\).

### _Inference Execution Planning_

Given a GNN model, Fograph exploits data parallelism to distribute the inference workloads over multiple fog nodes, where input data needs to be divided and distributed. To attain high-performing serving, an _inference execution planner_ (IEP, Fig. 6 ) is developed to schedule data placement ahead of runtime.

**Problem formulation.** Let \(\mathcal{G}=(\mathcal{V},\mathcal{E})\) define a GNN input graph, where \(\mathcal{V}\) and \(\mathcal{E}\) are the set of vertices and edges, respectively. Suppose a set \(\mathcal{F}\) of \(n\) fog nodes are available in serving, denoted by \(\langle f_{1},f_{2},\cdots,f_{n}\rangle\). Each vertex \(v_{i}\in\mathcal{V}\) is a data source point (_e.g._ a sensor), and its placement to a certain fog \(f_{j}\) is specified by a binary variable \(x_{ij}\in\{0,1\}\). While a fog admits multiple vertices, a vertex can only be placed to exactly one fog, _i.e._,

\[\sum_{j}x_{ij}=1,\ \forall v_{i}\in\mathcal{V}. \tag{4}\]

To reckon the cost of a fog's data collection process, we should tally the transmission latency of all vertices placed to it, as in Eq. (5), where \(\varphi\) is the data size of a single vertex's feature vector and \(b_{j}\) indicates the \(f_{j}\)'s available bandwidth for serving.

\[t_{j}^{\text{colle}}=\frac{\sum_{i}x_{ij}\varphi}{b_{j}},\ \forall f_{j}\in \mathcal{F}. \tag{5}\]

To calculate the inference execution latency on \(f_{j}\), we summarize its placed vertices as a subgraph \(\bigcup_{i}x_{ij}v_{i}\), and estimate its computing time through the performance model \(\omega(\cdot)\) from metadata. Besides, for the complete execution runtime, there are additionally \(K\) synchronizations for cross-fog data exchange through a \(K\)-layer GNN, due to GNN's neighbor aggregation mechanism as discussed in SSII-A. Assuming the cost of a synchronization is \(\delta\), we append \(K\delta\) to complement the total execution cost, as in Eq. (6).

\[t_{j}^{\text{exec}}=\omega_{j}(\bigcup_{i}x_{ij}v_{i})+K\delta,\ \forall f_{j}\in \mathcal{F}. \tag{6}\]

Putting both data collection and inference execution together, the objective of IEP is to find an efficient data placement strategy \(\pi=\{x_{ij}|\forall v_{i}\in\mathcal{V},\forall f_{j}\in\mathcal{F}\}\) such that the latency of the complete serving pipeline is minimized, formally formulated in problem \(\mathcal{P}\):

\[\mathcal{P}:\text{min}\ \text{max}_{j}(t_{j}^{\text{colle}}+t_{j}^{ \text{exec}}), \tag{7}\] \[\text{s.t.}\ (4),(5),(6).\]

**Theorem 1**.: _The IEP problem \(\mathcal{P}\) is NP-hard when the number of fog nodes \(n\geq 2\)._

The quality of this data placement matters in that 1) uneven assignment usually catalyzes the straggler effect [40] and 2) skew load distribution commonly accompanies communication bottlenecks, and either of them can largely slow down the parallel performance as measured in SSII-C. However, to yield an optimal solution of \(\mathcal{P}\) is intractable when the number of fogs \(n\geq 2\), due to its NP-hardness stated in Theorem 1 (proof in Appendix A). Unfortunately, the integration of the unique computation pattern enforced by GNN workload and the inherent heterogeneity of fog nodes makes existing data placement techniques hardly be applied.

**IEP data placement.** To enable real-time GNN serving among fogs, we alternatively leverage heuristics to make efficient optimization. Specifically, we capitalize two insights in IEP: 1) Co-locating vertices with connections to a mutual data partition can not only save its computing time \(\omega_{j}(\bigcup_{i}x_{ij}v_{i})\) on a single fog but alleviate the synchronization burden \(K\delta\) in Eq. (6). This knob attributes to GNN's neighbor aggregation mechanism, where computing inference over a data partition is essentially operating on a neighbor-augmented graph upon the vertices it contains. Maximizing the vertices' locality within a data partition can thus significantly decrease the number of neighbors \(|\mathcal{N}_{\mathcal{V}}|\), so that the computing time (refer to Eq. (3)) and synchronization costs (for pulling neighbors from other fogs) are lessened simultaneously. 2) In light of the parallel nature of \(\mathcal{P}\), a serving-oriented load balance with regards to heterogeneous computing capability and diverse bandwidth can profitably promote the holistic performance. Particularly, the costs of data collection \(t_{j}^{\text{colle}}\) and inference execution \(t_{j}^{\text{exec}}\) should be jointly considered to maximize the utilization of available resources. Motivated by these two insights, we tackle \(\mathcal{P}\) via a two-step optimization that first preprocesses the input graph to generate locality-maximized partitions, and next maps them to fog nodes accounting for both computation and communication resources.

Fig. 7 depicts its overall flow in IEP and Algorithm 1 shows the pseudocode. First, we intend to generate data partitions over the input graph, aiming at both internal vertex locality and load balancing. Instead of searching by brute force, we remark that this task is partially related to Balanced Graph Partitioning (BGP), a family of problems that have been extensively studied [41, 42]. Particularly, maximizing the partitions' internal locality can be conversely interpreted to a minimization on inter-partition connections, _i.e._ edge-cuts. Therefore, as an initialization, we employ BGP solvers and attain a group of \(n\) min-cut data partitions, where \(n\) is the number of fogs (Line 2). These partitions, however, are merely statistically balanced in vertices' number rather than actual GNN workload, which may still induce uneven load distribution (as discussed in SSII-C). To bridge this gap, in the second step, we build a resource-aware mapping between partitions and fogs. Specifically, a bipartite

Fig. 7: Illustration of Fograph’s data placement algorithm, which primarily comprises of a graph partitioning step and a resource-aware matching step.
graph \(\mathcal{B}\) is defined as in Fig. 7 (_Res.-aware mapping_ box), with partitions \(\langle P_{1},P_{2},\cdots,P_{n}\rangle\) and fogs \(\langle f_{1},f_{2},\cdots,f_{n}\rangle\) in separate columns. We associate every partition-fog pair with an edge, weighted by a compostive cost \(\langle P_{k},f_{j}\rangle\) of uploading and executing partition \(P_{k}\) on fog \(f_{j}\):

\[\langle P_{k},f_{j}\rangle=\frac{|P_{k}|_{\mathcal{B}}}{b_{j}}+\omega_{j}(P_{k })+K\delta,\ k,j\in\{1,2,\cdots,n\}. \tag{8}\]

Yet to find a mapping in \(\mathcal{B}\) that satisfies \(\mathcal{P}\)'s min-max objective has a huge decision space of \(n!\), and differs from the traditional bipartite matching problem of maximum weighted sum [43]. However, we observe that it is a variant of _Linear Bottleneck Assignment Problem (LBAP)_[44], and we can apply a threshold-based algorithm to solve an optimal mapping. Specifically, it first instantiates a priority queue \(\mathcal{Q}\) to accommodate all edge weights in \(\mathcal{B}\), and next successively inspects every element in iterations. For each iteration, it dequeues the front element in \(\mathcal{Q}\), the maximum weight in the queue, as the weight threshold \(\tau\), and filters edges in \(\mathcal{B}\) that have a weight smaller than \(\tau\) to construct an auxiliary bipartite graph \(\mathcal{B}^{\prime}\) (Line 8-10). Applying the Hungarian algorithm [45], we obtain a mapping \(M\) in \(\mathcal{B}^{\prime}\) and check whether it is a perfect matching towards the original bipartite graph \(\mathcal{B}\). If succeed, we record the obtained mapping in \(M^{*}\), and move forward to another iteration for new attempts with lower thresholds. Otherwise, there is no perfect matching anymore in filtered bipartite graphs since the remaining to-be-examined thresholds in \(\mathcal{Q}\) will be smaller; the obtained mapping \(M^{*}\) is thus the expected result that minimizes the maximum weight in \(\mathcal{B}\) and the iteration consequently terminates. Finally, the algorithm ends by returning the \(M^{*}\)'s corresponding data placement \(\pi\).

**Discussion.** The expense of IEP's first step mainly relies on the selected BGP solver, and Fograph allows for altering appropriate solvers to adapt to specific graphs and reduce the overhead. The second step takes \(O(n^{2})\) iterations for threshold descending, according to the \(O(n^{2})\) length of the priority queue from the bipartite graph \(\mathcal{B}\) with \(n\) partitions and \(n\) fogs. However, we can use binary search to further expedite the threshold searching, which can significantly decrease overall iterations to \(O(\log n)\). As each iteration's Hungarian algorithm invocation requires \(O(n^{3})\), the second step of IEP takes a total time complexity of \(O(n^{3}\log n)\). We note that such a complexity is affordable since the number of available fog nodes in real deployment is usually small (_e.g._\(<\)100). Besides, the scheduling overhead of IEP data placement is an upfront cost before runtime and it can be amortized across multiple inferences. In our implementation, we apply the widely-adopted _METIS_[46] as the BGP solver and binary search for the mapping step, which spends only seconds for SIoT in total.

To verify the effectiveness of the proposed IEP algorithm, we examine its performance against two comparative strawman approaches: 1) METIS+Random, a trivial version that first invokes METIS for balanced partitions and next assigns them to arbitrary fog nodes, and 2) METIS+Greedy, which takes a greedy heuristic in IEP's partition-fog mapping procedure, _i.e._ iteratively finds fogs for partitions such that their edge weight \(\langle P_{k},f_{j}\rangle\) is minimized. Fig. 8 depicts the results in three heterogeneous environments, where we observe that IEP always surpasses baselines with lower serving latency, demonstrating the superiority of our resource-aware algorithm design. Specifically, the updated IEP algorithm outperforms METIS+Greedy with an average latency reduction of 10.9%, 19.1%, and 19.5% for three different model configurations, respectively.

### _Degree-Aware Compressed Data Collection_

According to IEP's data placement, each fog collects the input data individually in the runtime phase (Fig. 5 ). As discussed in SSII-C, the considerable costs of uploading graph data stress its significance towards real-time serving. To alleviate this bottleneck, Fograph integrates a _communication optimizer_ (CO, Fig. 6 ), operating in two steps.

**Degree-aware quantization** (DAQ). In the first step, we exploit the resilience of GNNs to low-precision representation and lower the data precision in a differentiated way with the topological information. Concretely, we use each vertex's

Fig. 8: Performance comparison of IEP against straw-man approaches in three environments. Given the three types of fogs nodes listed in Table II, their hardware and network conditions can be represented as follows. E1: {1\(\times\), 4\(\times\)_B_, 1\(\times\)_C_, 4G}; E2: {1\(\times\)_A_, 4\(\times\)_B_, 1\(\times\)_C_, 5G}; E3: {1\(\times\)_A_, 2\(\times\)_B_, 1\(\times\)_C_, WiFi}.
degree as a knob to modulate the quantization intensity on its feature vector. The rationale behind is that a vertex with a higher degree assimilates more abundant information from its neighbors, and is more robust to low bitwidths since its quantization errors can be smooth through successive aggregations [47].

In detail, DAQ maintains a triplet \(\langle D_{1},D_{2},D_{3}\rangle\) to divide the vertices' degrees into four intervals \([0,D_{1})\), \([D_{1},D_{2})\), \([D_{2},D_{3})\) and \([D_{3},+\infty)\), and assigns respective quantization bits of \(\langle q_{0},q_{1},q_{2},q_{3}\rangle\) to each. Next, for each vertex, we check its degree to obtain a target bitwidth according to the interval it lies in, and implement a linear quantization. In Fograph, we reckon up four equal-length intervals based on the input graph's degree distribution and instantiate the quantized bits as \(\langle 64,32,16,8\rangle\) by default, as illustrated in Fig. 9. However, it should be noted that \(\langle D_{1},D_{2},D_{3}\rangle\) and \(\langle q_{0},q_{1},q_{2},q_{3}\rangle\) are tunable to accommodate specific graph topology and customized accuracy-latency preference. The exploration of these configurations is left for future work.

**Theorem 2**.: _Given the input feature's bitwidth as \(Q\), DAQ with configurations \(\langle D_{1},D_{2},D_{3}\rangle\) and \(\langle q_{0},q_{1},q_{2},q_{3}\rangle\) renders a compression ratio of \(\frac{1}{Q}[q_{3}-\sum_{i}F_{D}(D_{i})(q_{i}-q_{i-1})],i\in\{1,2,3\}\), where \(F_{D}(\cdot)\) is the cumulative distribution function of the graph degree distribution._

Theorem 2 theoretically gives the compression ratio of DAQ, with proof in Appendix B. By discriminatively reducing the bitwidths of feature vectors, DAQ allows the transferred size to be substantially lower without significant impact on the inference accuracy (\(<\)1% drop in our experiments). Our scheme differs from both 1) uniform quantization [47], which ignores the vertices' different quantization sensitivity and degrades accuracy, and 2) all-layers quantization that demands complicated techniques [48], such as quantization-aware training, to fine-tune the model prediction performance.

**Sparsity elimination.** The second step exploits the observation that feature vectors are amenable to compression. A major fraction of feature vectors are sparse and highly compressible due to their encoding mechanism, and the sparsity is further magnified by precision reduction in the above quantization step. Hence, we compress the sparsity using the _LZ4_ compressor [49] with bit shuffling.

**Deployment of CO.** The lifecycle of CO comprises procedures of packing and unpacking, where the former is deployed at end devices that contribute data sources and the latter is installed on fog nodes. While its cost can be amortized by the communication savings, we develop several optimizations to further reduce the overhead. For packing, we mitigate the burden on end devices by 1) pre-calculating the targeted quantization bitwidth before deployment and using it through the runtime (as long as the graph topology is unchanged), and 2) quantizing the feature vector's elements in parallel for additional acceleration. Since each device uploads its local data individually, the data packing process is naturally parallelized from a global view and the cost is apportioned. For the fog side, the received data are first decompressed and then dequantized back to the original bitwidth before inference. Further, we launch a separated thread for the unpacking procedure to pipeline data recovering and inference execution.

### _Distributed Execution Runtime_

With the generated execution plan, Fograph's runtime _execution engine_ (Fig. 6) orchestrates distributed GNN inference upon multiple nodes. Specifically, when an inference query is launched, fog nodes will collect the necessary data from nearby sensory devices as per the data placement policy, and then collaborate to conduct the GNN execution. For each GNN layer execution, cross-fog data exchanges will be carried out when necessary, _i.e._ neighboring vertices' data belong to different data partitions. Next, inference functions (Aggregate and Update) are invoked by the fog nodes to compute the layer over the data partitions in parallel. Repeating the above process for all layers completes the whole execution and produces expected embeddings. Note that the model has been loaded and stays resident throughout the runtime so that it can be called immediately on demand. To adapt to dynamic fluctuation of resources, _e.g._ background load and bandwidth changes, the metadata server periodically aggregates the metadata from fog nodes, replays IEP to yield an updated data placement, and deploys to fogs at system idle time.

The iterative layer processing is implemented with the Bulk Synchronous Parallel (BSP) model [50], where a synchronization step is triggered when data exchange is needed. Although the total synchronization times depend on the number of GNN layers, which is usually very small (_e.g._ GCN typically stacks two or three layers), we apply the following optimizations for further acceleration. First, the adjacency matrix of each data partition can be constructed prior to the execution as long as the data placement is determined, in order to lower the occupancy of runtime. Second, the synchronization is run as a separated thread to enable the pipelining of data preparation and inference execution. Third, we wrap the execution on top of the mature framework _PyG_[38], which allows to directly benefit from all existing kernel-level optimizations.

### _Adaptive Workload Scheduling_

Even with the offline best graph data placement, the distributed inference performance can reach suboptimum due to the fluctuation of computing resource, _e.g._ caused by machine load variation. This can be relevant considering that fog nodes usually run versatile services simultaneously. To this end, the _adaptive workload scheduler_ (Fig. 6) is developed to refine

Fig. 9: Illustration of Fograph’s degree-aware quantization. Each feature vector is quantized to a targeted bitwidth according to the degree of the vertex that it associates.
the data placement tailored to dynamic load levels. Unlike the offline IEP that makes meticulous yet expensive optimization, the adaptive scheduler works online and should keep agile and agnostic to the inference. Therefore, we employ a lightweight adjustment method and a dual-mode regulation to adapt the workload distribution.

**Load balance indicator.** To reflect how skew the load distribution is, we first define a indicator \(\mu_{j}\) for each node \(f_{j}\) by inspecting the fraction between its actual execution time \(T_{j}^{\text{real}}\) and the mean value of all fogs' measurements \(\frac{1}{n}\sum_{k}T_{k}^{\text{real}}\):

\[\mu_{j}=\frac{T_{j}^{\text{real}}}{\frac{1}{n}\sum_{k}T_{k}^{\text{real}}}, \quad\forall f_{j}\in\mathcal{F}, \tag{9}\]

where \(T_{j}^{\text{real}}\) is the real measured execution time of \(f_{j}\) in the last time interval, and is obtained from the online profiler. We further introduce a slackness factor \(\lambda\) to tune the imbalance tolerance. If there is a node such that \(\mu_{j}>\lambda\), it implies this node breaks the imbalance tolerance \(\lambda\) and is supposed to suffer from a high background load. Note that \(\lambda\) is obliged to be larger than 1. \(\lambda=1\) represents that exact balance is required whereas \(\lambda>1\) relaxes the balanced constraints. Additionally, we count the number of overloaded nodes, denoted as \(n^{+}\), to gauge the global load skewness and use it for the next configuration.

**Diffusion-based adjustment.** The diffusion method aims at amending the graph data placement to align with the load level at a low cost. With the latest profiling data, it first selects two partitioned sets of vertices with the highest and lowest execution time, and then progressively migrates the vertices from the overloaded set to the underloaded set until an estimated local balance is achieved. For each migration, the boundary vertex that shares the most neighbors with the other side is picked. As an example, Fig. 10 illustrates this diffusion process across fog nodes \(f_{1}\) and \(f_{2}\), where they are supposed to be moderate and weak in computing capability, respectively. Without external load burdens, a graph data placement is decided initially, separating four/two vertices as in Fig. 10(a). Assuming a load increase abruptly happens in \(f_{1}\) such that the two nodes' capabilities are currently on a par, the diffusion is then applied to migrate vertices for balancing their workload. The number of to-be-migrated vertices is 1, and the adjustment will choose vertex \(D\) as the moving candidate since it connects the most edge-cuts across subgraph in \(f_{1}\) and \(f_{2}\). This consequently results in an updated balanced layout in Fig. 10(b). In a data placement with multiple partitions, the above pairwise diffusion process continues for all unevenly-loaded nodes until the overall estimated performance satisfies the imbalance tolerance \(\lambda\).

```
Input: Current graph data placement \(\pi\)  Load imbalance tolerance \(\lambda\)  Skewness threshold \(\theta\)  Performance estimation model \(\omega\) Output: Updated graph data placement \(\pi^{\prime}\)
1\(\omega^{\prime}\leftarrow\) UpdateTimings\((\omega,\langle T_{1}^{\text{real}},\cdots,T_{n}^{\text{real}}\rangle)\) \(\langle\mu_{1},\cdots,\mu_{n}\rangle\leftarrow\) CalculateSkew\((\langle T_{1}^{\text{real}},\cdots,T_{n}^{\text{real}}\rangle)\)
2if\(\exists f_{j}\in\mathcal{F},\mu_{j}>\lambda\)then
3\(n^{+}\gets n_{\{\mu_{j}>\lambda\}}\)
4if\(n^{+}/n\leq\theta\)then
5/* - - Lightweight adjustment - - - %
6\(\pi^{\prime}\leftarrow\) DiffAdjust\((\pi,\omega^{\prime},\langle\mu_{1},\cdots,\mu_{n}\rangle)\)
7else
8/* - - Global rescheduling - - - %
9\(\pi^{\prime}\leftarrow\text{IEP}(\mathcal{G},\omega^{\prime})\)
10
11 end if
12else
13\(\pi^{\prime}\leftarrow\pi\)
14
15 end if
16return\(\pi^{\prime}\)
```

**Algorithm 2**Flow of adaptive workload scheduler

We refer to this method as _diffusion_ in that the flow of vertices continuously moves from the overloaded regions to the underloaded regions. This method is lightweight since it only operates on a small part of the graph and migrates a few vertices. Yet it is effective as it consistently makes incremental improvements on the graph layout. However, when the load distribution is dramatically skew, this property also comes at a high cost. Therefore, we introduce a dual-mode scheduler to integrate the lightweight adjustment with the global partitioning.

**Dual-mode scheduler.** The workload scheduler considers dual regulations, the lightweight diffusion-based adjustment discussed above and the heavy global partitioning that invokes the offline IEP. Algorithm 2 presents the scheduler's processing flow. As a first step, the scheduler uses recorded execution time to update the performance estimation models and calculate the skewness indicators (Line 1-2). If there is a node such that \(\mu_{j}>\lambda\), it implies the imbalance tolerance \(\lambda\) is violated. This subsequently triggers adjustments on the existing graph layout. To decide which mode to be applied, we count the number of overloaded nodes, denoted as \(n^{+}\), and compare it with a user-specific skewness threshold \(\theta\) (Line 4-5). \(\theta\) is a positive decimal and is set 0.5 by default. If \(|n^{+}|/n\leq\theta\), it means that the skewness is still tolerable and the lightweight diffusion is applied. Otherwise, the percentage of the overloaded nodes exceeds \(\theta\) and we pass the entire graph \(\mathcal{G}\) and the updated performance estimates \(\omega^{\prime}\) to IEP to yield a new data placement. Note that all the layout modifications are first operated virtually in Algorithm 2 and will be executed physically when the final result is determined and the system is in idle period.

Fig. 10: An instance of diffusion-based graph data placement adjustment, where vertex \(D\) is selected for migration from the overloaded fog node \(f_{1}\) to fog node \(f_{2}\).
## IV Evaluation

This section presents the effectiveness of Fograph in significantly improving the performance of GNN inference serving by examining its core components and comparing with the currently standard cloud implementations and straw-man fog inference systems.

### _Experimental Setup_

**Prototype and methodology.** We implement Fograph prototype with three types of computing nodes and their specifications are listed in Table II. We label them as type \(A\), \(B\), and \(C\), respectively representing fog nodes with weak, moderate, and powerful capabilities. Such a category depends on their processors' power and available memory: Type-_C_ fogs equip the highest computing power with the largest memory space, whereas Type \(A\) is on the opposite side and Type \(B\) is in between them. Although fogs of Type \(A\) and \(B\) own the same processor, the former performs much poorer than the latter with the used SIoT and Yelp datasets, reporting an average of 37.8% longer inference latency with GCN. Fograph is built on top of _PyG_[38], though its design is agnostic to the backend and can be conveniently switched to other engines like _DGL_[51]. We compare Fograph with the _de-facto_ standard cloud serving and a straw-man multi-fog deployment (multi-fog serving without any proposed optimization), all running the same workload. The configurations of cloud and the emulation of distributed graph data uploading follow the methodology in SSII-C. To ensure a fair comparison, the straw-man fog approach adopts the data placement strategy in state-of-the-art distributed GNN processing [39] that first calls _METIS_[46] to partition the data graph and next map them to fog nodes stochastically. According to the placement, the fog approach's runtime directly collects graph data without communication optimization, and launches collaborative inference upon the same distributed framework as Fograph. Without loss of generality, Fograph selects an arbitrary fog node as the metadata server among the used ones. We measure the end-to-end latency from data collection to GNN inference completion. All the background loads are disabled during the runtime and each benchmark is evaluated 50 times to calculate the average results.

**GNN models and datasets.** Four GNN models are employed: GCN [26], GAT [27], GraphSAGE [28] and ASTGCN [29]. The first three are representative GNN models that have been widely used across GNN-based services [52], and their formulas have been listed in Table I. ASTGCN is a spatial-temporal model specific for traffic flow forecasting. All the models are implemented using the instances from _PyG_ model zoo [53] or the original code from the model authors [54], and are trained prior to deployment.
averagely from 4.67\(\times\) to 5.39 \(\times\) on SIoT over cloud when switching WiFi to 4G. Vertically varying the datasets, a larger source graph enhances Foggraph's superiority in saving costs, _e.g._ an average latency reduction of 80.63% and 70.21% over cloud for SIoT (larger) and Yelp (smaller), respectively.

An interesting observation of Fig. 11 is that the serving latency seems to be relatively stable when the dataset and network condition are determined notwithstanding the models. It is interpreted that the communication overhead majorly dominates the total cost in the cases of GCN, GAT and GraphSAGE inferences. Although execution's impact will be promoted if larger GNN models are applied, this fact highlights the ponderance of communication optimization in end deployment, which is exactly what Foggraph emphasizes. In Fig. 12, the superiority of Fograph is more evident in contrast with the baselines, validating the effectiveness of optimizing bandwidth utilization and pipeline execution.

**Accuracy.** While Fograph profitably exploits the compression technique in reducing data collection overhead, its practicability yet relies on inference accuracy. To investigate that, we configure the communication optimizer with default settings and assess the approaches under WiFi connections3. Table IV shows the inference accuracy for SIoT and Yelp upon three models. The cloud and fog approaches maintain the same accuracy as they both reserve full precision features. Fograph drops \(<\)0.1% for both SIoT and Yelp, which will not cause substantial usability issues on the numerical results. The accuracy loss is minimal in SIoT because its features are simply one-hot encoded, where the outcome of quantization and compression is maximized without side effects.

Footnote 3: The inference accuracy is irrespective to the network conditions. The data corruption caused by unstable transmission, which may decrease the accuracy, is not considered in this paper.

### _Case Study: Traffic Flow Forecasting_

This subsection uses a realistic case to complement the performance comparison in demonstrating Fograph's superiority. We emulate a traffic flow forecasting application [29] by running the inferences to predict future flow over the PeMS sensor network in an expected time window. In this setting, four nodes are employed: 1\(\times\)_A_, 2\(\times\)_B_, and 1\(\times\)_C_. The reason behind configuring such a smaller, weaker cluster (minus two Type-_B_ fogs from the testbed in SSIV-B) is to match the computing resources with the much smaller graph dataset targeted in this experiment (compared to SIoT and Yelp). To fit the application, we select ASTGCN, a representative spatial-temporal model with GCN as building blocks.

**IEP result.** Fig. 13(a) visualizes the sensors' spatial distribution of PeMS and its data placement results. Each vertex is colored to indicate its placed fog node. From a global view, the sensors, as the graph vertices, exhibit a clustering pattern of their placement, demonstrating the locality preservation of IEP. Moreover, the different vertices number of each partition implies its heterogeneity awareness. This can be clearer in Fig. 13(b), which counts the number of assigned vertices and the execution latency of each fog node. The execution latency results among fog nodes are well close though they hold entirely different numbers of vertices. In particular, the 4-th fog node (Type _C_) accommodates the most vertices (the yellow points in Fig. 13(a)), but conversely takes the lowest execution time. This is because that it possesses the highest computing capability among others (Type \(A\) and \(B\) fog nodes), and thus Fograph enforces it to afford more workload (vertices). Such load balance attributes to the heterogeneity-aware IEP, which effectively aligns execution workload to the diverse computing resources and ensures maximum resource utilization towards parallel and distributed inference.

**Latency and throughput.** Fig. 13(c) shows the inference latency and throughput of the approaches under 4G, 5G, and WiFi. Analogous to the comparison in Fig. 11, Fograph surpasses the baselines with the lowest costs. Specifically, with varying channels, Fograph consistently attains the lowest serving latency, achieving speedups of up to 2.79\(\times\) and 1.43\(\times\)

Fig. 11: Achieved latency of three GNN models for SIoT and Yelp under varying network conditions.

Fig. 12: Achieved throughput of three GNN models for SIoT and Yelp under varying network conditions.
over cloud and fog, respectively. The latency of traffic flow forecasting appears higher cost than the SIoT and Yelp tasks because it predicts a window of 12 flow possibilities for every 5 minutes in the next hour, which puts a higher workload on execution. Fig. 13(d) presents the corresponding throughput results, where Fograph outperforms all other approaches, showing its superiority.

**Forecasting performance.** Table V records three common evaluated metrics for traffic flow forecasting: Mean Absolute Error (MAE), Root Mean Square Error (RMSE) and Mean Absolute Percentage Error (MAPE). We compare Fograph in two time horizons against cloud, straw-man fog, and an additional compression method that uniformly compresses all feature vectors into 8-bit precision. Similar to the results in Table IV, Fograph induces minimal error expansion of around 0.1 for all metrics compared with the full precision version (cloud and fog). In contrast, uniformly quantizing all features to 8-bit results in an evident error gap to Fograph, which may significantly sacrifice the serviceability of the forecasting results. Such prediction advantages of Fograph origins from our degree-aware quantization choice on exploiting the data sensitivity in GNN inference, enabling both latency reduction and accuracy reservation.

### _Optimization Implication_

This subsection investigates the performance boost of each individual optimization technique introduced in SSIII, using SIoT dataset and the cluster described in SSIV-C.

**Metadata profiler.** We first show the profiler's effectiveness by comparing the estimated execution time predicted by the profiler with the real execution time measured in actual inferences. Fig. 14 depicts the profiling and prediction results for different GNN models and different datasets, collected on a fog node of type \(B\). The solid line indicates an exact equivalence between the measurement and the prediction, while the dashed lines mean a relative difference of \(\pm 10\)% between them. All data points are encompassed by the dashed lines, which implies a small and bounded variance between actual execution latency and estimates, demonstrating the effectiveness of the proxy-guided profiling methodology. Moreover, the figure shows that if a graph has a higher execution latency than the other one, their latency estimates still preserve the ordering. This demonstrates that the profiler's latency prediction is an appropriate tool to guide IEP's data placement optimization.

**Inference execution planner and communication optimizer.** Fig. 15 normalizes the latency of four approaches: fog, Fograph, and its ablated variants without inference execution planner (IEP) or communication optimizer (CO). Specifically, Fograph without IEP replaces its data placement strategies with the one in the straw-man fog approach, and Fograph without CO simply applies direct data transmission between data sources and fog nodes. All other configurations keep unaltered for these two ablated counterparts except for their respectively targeted modules. From a global view, we observe that both modules make sense for performance improvement, while a combination promotes higher speedups. The IEP and CO take similar effects but their focuses are different as indicated by their execution statistics in Fig. 15 (right). The former essentially solves a graph layout to maximize the parallelization and thus saves the overall latency on the execution side given a smaller execution ratio, whereas the latter centers around the data uploading aspect and validly reduce the transmission costs, which lowers the proportion of the communication side. The almost orthogonal optimization directions make their incorporation fully benefit the performance gains.

**Workload scheduler.** To appraise the responsiveness of Fograph in adapting to dynamic load fluctuation, we target production workload traces from Alibaba [57]. The trace contains background CPU load variation running on clusters and we select a snapshot of 1000 timestamps to exert pressures on fog nodes, as shown in Fig. 16 (top). The associated behaviors of Fograph with/without workload scheduler are recorded in Fig. 16 (bottom). Note that the scheduler-less version is a non-dynamic counterpart implemented by deactivating the workload scheduler module in Fograph and maintaining the original IEP data placement all the time. Given the superiority of IEP, it represents a fair performance produced by non-dynamic load-balancing methods like fixed division of computing pressure according to computing capability and

Fig. 13: Case study results, where (a) visualizes the PeMS sensors’ spatial distribution and placement on fog nodes; (b) shows the number of assigned vertices and inference latency measurements of fog nodes; (c) and (d) presents the latency and throughput results, respectively.
communication distance. When the fog nodes share similar load levels (timestamp [0, 150]), the two versions report close inference latency. As node 4's background load increases, the latency of the w/o scheduler version rapidly climbs while the integrated Fograph keeps relatively steady. Particularly, the serving latency can exceed 1s in the extreme situation without scheduler, while Fograph keeps immersing below 0.9s. At the other end, when node 4's load diminishes, its computing capability is released so that Fograph is able to further lessen the costs and achieve up to 18.79% latency reduction over the ablated copy. Overall, we observe that the lack of scheduler leads to a latency trajectory going after the overloaded nodes' trace changes and magnifies load fluctuation in costs. Instead, by employing the workload scheduler, Fograph can adjust to resource dynamics and provides continuously stable serving. Moreover, we observe that Fograph acts agilely to load dynamics for low-latency service provisioning. With a very mild communication delay of \(\sim\)0.2s between the metadata server and fog nodes, our measurements report an average of 4.32s from imbalance detection to load migration.

### _Scalability_

This subsection investigates the scalability of Fograph using much larger synthetic RMAT datasets, with varying fog nodes of type \(B\). Fig. 17 shows Fograph's serving costs over the models and datasets as the number of fogs increases, where we observe the latency effectively shrinks with the augment of computing resources. Employing multiple fogs (\(>\)2) performs much better than merely using one fog for every size of graphs, demonstrating Fograph's efficient resource utilization with parallel and distributed execution. Upon larger graphs (_e.g._ RMAT-100K), Fograph can gain clearly much performance improvement when appending additional fog nodes, suggesting Fograph's capability in handling heavier serving workload. We remark that the serving costs converge for all graphs when there are ample fog nodes, which implies that Fograph can readily afford million-edge graphs with just six moderate fog nodes.

### _GPU Enhancement_

This subsection explores how GPU enhances Fograph towards serving performance. We equip each fog node of type \(B\) with an Nvidia GTX 1050 GPU, and run GCN inference over the synthetic RMAT-100K dataset. Fig. 18 visualizes the achieved latency of the straw-man fog method and Fograph, with and without GPU. For a single fog, both fog and Fograph fail with GPU and encounter the out-of-memory (OOM) error, due to the limited GPU memory. By extending to multi-fog, however, GPU clearly shows its advantage over CPU, and makes progressive improvements as the number of fogs grows, demonstrating Fograph's enhanced performance with hardware accelerators. We also find that serving with a small number of fog nodes (_e.g._ with 2 fog nodes) exhibits a broader performance gap between solutions with and without GPU. This implies GPU is particularly expedient when the available fog resource is inadequate towards the targeted GNN services. Moreover, Fograph without GPU can reach even lower latency compared with the straw-man fog with GPU (with \(>\)3 fog nodes), proving the remarkable performance advance from the proposed set of optimizations.

## V Related Work

As an intersection of GNN processing and fog infrastructure, Fograph provides a group of GNN-generic designs for maximizing the architectural advantages of fog computing. Next we discuss these two lines.

**Accelerating GNN processing.** A growing body of recent worksfrom both the research [58, 59, 60, 61, 62, 63] and industry

Fig. 16: Fograph’s behaviour on real load trace, where the top subfigure depicts the load fluctuation of four fog nodes and the bottom subfigure shows the inference latency variation of Fograph and its counterpart without adaptive workload scheduler.

Fig. 14: Profiling measurements and the prediction results of varying GNN models and datasets. The solid line indicates the estimated execution time exactly equals the actual execution time, whereas the dashed lines draw a relative difference of \(\pm\)10% between them.

Fig. 15: Performance comparison of ablated Fograph counterparts in terms of inference execution planner (IEP) and communication optimizer (CO).
communities [64, 65, 66, 17, 67, 64] have focused on reaching high performance GNN processing by optimizing different execution levels. From a hardware perspective, a number of domain-specific processors [68, 64, 69, 70] are designed by either customizing the microarchitectures to the GNN execution semantics or alternating hardware-software interfaces for graph data reading/writing. The aggregate and update functions are discriminingly optimized according to their access patterns, data reusability, and computation intensities. Fograph is orthogonal to these fundamental efforts and can directly enjoy their pedestal improvements.

From a library perspective, PyG [38] and DGL [51] are representative efforts that provide GNN-tailored API supports atop the neural networks execution engines like PyTorch and TensorFlow. The message-passing model is exploited for unified programmability and the matrix operations are particularly optimized with specialized kernels. Fograph utilizes these libraries as the backend so as to fully benefit from their underlying optimizations.

From a system perspective, GNN execution is treated and optimized as an integrated production process considering its global lifecycle from graph storage [16, 17], data loading [71, 72], memory management [73, 58, 74] to multi-GPU execution [75, 64]. Miscellaneous systems are proposed to address some of the aspects, _e.g._, \(P^{\delta}\)[65] for scalable processing and Dorylus [61] for affordable training. Nonetheless, a majority of the systems focus only on training rather than inference, and all are on single powerful machines or cloud environments, ignoring the inherent data uploading overhead in the serving pipeline. Instead, Fograph capitalizes the more realistic and practical scenarios of GNN serving, emphasizes and implements the unique potential of fog computing to yield high performance.

**Fog-enabled DNN inference.** To achieve efficient intelligent services close to the end, a line of works [76, 77, 78, 79, 80, 81] have explored collaborative execution with the assist of fog computing. By splitting and mapping the input workloads or model parameters, these works parallelize CNN or RNN inferences over a cluster of fog nodes to meet dedicated service-level objectives. A few constraints are usually added in accordance with applications requirements such as execution deadline [81, 82] and energy efficiency [80]. Fograph also lies in this category of work by first bringing GNN workload into the fog-enabled intelligence. Further, Fograph tailors its design to bridge the gap between the unique characteristics of GNN execution and the distributed and heterogeneous environments of fog, which notably improves the overall performance beyond cloud and vanilla fog deployment.

## VI Discussion and Future Work

Fograph is a pilot effort in bringing fog computing to GNN processing systems and yet has certain limitations.

**Exploiting inference context.** Fograph has explored leveraging the unique characteristics of GNN and graph, _e.g._ degree-aware quantization, to boost the serving performance. As a result, Fograph's performance largely relies on the size and complexity of input data volume, where input graph data with larger vector sizes and sparser features can further highlight its superiority over cloud solutions. However, the rich semantics of other inference contexts still call for exploitation including input graph properties, application workflow patterns, and inference functions specialties. Recent works on GNN performance characterizations [83, 84] can provide useful insights to enhance Fograph and guide the parameters tuning and module altering.

**Complex heterogeneity and dynamics.** The heterogeneity and dynamics considered in Fograph are mainly on the execution side, _i.e._ the diverse and fluctuated computing capabilities. The allocated bandwidth is implicitly assumed to be relatively stable for all fog nodes. Although it is realistic in many fog computing cases (_e.g._ in a closed factory or campus [85]), real-world serving could confront more complicated situations where the connections between sensors and fog nodes are varied and even fail [86]. In these cases, we may ignore those few vertices with ultra-high transmission delay during data collection in order to stabilize the overall serving latency. Consequently, the long-tail distribution of data collection time is squeezed and cloud serving could act as an efficient complement to Fograph for more robust serving performance.

**Scalability and fog-cloud collaboration.** Fograph's scheduling employs a centralized metadata server to attain fair resource utilization, which in principle tunes the communication-computation tradeoff for the distributed runtime. While it works well for typical moderate-scale deployment in fog scenarios, it may fall short in scaling up with very huge graphs and massive fog nodes due to the single-point scheduler. To address that, one of the potential solutions is to apply a lightweight, decentralized data placement strategy for inference execution planning such as hashing [65, 71]. Alternatively, we may utilize the abundant cloud resources as a supplement to accomplish scalable GNN processing, _e.g._ by designing a fog-cloud collaboration mechanism that uses

Fig. 17: The serving latency of Fograph with varying size of datasets and varying number of fog nodes.

Fig. 18: The serving latency of varying number of fog nodes with and without GPU. OOM indicates the out-of-memory error.
fog nodes to collect and compress data and cloud servers to accommodate full-batch GNN processing at scale.

**Other optimizing objectives.** The proposed system concentrates on rendering GNN model serving in a real-time manner, whereas end deployment may tackle additional Service-Level Agreements (SLAs) like server costs and memory footprint [82, 87]. The deadline can be integrated as a constraint in the workload scheduler, while the memory issue can be accounted for by redesigning the problem formulation in IEP. Composite SLAs require supplementary scheduling in jointly optimizing the system behaviors with multiple objectives. Our future work intends to enhance Fograph to meet additional types of objectives, _e.g._ energy consumption and privacy preservation.

## VII Conclusion

In this paper, we present Fograph, a distributed GNN inference system that addresses real-time GNN serving with fog computing. Fograph introduces a brand new serving pipeline that allows exploiting the diverse resources from distributed fog servers for resilient service rendering. Through a heterogeneity-aware inference execution planner and adaptive workload scheduler that effectively maps the input graph over multiple fog nodes, Fograph can maximize the parallelization while simultaneously adapting to resource fluctuation. By employing a GNN-specific communication optimizer, Fograph is able to deliver higher performance over the state-of-the-art cloud serving and basic fog deployment, without sacrificing the overall system's accuracy and validity. Since GNNs have been widely adopted in a broad range of IoT and fog scenarios, the proposed system and its workflow can serve as a basis for future analysis and optimization on specific GNN-based services.
