sql

All things SQL and JDBC...
frankitox 2020-11-20T17:29:11.396500Z

I'm looking to hook up AWS Lambdas with postgres, and I was wondering if it makes any sense to use connection pooling (e.g: hikariCP) in this context? Lambda has only one thread, so I don't see how having more than one connection can make a difference. The best approach I can think of now is just having one connection open for the duration of the Lambda (with jdbc/get-connection).

jsyrjala 2020-11-20T17:35:20.396600Z

Lambdas can have several threads. So connection pooling might be useful in some cases. But in most cases having a single thread with a single connection is probably good enough.

jsyrjala 2020-11-20T17:37:01.396800Z

There is also this: https://aws.amazon.com/rds/proxy/ A connection that can be shared by several lambda instances.

frankitox 2020-11-20T18:35:26.397200Z

Thanks for the confirmation! Oh, what I meant is CPUs, not threads. Running code in parallel. I read somewhere that CPU usage is bound to the amount of memory you assign to the lambda, but I don't know about the specifics. Like, maybe you get 2 CPUs if you set 2GB+ of RAM, or something like that.

frankitox 2020-11-20T18:36:07.397400Z

I'll give RDS Proxy a spin! Looks like a helpful solution if I start seeing memory starvation on postgres.

jsyrjala 2020-11-20T20:26:51.397600Z

Some discussion indicating that lambda may have 1-2 cpus available

jsyrjala 2020-11-20T20:26:55.397800Z

https://gist.github.com/saidsef/882647c6589e868b81f0cced4041b132

👀 1