AWS Elastic cache Lambda connection performance issue #481
Replies: 1 comment 1 reply
-
@bhogemukesh I have no idea why it would take that long, you have to ask AWS why it takes long to connect. This lib only wraps around redis-py so it might be their issue, unless you can track down that it is our code that is getting stuck somewhere. I also have no idea how java works or why it is faster but java is faster in general so i am not surprised. I dont know what kind of quickfixes or good practices you are looking for because the code you run is the code to run and there are no workarounds that would make it faster because then it would be brought into the mainline so everyone had that performance boost. Also note that if i get your code right then you will basically create a new object at each lambda function and then you have to do the initial cluster discovery procedure every single time you create the cluster object and yeah that is going to be slow. Find a way to actually share the object between lambdas. Otherwise you have to figure out some way to make it async in the background while you continue to run other code while waiting for the cluster to be discovered. Other then that i dont have any other ideas, i guess you have to live with it or build another solution outside of lambda where you have a more permanent setup instead of lambdas, or just switch to Java if this is a dealbreaker for ya :) I hope this help some but it is difficutl to help even further. |
Beta Was this translation helpful? Give feedback.
-
We are using below code snippet to get connection in AWS Lambda Function.
We saw it is taking longer time to get connection (~300ms to 500ms). Whereas getting connection in Java quicker as compare to python.
We can not use pool as it its AWS lambda function. (Serverless)
rc = RedisCluster(startup_nodes=startup_nodes, decode_responses=True)
Any quick fix or workaround or good practices guideline will help.
Beta Was this translation helpful? Give feedback.
All reactions