Skip to content

Any idea why wamer is causing API Gateway "cold starts"? #75

Open
@briananstett

Description

@briananstett

I'm wondering if anyone can help me understand some interesting behavior I'm seeing when using the warmer.

If I invoke my function directly through the Lambda console, a cold start is about 6 seconds with subsequent invocations taking less than a second.

(First "cold" invocation)
image

(Second "warm" invocation)
image

However, I would expect now that the function is "warm", that invoking it through API Gateway would NOT result in a cold start but it does.

$ time curl -i https://apigateway.domain.com
real	0m5.787s
user	0m0.087s
sys	0m0.011s

A subsequent request through API Gateway does not have a cold start

$ time curl -i https://apigateway.domain.com
real	0m0.349s
user	0m0.082s
sys	0m0.020s

What's even stranger, if I quickly invoke the Lambda function again with a "warmer" event, it seems to break something in API Gateway causing it to have a cold start again when invoking through the API Gateway domain.

(Test event in Lambda console that mimics "warm" event)

{
  "concurrency": 5,
  "warmer": true
}

image

Now if I CURL the API Gateway URL after the "warm" event, I get the API Gateway "cold start" again.

$ time curl -i https://apigateway.domain.com
real	0m6.178s
user	0m0.046s
sys	0m0.007s

Does this behavior make sense to anyone else?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions