HTTP 1.1 vs HTTP 2.0 Performance Comparison on API Service

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,-Greentea-Brownies-with-Cashew-Ovomaltine-banner1.png

And here is curl for HTTP 2.0

curl -I --http2,-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.

No Comments

Leave a Comment

Please be polite. We appreciate that.
Your email address will not be published and required fields are marked