We compared a hello world endpoint in ray with fastAPI and fastAPI and learned that fastAPI alone seems to be much faster.
from fastapi import FastAPI
app = FastAPI()
class MyFastAPIDeployment:
@app.get("/")
async def root():
return "Hello, world!"
import time
import ray
import requests
from fastapi import FastAPI
from ray import serve
app = FastAPI()
@serve.deployment(max_ongoing_requests=1000)
@serve.ingress(app)
class MyFastAPIDeployment:
@app.get("/")
async def root(self):
return "Hello, world!"
serve_options = { "host" : "0.0.0.0"}
serve.start(http_options=serve_options)
# 2: Deploy the application locally.
app1 = MyFastAPIDeployment.bind()
serve.run(app1, route_prefix="/")
Standalone FastAPI was factor 10+ faster. Is there anything we do wrongly?
We used fastapi run and serve build and run commands and benchmarked the http endpoint with hey.
Thank you!