Hi Team - We have a pro subscription and using Fe...
# ask-questions
c
Hi Team - We have a pro subscription and using Feature Flags. We are using CDN to make an API call to get the list of all the feature flags across projects and then switch over to SDK for further action. Our problem is, we are getting a "429 - Too many requests" often for the single API call we make. I get that there is 60/min rate limit which is too low for our customer load. Is there any way to get around this ?
h
Hi, do you mean that your SDKs are fetching from a CDN endpoint which is caching the features API? Or you have some CDN/edge logic that fetches from the API per user request?
c
My apologies. What I intended to say was we are using the API to get all the projects along with their keys before switching to using SDK by using the obtained keys. Along with this, we make another api call to download the list of all feature flags (only the ID/Names). Quite often this 2nd call fails with a 429 error. There is only these 2 calls that go. So, not sure why this error. CDN comes into picture once we switch over to SDK. So for API we use api.growthbook.io and for sdk it's cdn.growthbook.io
h
Without knowing more about your setup or business case for hitting the REST API in this way, I will say that this is not a common usage pattern. Why does your service need to know all the projects and feature flag IDs? Is there a way you can achieve the same thing simply using a set of SDK Connections? If not, can you add a caching layer in front of the REST API?
c
I don't think we are able to get a list of all the projects using SDK connection. SDK connection is specific to a project within GrowthBook. Our framework currently has been generalized to get all the projects and the corresponding SDK keys since the consumer of our framework would not know the key
h
are you able to add a cache layer / debouncer, at least for the REST API calls? that would surely cut down on your API limits
s
Hello @happy-autumn-40938, how's everything? As you may now, we are adopting GrowthBook at our company in an "on-premises", enterprise licensed version. We have our own import processes which use the REST API and clearly hit the rate limit. How could we increase the limit? Regards,
I've seen this configuration API_RATE_LIMIT_MAX https://github.com/growthbook/growthbook/blob/a833c60e2592ed845da2ed22d78983f37bc4b981/packages/back-end/src/api/api.router.ts#L58 but it looks like the "windowMs" is hardcoded.
h
If you are self-hosting, that should do the trick. Is changing
API_RATE_LIMIT_MAX
working for you?
s
Yes, thanks. I just tested it with docker, but it works. Do you have any further recommendation on machine sizing according to active users or API load?