hypercorn icon indicating copy to clipboard operation
hypercorn copied to clipboard

Very high memory usage?

Open jakemwood opened this issue 1 year ago • 4 comments

:wave: Hello! I just started using Quart, and tried to use Hypercorn to deploy our very small application production to Fly.io. That said, we immediately ran in to issues, because the default Fly machine comes with 256 MB of RAM, and Hypercorn was using 190MB+. It very frequently hit out-of-memory at deploy time.

By comparison, the Quart dev server uses 43 MB of memory, and Daphne uses 55 MB of RAM. This is for a very small app, so I was quite surprised to see almost 200 MB of RAM used regularly by Hypercorn.

I know Hypercorn has more features, but using 4x as memory as the competing servers was surprising. Is this expected? Is there anything I can do with the configuration to minimize memory usage? Thanks!

jakemwood avatar Apr 20 '23 17:04 jakemwood

Hello I'm a user as well and what I'm noticing on my end is more akin to a memory leak. From my testing, memory usage starts low and grows on every request made to the server and never clean itself until I restart it. Are there any settings that could be helpful in this scenario ?

YassineElbouchaibi avatar May 08 '23 14:05 YassineElbouchaibi

Getting the same issue here as well. It managed to reach 26 GB of RAM usage after letting it be for a long time.

winstxnhdw avatar Oct 03 '23 15:10 winstxnhdw

I think Hypercorn could be holding onto asyncio tasks rather than letting them be garbage collected. Any evidence that points to or away from this would be appreciated.

pgjones avatar Oct 03 '23 18:10 pgjones

Possibly related to : https://github.com/python/cpython/issues/109534

baseplate-admin avatar Jan 13 '24 07:01 baseplate-admin