Replies: 1 comment
-
The variable is guaranteed to stay populated if it's global, but you have no guarantees that you'll get the same container ever again unfortunately. You could try warming, which might help! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a python script like this:
When the
model = SentenceTransformer('all-MiniLM-L6-v2')
is initialized it will download the library and this process takes a while. So I put it in theget_model
method and return the model from the previous request for subsequence requests to save time.However, when I execute the lambda function via sidecar within a route.
I got timeout for that request, so I put that code into a job and run it in a queue. This time, it ran successfully and I expected the
get_model
method would return the model from the 1st run in the queue when I re-visit the above route, but it didn't. However, it did return when I dispatched another job to queue (I knew that because this time the job ran much faster).So I wonder if AWS Lambda creates a different instance for QUEUE and HTTP Request?
Beta Was this translation helpful? Give feedback.
All reactions