Fork me on GitHub
#holy-lambda
<
2023-05-30
>
lepistane16:05:29

I wanna make AWS lambda function that will serve as single HTTP server endpoint that has access to the DB. (similar to service 'status' like https://www.githubstatus.com/) Frequency of use: 20-60x a minute. from my own research it seems to me that holy lambda is great fit especially if i don't want to be bound to AWS as vendor. I would like to know 1. does it make sense to use aws lambda fn for this requency 2. could holy-lambda be of use to develop my use case? Thank you for your time

igrishaev16:05:32

I'm not too familiar with holy-lambda, but I'd answer yes to both of your questions. Btw, you can use my library for lambdas which provides a ring handler: https://github.com/igrishaev/lambda

Karol Wójcik17:05:06

@U1WAUKQ3E Interesting self promotion XD Answering the question. Everything is possible from technical perspective. Certainly HL has also support for ring handlers if you need it. I don’t know though what you want to achieve. Will this lambda carry any additional logic or just endpoint for pinging db? Everytime new lambda is brought to life, new DB connection is established, so in general if you hit concurrent execution of lambdas that is higher than your max connection limit you will see 500.

lepistane18:05:41

@UJ1339K2B basically this endpoint needs to do 2 things 1. receive request (of course authenticated) 2. query DB (basically lookup) 3. return data

concurrent execution of lambdas
what do you mean by this?

Karol Wójcik18:05:56

Got it. Go for it. Pretty easy to do stuff.

👍 2
igrishaev18:05:15

My two cents. If you poll your lambda with constant rate, you can set up the lambda timeout such that it will live without being terminated. Next, preserve the DB connection such that it won't be created again and again on each call

igrishaev19:05:17

I'm not promoting my library, it's just a humble project. Still, it takes that case into account: one can share the state b/w processing the messages from queue

igrishaev19:05:34

One more thing, reaching DynamoDB instead of Postgres/Mysql would be faster/chaper

Karol Wójcik19:05:37

Lambda timeout doesn’t work that way AFAIK. You have no control of request being processed by the same lambda. But certainly the big chance is it will.

igrishaev19:05:04

yeah there is no 100% garantie, but still. By queue, I mean the lambda message queue.

igrishaev19:05:22

where you fetch the messages from

Karol Wójcik19:05:43

Okay, you mean internal AWS lambda API. Got it. Thank you! :D

igrishaev19:05:04

yep, sorry for confusing