I'm playing around with `ApolloApi` and wandering ...
# help
a
I'm playing around with
ApolloApi
and wandering whats the best way to split up services..? I'm usually using AppSync so can just spin up lambdas for various different queries and mutations, but with Apollo everything seems to be in a single lambda 🤔
b
you can use apollo federation
o
With dataloader, I found that it made a lot of sense to serve my graphql api as one lambda, esp for authorization logic that’s deeply nested. It’s getting kinda phat now though…but not sure the tradeoff is worth splitting yet. Longer cold starts from a larger lambda, vs slower requests because of the loss of caching
a
Thanks both. Just a little worried about the scaling of it all. Will AWS just spin up a bunch of lambdas as requests come in?
😬
Copy code
We recommend against running your gateway in a serverless environment (such as AWS Lambda), because schema composition increases Apollo Server's startup time. If you do run your gateway in a serverless environment, set your function's timeout to at least 10 seconds to prevent unexpected errors.
o
Just a little worried about the scaling of it all. Will AWS just spin up a bunch of lambdas as requests come in?
Yah here’s invocation count and concurrent executions for my graphql API. If you want to get an idea of schema size - the API docs are here. Cold start time is a bit annoying, maybe affects 10% of requests with provisioned capacity (although I still use the old school method of warming). The second pic is the last 6 hours of usage (so low load time of day since our customers are mostly US based). The calls taking >> 1 second are big mutations that are expected to take that long. I think most of the cold starts are the ones around ~1s. I’ve excluded warming calls from the chart. The last couple of pics are traces of a cold and warm starts. I have been vaguely thinking about reducing the cold start time in various ways, including using a leaner graphql server than apollo, but not a burning issue.