I’ve had a complex requirement on current project, that is moving all my API services from HTTP 1.1 to HTTP 2.0. Based on the several articles online that i found after googling, it seems that HTTP 2.0 is much faster compared to HTTP 1.1, but that metrics shows browser based request only. Doesnt exactly represent my current condition, which is a native mobile application firing HTTP API request.
So in order to measure performance of both HTTP version, i install two instance of Apache Tomcat 9.0M22 which provides HTTP 1.1 and HTTP 2.0, and create a simple test unit using curl to fetch an image which located on both instance.
Here is the curl that i used to fetch image using HTTP 1.1
curl -I http://22.214.171.124:8080/Sweet-Bites,-Greentea-Brownies-with-Cashew-Ovomaltine-banner1.png
And here is curl for HTTP 2.0
curl -I --http2 https://126.96.36.199:8443/Sweet-Bites,-Greentea-Brownies-with-Cashew-Ovomaltine-banner1.png -k
Fire my unit test for 500 times, and measure the result. Here is the complete graphic
It seems that for fetching a plain image, HTTP 1.1 took less time compared to HTTP 2.0. Perhaps due to my HTTP 1.1 requests are using an insecure connection, while HTTP 2.0 enforcing an SSL connection.
Feel free to look at my code here,
It seems that for my case, HTTP 2.0 not yielding a better performance compared to HTTP 1.1. So i guess i’ll stick with HTTP 1.1 for a while.