Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lambda watchdog #22

Closed
binarythinktank opened this issue Oct 21, 2021 · 7 comments
Closed

Lambda watchdog #22

binarythinktank opened this issue Oct 21, 2021 · 7 comments

Comments

@binarythinktank
Copy link

Hi
This is a fun project :)

I have 3 questions

  1. Could the Watchdog not run in a Lambda? triggered every 10 minutes or so by EventBridge schedule that is created by the error handling lambda (and deleted again when the container is terminated)? This should further optimise cost and make it more serverless.

  2. This is not a scaling solution, right? it is 1 container that needs to be big enough for the expected number of users.

  3. if the container is launched after a hit on the domain name, at some point you will get a lot of false positives from bots and such, right? is there a (serverless) way to make sure it's a Minecraft client asking for the link before launching anything?

thanks!

@binarythinktank
Copy link
Author

i suppose for 3, api gateway could be used to launch the container, requires an extra step and is not as elegant as recognising a genuine Minecraft request though :/

@binarythinktank
Copy link
Author

i had a thought. what if, instead of route53 writing an error log, it fails over to an api-gateway endpoint. API gateway can check for required headers that a Minecraft client would include, if they are missing it just errors the request without invoking anything. if the headers are present it will kick off the lambda launcher. its an extra component, but more cost-effective because no lambda or container launched unnecessarily. might also be slightly less latency than an error log.

@doctorray117
Copy link
Owner

The issue with the api gateway is that it won't listen on the minecraft listening port on the front-end, so there'd be no way to trigger it without manually hitting another URL. I'll reply to your other questions soon, still working today :)

@binarythinktank
Copy link
Author

ah, right. and port conversion needs non-serverless components in front of it :/

@doctorray117
Copy link
Owner

As far as the other questions, the watchdog container does not incur any additional cost as it runs within the same task as the server container. ECS Fargate is priced by the task, and you can have multiple containers running simultaneously as part of it and pay the same cost.

With respect to scaling, this is not going to increase the power levels as users are there, you'd have to preprovision cpu/memory into the task definition and also the minecraft container settings, if you want to take advantage of additional memory. You wouldn't want to run this 24/7 because it would get expensive really fast... the main benefit is that it's basically zero cost when you're not using it.

For the domain, it's unlikely you'd get bot hits unless you're posting a link out there somewhere, as it's not a webpage, and it's a subdomain, not the root domain. While it's not impossible, it would be very unlikely and even then just use a slightly more complex name.

@binarythinktank
Copy link
Author

many thanks, those are good points. Going to try and launch it this weekend and play around with it!

@doctorray117
Copy link
Owner

Thanks, going to close this issue.

As a aside, a lambda watchdog would be difficult due to needing to obtain information about the running task, as well as scheduling the firing of the lambda overall. And, since running a second container within an ECS task comes at no additional cost, it's simpler to leave the control scripts running alongside the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants