## 4 Experiments and Results
### Results
#### 4.2.3 Image Processing as Function Processing  
We evaluated the impact of the deployment of the function processing platform in the edge, fog, and cloud computing layers on performance by executing the application workload described in Section 4.1.3. Figure 7 reports the function invocations for latency with a different arrival rate of the lambda value in the Poisson distribution. There are three main observations. First, fog-layer function processing deployment is more efficient than deployment with the other two platforms, i.e., the edge and cloud layers. In our experimental analysis, with varying arrival rates of Poisson distribution (0.5, 0.05, and 0.005), our observations indicated that deploying function processing in the fog layer resulted in improved efficiency compared to deployments in both the edge and cloud layers across all tested arrival rates. The limitations in terms of resources within the edge layer were anticipated, contributing to its expected lower efficiency. Regarding the cloud layer, despite setting the same memory size (128 MB) for each function in the application across all computing layers, as serverless platforms allocate CPU power proportionally to the amount of memory provisioned, variations in performance may stem from the compute-unit specifications, such as actual specifications of the CPU, the CPU architecture, and the instance type, which differ between the cloud and fog layers. Similar patterns were also observed in the stream processing experiments, further emphasizing the impact of actual underlying hardware performance. The efficiency gain is particularly obvious, as evidenced by the significantly lower latency in the fog layer when compared to both the edge and cloud layers. This finding positions the fog layer as an efficient platform for function processing to improve responsiveness, making it well-suited for applications where timely interactions are required for user satisfaction. It also allows for improved accommodation of varying workloads and adaptation to changing application requirements. Secondly, in the cloud layer, the maximum invocation latency for the image processing sequence of functions is around 9-10 s. This maximum latency was observed in the first few invocations, and a latency of 6 s (which is double the mean value) was also found between the distant arrival times. This was because of the cold-start latency; however, we observed that it was constantly handled with varied arrival rates and never exceeded 9 to 10 s during several executions of our image processing application. A cold start is the time needed for the initialization of the container and execution environment in the serverless platform. Cold-start latency is experienced when a function is invoked for the first time or after a significant period of inactivity. For instance, if the function is idle for a specific amount of time, the system decontainerizes the container that is assigned for the function, and all the resources are deallocated for the scaling down of resources. Potential strategies may involve prewarming techniques [75], resource allocation optimization [76], or the utilization of serverless-specific features designed to address cold-start challenges [77]. However, in the edge layer, it largely depends on the arrival rate of the function invocation requests. This is because the distant arrival of function invocation requests leads to high latency due to long cold-start times and resource limitations in the edge layer. Thirdly, stable latency is more significant with regular and uniform function invocations. Function invocation patterns have a strong influence on the overall latency distribution of application execution. If they are too frequent, the processing and handling of many requests at the same time results in high latency. If the function invocation request arrival is distant, the cold start dominates the average latency, and it is not negligible, as function execution takes approximately two times longer than the average execution time.