7.3 Performance Test of FaaS function during running
The key performance metrics for the FaaS runtime are cold-start time and auto-scaler efficiency.
7.3.1 Cold start time
When a function is extended, the first request served by each function instance is affected by the time it takes to load and initialize the code. If it takes a long time to initialize the code, the impact on average and percentile latency can be significant.
This section compares the cold start time of a single request with the cold start time of a sustained load over a period of time. The benchmark function bcrypt used in the experiment is shown in Figure 7.1.
Figure 7.1 Baseline Serverless function used for cold start time tests
Bcrypt is a cryptographic hash function that slows down over time as the iterative count increases, making it resistant to violent search attacks even as computing power increases. The Serverless function is written and implemented using the Golang-HTTP-armHF template to handle client requests and is set to shrink to zero when idle, using the implementation in 4.3.2 above. The resource limit for the base function is 100MHz CPU and 50MB memory, and the image size of the base function after packaging is 33.4MB.
The experiment uses httpstat tool for analysis and generates visual classification of HTTP requests. As shown in FIG. 7.2, 2585ms is required for the first function call base Serverless function, of which about 99% is used for server processing, including the cold startup time of function warm-up and the time of the first function processing. The main part is function preheating, and another 1% or so is used for DNS queries.
Figure 7.2 Analysis of the first invocation of httpstat
As figure 7.3 shows, a second call to the same Serverless benchmark function immediately after the first call saves approximately 94% of the time. The average processing time of bcrypt’s multiple computations on the server side is about 289ms, indicating that this benchmark function consumes CPU time and is sensitive to load tests.
Figure 7.3 Analysis of the second invocation of httpstat
For comparison, AWS Lambda cloud FaaS product was selected for comparison, and its Go 1.x runtime was adopted. Zip code was packaged to achieve the same benchmark function bcrypt. The test results are shown in Table 7.8. Set the Reserved concurrency for AWS Lambda to 0 and call Rate Exceeded. A certain number of Reserved concurrency must be set. In this experiment, the reserved concurrency is set to 1.
Table 7.8 AWS Lambda calls benchmark function tests
The number of | DNS Lookup | TCP Connection | TLS Handshake | Server Processing | Content Transfer | Total |
---|---|---|---|---|---|---|
1 | 253ms | 65ms | 1192ms | 1657ms | 7ms | 3174ms |
2 | 61ms | 62ms | 824ms | 1271ms | 0ms | 2218ms |
The FaaS function of the edge computing platform in this paper takes a long time to warm up when it runs, because the implementation of cold start has gone through the function warm-up process of loading, initializing and expanding from 0 copies to 1 copy, while AWS Lambda reservation adopts the method of reserving function copies.
The Serverless function of AWS Lambda initializes quickly in terms of the time it takes for both to call the server for the first time. In other aspects, it is inconvenient to compare the code packaging method, FaaS technology implementation details, platform complexity and many other factors. In contrast, the FaaS function implemented in this paper needs to be improved in cold start speed. In addition, we can intuitively see the obvious delay advantage of edge FaaS compared with cloud FaaS.