stevenleeg / geemusic

A bridge between Google Music and Amazon's Alexa
GNU General Public License v3.0
662 stars 178 forks source link

Memory Issues #213

Closed soapergem closed 6 years ago

soapergem commented 6 years ago

I have Geemusic running inside a Docker container on an EC2 instance, which is behind an ALB. At first I tried running it on a T2.micro instance, and it appeared as though everything was working. I could "ask gee music to play song by such-and-such" and the single song would play. However, I soon learned that if I asked "gee music to play songs by artist" it would begin to play 1 song by the named artist, but then abruptly quit halfway through that first song. This happens consistently.

So this morning I tried upping the box size a bit to a T2.medium, and at the same time gave it a little more disk space as well. Now when I say "ask gee music to play songs by such-and-such," it does so... at least for awhile. It got through three or four songs before, again, abruptly quitting.

It's also notable that each time after it abruptly quits, it becomes totally non-responsive. Any subsequent calls to the Skill will return a message about the Skill taking too long to respond. I then have to connect into the EC2 instance and manually restart the Docker container, at which point it resumes working.

I suspect that my increasing the hard drive size had no effect, as it doesn't look as though that hardly any disk space is used. But it's clear to me that increasing the RAM did help... though not entirely sufficiently. I would like to be able to tell it play all songs by an artist and walk away without worrying about the potential for needing to restart the Docker container. Is there a memory leak in the current application? Or are there some advised Docker run parameters that I'm missing? Thanks.

fergyfresh commented 6 years ago

Don't those run off of compute credits? If you don't allow overages and are using a small compute instance I think that's why you're having the issues you're having. I looked into that stuff and its like 10% CPU minimum, every % over that is a % of a credit per minute or something.

fergyfresh commented 6 years ago

I am trying to port this to AWS Lambda like https://github.com/m0ngr31/kanzi did on this pull request https://github.com/m0ngr31/kanzi/issues/232. If you have good working knowledge of AWS Lambda we can port this to AWS Lambda.

I have another Skill running on Lambda, https://github.com/fergyfresh/deelist.

I got that on AWS Lambda by using this http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html, but I'm stuck in getting the streaming callback to work the /alexa/stream/{song_id} portion to work with AWS Lambda and API Gateway. If you're familiar with how to connect these two I'd love the advice!

soapergem commented 6 years ago

I don't have much experience with API Gateway but would be happy to learn. I'll take a look this weekend. It looks like Terraform has resources for spinning up the API Gateway infrastructure so I'll try to see if I can codify it with that (once I know what I'm doing).

fergyfresh commented 6 years ago

I have a PR here that you could look at #214

fergyfresh commented 6 years ago

@soapergem I think you should ditch your EC2 instance and use the AWS solution I posted in the readme. It is definitely the cheaper and better solution imho.

fergyfresh commented 6 years ago

I'm going to close this issue as my implemented solution is significantly cheaper than a comparative EC2 solution and your issue is most definitely involved in your AWS setup and not in the scope of this repo.

gmyers-amfam commented 6 years ago

FYI - I tried out your zappa configuration today (had to change the S3 bucket name of course, since those are global), but it keeps failing. I'm wondering if I should open a separate issue for that. The error I get is An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.

fergyfresh commented 6 years ago

What does it keeps failing mean? I highly doubt it is anything related to this repo. I have had a few people try to work it out basically only following my README and this repo and they have successfully gotten it to work. It seems your issue might be related to this https://github.com/Miserlou/Zappa/issues/1398.