[PYTHON] FastAPI vs Vert.x Benchmarks and impressions

I was looking for a Python FW to make AI an API, but when I encountered FastAPI and touched it, it seemed to be very fast, so I'm afraid that I had already selected Vertx technology in the project.

benchmark

Confirmed on a server where Rails 6 is 100 at the same time and 250 req / sec

Requests per second:    245.42 [#/sec](mean)
Time per request:       407.472 [ms](mean)
Time per request:       4.075 [ms](mean, across all concurrent requests)

Sample program benchmark that just returns the text OK FastAPI started with gunicorn-> uvicorn x4

100 simultaneous

Vert.x - Kotlin

Requests per second:    3207.38 [#/sec](mean)
Time per request:       31.178 [ms](mean)
Time per request:       0.312 [ms](mean, across all concurrent requests)

FastAPI

Requests per second:    2703.43 [#/sec](mean)
Time per request:       36.990 [ms](mean)
Time per request:       0.370 [ms](mean, across all concurrent requests)

1000 simultaneous

Vert.x - Kotlin

Requests per second:    3777.86 [#/sec](mean)
Time per request:       264.700 [ms](mean)
Time per request:       0.265 [ms](mean, across all concurrent requests)
Transfer rate:          1080.97 [Kbytes/sec] received

FastAPI

Requests per second:    2746.82 [#/sec](mean)
Time per request:       364.058 [ms](mean)
Time per request:       0.364 [ms](mean, across all concurrent requests)
Transfer rate:          413.10 [Kbytes/sec] received

10000 simultaneous

Vert.x - Kotlin

Requests per second:    3736.25 [#/sec](mean)
Time per request:       2676.477 [ms](mean)
Time per request:       0.268 [ms](mean, across all concurrent requests)
Transfer rate:          1069.07 [Kbytes/sec] received

FastAPI

Requests per second:    3524.81 [#/sec](mean)
Time per request:       2837.034 [ms](mean)
Time per request:       0.284 [ms](mean, across all concurrent requests)
Transfer rate:          218.69 [Kbytes/sec] received

Impressions

Fast API is good. .. ..

It seems to converge on the problem of preference of the language used rather than FW I like Vertx.

I'd like to defend Vertx with a position talk that has selected the technology, but I'm no longer complaining about the goodness of the Fast API. FastAPI will be popular. It's already popular. Vertx has always been a minor FW. ..

FastAPI

Vertx

Comparison with other frameworks

Since it is a JVM language and Python, it seems easier for engineers to collect than actix. For business use, iron plate Spring Boot or .Net MVC seems to be good because it has a lot of information.

Recommended Posts

FastAPI vs Vert.x Benchmarks and impressions