https://www.growthbook.io/ logo
b

blue-exabyte-67168

07/26/2023, 3:02 PM
Hi, I'm looking for some clarity on how many API requests we will be generating when using the JS or React SDKs. Can we say that a user will generate
x
number of API requests per page load (assuming a page with an experiment running)? My hypothesis would be an API request when
loadFeatures
is called and another when
useFeatureValue
or
getFeatureValue
is called, but can anyone confirm? I want to ensure we won't be close to the 10M limit on api requests/month for the free plan.
f

fresh-football-47124

07/26/2023, 4:24 PM
it would just be one API request on load features, all the other growthbook calls donโ€™t cause an API request.
b

blue-exabyte-67168

07/26/2023, 4:55 PM
Oh, great! Thanks for the response. We are doing hybrid SSR + client-side, so we call
loadFeatures
on both the server and client side. Would that be 2 API requests then? (Looking at the code I see some caching logic, but want to confirm to what degree that will work)
f

fresh-football-47124

07/26/2023, 5:08 PM
yes, most likely two requests for hybrid
b

blue-exabyte-67168

07/26/2023, 5:16 PM
OK thank you!
a

ambitious-grass-79919

09/13/2023, 7:18 AM
Extending on this, I noticed that when a GrowthBook instance is created,
/api/features/<client_key>
is called, then
/sub/<client_key>
is called to subscribe to any updates. So minimally there will be 2 calls for each instance created, right? Are there any other API requests we should be taking note off?
๐Ÿ‘€ 1
w

white-fireman-22476

09/13/2023, 7:40 AM
No there should not be any others. You can disable SSE if you like by setting
backgroundSync: false
. https://docs.growthbook.io/lib/js#streaming-updates
a

ambitious-grass-79919

09/13/2023, 8:47 AM
If we set load features with
growthbook.loadFeatures({ autoRefresh: true })
, will the polling add to the API requests? If so, what is the refresh rate? I canโ€™t seem to find this in the documentation ๐Ÿ˜…
h

happy-autumn-40938

09/13/2023, 7:59 PM
Hi.
autoRefresh: true
is the legacy way of enabling streaming (SSE, not polling);
subscribeToChanges: true
is the preferred way going forward. The reconnect rate is currently set to 1 minute refresh intervals.
a

ambitious-grass-79919

09/14/2023, 12:42 AM
Oh nice, thanks for the clarification! So if I understand this correctly,
subscribeToChanges: true
should not affect the API requests, right? ๐Ÿ˜…
b

brief-honey-45610

09/14/2023, 2:14 AM
/sub
requests are included in the API limits.
a

ambitious-grass-79919

09/14/2023, 3:31 AM
I see, thanks everyone!
๐Ÿ‘๐Ÿป 1