REST API performance over HTTP and HTTPS compared
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
Performance Test # 2 Results
Observation: Fastest response was received over HTTPS and the average API response time over HTTPS was better as well
Performance Test # 3
Observation: Fastest response was received over HTTPS but the average response time was the same for both
Performance Test # 4
Observation: Average response time over HTTPS was better than HTTP
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.