https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
l

lemon-stone-42630

03/06/2023, 12:50 PM
Hello, we are also planning on implementing GrowthBook for our Cloud functions (running in node.js). We have successfully using this on our front end (nuxt.js) and REST API (expressjs). For this Cloud function implementation, I would be happy to hear if every function invocation should use its own GrowthBook client or if we can cache the client for every instance instead? If so we could benefit
autoRefresh
on features as those could be refreshed until the instance is shut down rather than fetching them seperately for every invocation. Any ideas or suggestions to make it perfect with this type of server implementation?
f

future-teacher-7046

03/07/2023, 3:33 AM
I would still create a separate GrowthBook instance for every invocation. The SDK will cache the features in memory and reuse them across instances. Most serverless runtimes will reuse the environment for many requests so the cost of fetching should only be incurred once as part of cold starts.
👍 1
37 Views