This post discusses strategies to improve performance when requesting data from the Marketo API. However, you must weigh the benefits of these strategies against the operating constraint of Marketo API’s daily limits.
Strategy 1 – Request Less Data in Each API Call
Generally, as you request more data in an API call, the amount of time it takes to look up the data in the database by the Marketo server increases.
If you are making an API call with date ranges, such as the getMultipleLeads SOAP API, shorten the time range per call and compensate with more calls. For example, instead of requesting data from June 1 to July 1, request a single day at a time, such as one call for June 1 to 2, and then another call for June 2 to 3.
If you are making an API call that returns data from Marketo lead fields, only request those fields necessary. Every additional lead field incrementally increases the amount of time an API call takes. Another approach is to reduce the batch size, or the number of leads requested per call.
Strategy 2 – Make Concurrent Requests
To improve performance and pull more data at once, you can make concurrent requests to the API. This blog posts show how to do this. This approach reduces the time on wire API requests spend in aggregate.
For example, let’s say you are making requests to the Get Multiple Leads by Filter Type. You can make concurrent requests for one request querying leads 1 to 300 and for another request querying leads 301 – 600.
Strategy 3 – Cache Data
Some data in Marketo is changed less often, such as the list of lead fields, than other data, such as lead activity data. If you cache data that is less often updated, then you will reduce the number of API calls you have to make. You will also get better performance because looking up the data locally is generally faster than accessing it from a remote web service.