REST API performance over HTTP and HTTPS compared

Api On Cloud
2 min readNov 3, 2021

We wanted to find out how would the performance of a REST API be impacted if it is called over HTTP vs. HTTPS.

Here is how we setup this simple performance test:

  • Created and launched a linux based VM in the Cloud
  • Deployed the application containing the REST API code on to the Linux VM
  • Assigned a public IP address to the Linux VM for direct API calls over HTTP
  • Created Load Balancer in the Cloud with TLS/SSL termination and configured it to direct the request to the Linux VM (for API calls over HTTPS)
  • Used JMeter to run the tests to analyze the difference in performance when the REST API is invoked over HTTP vs HTTPS
  • Call the API 120 times over HTTP and 120 times over HTTPS to get the average response time

The performance tests results are recorded in the tables below.

Performance Test # 1 Results

Observation: Fastest response was received over HTTP but the average response was exactly the same for both HTTP and HTTPS

Table 1 with data comparing the difference in API performance over HTTP and HTTPS. We called the same API over HTTP 120 times and then called the same API 120 times over HTTPS. The API calls were made sequentially. The average API response time over HTTP and HTTPS was 190 milliseconds, exactly the same.
Table 1 with data comparing the difference in API performance over HTTP and HTTPS

Performance Test # 2 Results

Observation: Fastest response was received over HTTPS and the average API response time over HTTPS was better as well

Table 2 with data comparing the difference in API performance over HTTP and HTTPS. We called the same API over HTTP 120 times and then called the same API 120 times over HTTPS. We made two API requests concurrently over  HTTP and HTTPS. The average response time over HTTPS was 378 milliseconds, one millisecond less than the average response time over HTTP, which was 379.
Table 2 with data comparing the difference in API performance over HTTP and HTTPS

Performance Test # 3

Observation: Fastest response was received over HTTPS but the average response time was the same for both

Table 3 with data comparing the difference in API performance over HTTP and HTTPS. We called the same API over HTTP 120 times and then called the same API 120 times over HTTPS. We made three API requests concurrently over HTTP and HTTPS. The average response time over HTTP and HTTPS was exactly the same, 567 milliseconds.
Table 3 with data comparing the difference in API performance over HTTP and HTTPS

Performance Test # 4

Observation: Average response time over HTTPS was better than HTTP

Table 4 with data comparing the difference in API performance over HTTP and HTTPS. We called the same API over HTTP 120 times and then called the same API 120 times over HTTPS. We made four API requests concurrently over  HTTP and HTTPS. The average response time over HTTP was 755 milliseconds and the average response time over HTTPS was 753 milliseconds
Table 4 with data comparing the difference in API performance over HTTP and HTTPS

Conclusion

Based on the environment setup and results presented above, we concluded that HTTPS did not impact the performance of our REST API negatively, if TLS/SSL termination is handled by the Cloud based Load Balancer.

Infact, Test # 2 and 4 indicate that HTTPS average response time was better than the average response time over HTTP.

--

--

Api On Cloud

Api-On-Cloud is a no-code platform to build, test and deploy virtual REST APIs. Learn more at: https://www.apioncloud.com