Is there any possibility supertokens core will be adapted to run on lambda using https://docs.aws.amazon.com/lambda/latest/dg/snapstart.html. There's also another lambda adapter that allows existing HTTP applications (I.e. expecting http requests over lambda invocations) to run in lambda https://github.com/awslabs/aws-lambda-web-adapter.
It seems using these two combos it would be quite easy to run supertokens-core on lambda. I'm not a java dev so I can't make these changes myself, however it would seem the main change would be to build supertokens-core using maven.
04/17/2023, 5:49 AM
hey @AshH how would cronjobs run in this case?
04/17/2023, 8:43 AM
Ah I didn't realise there were cron jobs. I guess it would depend on how the crons were configured e.g. if crons always check if they need to run and then run during statrtup it would probably be ok.
Alternatively one could use lambda provisioned concurrency which means at least one or more lambdas are always on. https://docs.aws.amazon.com/lambda/latest/dg/provisioned-concurrency.html
There would be a small cost for that, but I imagine in most cases having just one provisioned concurrency would be desired anyway and also solves the cron issue. While giving you the benefits of lambda scaling.
04/17/2023, 8:48 AM
i see. If you can open an issue about this on our github about what are the steps required, we can have a look.That being said, it's not a big priority for us, so feel free to fork the core and make changes on your own 🙂
04/17/2023, 8:53 AM
I would love to give it a go myself if I could but I'm not a java dev 😦
04/17/2023, 8:53 AM
04/17/2023, 8:58 AM
I have been attempting to run supertokens-core as a lambda layer and some hackery around kicking off the process via node (being the lambda source). I may continue down that path.
of course you don't get the benefits of lambda java snapstart with that. So startup times are still an issue. Again provisioned concurrency can solve some of that (but not as the lambdas need to scale). With that caveat though, running on EKS or EC2 would be better than a node lambda/supertokens-core hack.