News for hackers. Stuff that matters.
Re:In The Works – Amazon Aurora Serverless by k__ on Wednesday November 29, 2017 @12:35PM (#15808881)
Can't you open the connection outside of the function?

So as long as the function is hot, it won't reconnect.

Re:In The Works – Amazon Aurora Serverless by mjb on Wednesday November 29, 2017 @12:55PM (#15809084)
That's right. Make connections to databases (and most other things) the first time your Lambda handler runs, and stash them in a static/global variable for re-use on future runs. That allows you to amortize the cost of forming the connection over many executions of your function, which improves latency, reduces cost, and reduces load on the backend.
Re:In The Works – Amazon Aurora Serverless by k__ on Wednesday November 29, 2017 @01:29PM (#15809402)
Well, amortize sounds a bit funny when the first user basically has to pay the whole cold run, hehe
Re:In The Works – Amazon Aurora Serverless by sologoub on Wednesday November 29, 2017 @02:17PM (#15809880)
Haven't heard of this approach yet. Do you have a write up I could reference to try it out?
Re:In The Works – Amazon Aurora Serverless by k__ on Wednesday November 29, 2017 @02:47PM (#15810200)
I never read anything official, but some stuff by framework makers (serverless/apex up)

edit: https://medium.com/@tjholowaychuk/aws-lambda-lifecycle-and-i...

Re:In The Works – Amazon Aurora Serverless by sologoub on Wednesday November 29, 2017 @06:53PM (#15812040)
Thanks, but I think this is very different from connection pooling on a DB, say pdbouncer.

Doing some searching, I did find this that seems much closer: http://blog.rowanudell.com/database-connections-in-lambda/

TLDR; you can define the connection to DB outside of the scope of a given function, so it’s scoped to the container and can be reused so long as the container is not recycled. Seems promising!

Re:In The Works – Amazon Aurora Serverless by k__ on Wednesday November 29, 2017 @07:06PM (#15812132)
That's basically what I wrote