I think I'm having a common problem but I don't know how to solve it. I've got a frontend developed in angular10 and a backend divided in several lambda functions written in java11. In the middle there's the api gateway. As database I'm using mysql in rds. Now, from the client i'm sending a get request, the api gateway calls the right lambda function but a timeout is returned. From CloudWatch I see all lambda process is successfully closed and from the report I see: REPORT Duration: 32295.26 ms Billed Duration: 32296 ms Memory Size: 256 MB Max Memory Used: 178 MB Init Duration: 378.89 ms
I understand the java cold start is heavy and the connection to the db slow, but the database is empty so I don't understand where this time is spent. Plus: if i make a second call immediately after the first the response is super fast and the client is happy.
Anyway...I don't know how to solve since we understood the api gateway timeout can not be increased. Then, I don't want to transform all my client in asynchronous way.
Any suggestion?