Fastapi: [QUESTION] default high cpu usage - is it normal?

Created on 6 Jun 2019  路  4Comments  路  Source: tiangolo/fastapi

Hi,

I noticed that even with the very default hello world, uvicorn consumes about ~40% of my 2.5GHz CPU (of single core). Is this normal/expected? From WSGI I am used to values around ~5%. I was able to replicate these on two machines.

image

question

Most helpful comment

Try not using the reload parameter when starting the server and tell us again.

uvicorn main:app --reload

All 4 comments

Try not using the reload parameter when starting the server and tell us again.

uvicorn main:app --reload

Ah, yes, without the reload parameter the usage is minimal. Sorry and thanks for a quick feedback.

Tom of Starlette is very open to taking a PR to make the reload option more efficient. Right now it is brute force checking every 300ms? or so.

Thanks for the help @jorgerpo and @wshayes ! :cake: :rocket:

And thanks @hnykda for reporting back and closing the issue. :tada:

Was this page helpful?
0 / 5 - 0 ratings