function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SamuelDeRyckeSamuelDeRycke 

Dealing with the 20 simultaneous request callouts to a same URL governor limit.

There is a governor limit, that limits you to 20 concurrent API calls to the same URL endpoint. Any other concurrent calls will receive an exception. This is a hard limit and salesforce won't increase it for us (possible for other limits).

 

"A callout request to a given URL is limited to a maximum of 20 simultaneous requests."

 

I'll start with explaining why this is an issue to us, we're developing a site on force.com,  in where our customers will be able to manage their account,  manage their  sub-users and search our catalog, place&manage orders, etc. Some of that is located in salesforce, but some data, like or catalog is too big. I is stored in a seperate database, fully focussed on performing fast search on huge data quantities, at which salesforce still performs under our requirements.

 

Now, our idea was to just get the data from the other database over REST, and i've already implemented a test scenario using Remote Javascript functions, and it works great. Search functionality is a core concept of our website, and we're making  calls to the catalogue to perform autosuggest, per keystroke. This combined with calls that will be made on actual search, and other features of our website we expect to hit this governor limit very fast, as soon as having only 100 users online at the same time. We have a large international customerbase, and are thus worried and looking for a way around this governor limit.

 

Expecting the exception and making  new call in the catch (in recursive fashion) isn't something we believe is the way to go on this (are we wrong ?).  Has any of you already faced (and overcome ) this problem ? Or insights on how you would tackle this, are both grealy appreciated !

GauravArhovGauravArhov
Hello Samuel,

Were you able to resolve this issue? 

We are creating a managed package which can have multiple subscriber organization. This package may require to frequently throw out to external server via callout and with multiple subscriber organizations I can sense this issue. So please share your experience.

I will really appreciate a suggestion, reply on this. Thanks.

SamuelDeRyckeSamuelDeRycke

I would say the way to deal with this could much depend on the functionality of your package and features, It's thus hard to recommend a general way to deal with this. 

But looking at the details of this limit's documentation (http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_gov_limits.htm ) we can see :

"The host is defined by the unique subdomain for the URL, for example, www.mysite.com and extra.mysite.com are two different hosts. This limit is calculated across all organizations that access the same host. If this limit is exceeded, a CalloutException will be thrown."

So possibly one option would be to add subdomains for every subscriber you have and redirect them tot the same endpoints internally.