I built an audio processing web app using Rails. The user uploads a song to the website. The song is then decomposed into individual elements and then modified and recombined.
I am using a an open source command line tool that is being called from the rails controller.
My Problem: It takes around 2 to 3 minutes to do the processing and it consumes a lot of memory. The browser is in loading stage for 2 to 3 mins. And, this is just for 1 request from 1 user. I am using Amazon ec2 instance t1.large it is just not enough.
I am planning to use background processing but I don't want multiple requests to work the same time.
I want the first request to take 3 mins. 2nd request to take 3 + 3 mins. 3rd request to take 3 + 3 + 3 mins. So the website doesn't go down.
Also, the audio file is around 40 mb. Is it a good idea to use amazon s3 bucket? Or just increase the harddisk space and store audio files on my server?
The reason I don't want to use the amazon s3 bucket is because I don't want to transfer each file again from my ec2 instance into the s3 bucket, because it will add to the latency.