help with memory profiling FastAPI application
Anonymous
TRIALOP

2 years ago

I'm currently facing a challenge with high memory usage by my FastAPI application hosted on Railway. My API does music source separation using the deep learning library Demucs, and the memory consumption spikes with each API request, accumulating substantial costs.

I would really appreciate if anyone here in the community have good suggestions for how I should approach memory profiling or if there are better alternative approaches to troubleshoot this!

13 Replies

Anonymous
TRIALOP

2 years ago

N/A


2 years ago

I honestly don't see much of an issue here with only the screenshots you have provided, yes there is a spike, but it does settle back down to a lower level than what it spiked to, for something that does music source separation with deep learning likely completely in memory that is not a crazy amount of memory at all


Anonymous
TRIALOP

2 years ago

@Brody I tried do memory profiling with guppy in the RQ worker, but I don't see anything unusual here either

1236348265864368000


Anonymous
TRIALOP

2 years ago

@Brody any other ideas on how I could make requests more cost-effective? $1.60 per request does not seem very scalable to me, but I don't know what the industry standard is either, so maybe I'm being ignorant


2 years ago

I mean, I didn't think deep learning was really cost effective to begin with?


Anonymous
TRIALOP

2 years ago

I think maybe that the initial memory spike is actually caused by the RQ worker downloading Demucs at runtime


Anonymous
TRIALOP

2 years ago

I'm just baking the model into my Docker image


2 years ago

sounds possible


Anonymous
TRIALOP

2 years ago

@Brody that was the issue 😅


2 years ago

just a friendly reminder that pinging is against the rules


Anonymous
TRIALOP

2 years ago

oh sorry


Anonymous
TRIALOP

2 years ago

thx for answering my questions


2 years ago

no problem


Loading...