Processing updates in bulk with MutateJobService
Wednesday, April 4, 2012
The AdWords API is designed to handle a high volume of changes, and many services allow developers to submit a large number of operations in one request. Most of the AdWords API services are synchronous though, so the client sends the request to the server, waits for processing and receives the result back.
Unlike other services, the MutateJobService (MJS) is designed for an asynchronous workflow. This has the following benefits:
Using MutateJobService in existing applications
Replacing existing calls to synchronous services with calls to MJS is easy. In most cases you can just use the same operations array to submit a job. Once submitted, the application needs to check the job status periodically to see when it is complete. Once ready, the results can be retrieved with the getResult method.
Please see examples in Java, PHP, Perl, DotNet, Ruby and Python for more details.
Recommendations:
MutateJobService is covered in more details in our video presentation: Efficient API Usage with the MutateJobService. As always, please feel free to ask any questions regarding the AdWords API on our forum or during scheduled office hours.
Unlike other services, the MutateJobService (MJS) is designed for an asynchronous workflow. This has the following benefits:
- No need to manage connections for each job - the job is executed autonomously and the results can be retrieved when ready.
- Multiple jobs can be submitted and executed in parallel. In fact, the service has no limit on the maximum jobs count.
- Transient errors like 'CONCURRENT_MODIFICATION' are automatically retried with no extra requests necessary.
- Workload is automatically balanced so you will never receive a 'RateExceededError' error.
Using MutateJobService in existing applications
Replacing existing calls to synchronous services with calls to MJS is easy. In most cases you can just use the same operations array to submit a job. Once submitted, the application needs to check the job status periodically to see when it is complete. Once ready, the results can be retrieved with the getResult method.
Please see examples in Java, PHP, Perl, DotNet, Ruby and Python for more details.
Recommendations:
- Don't poll for job status too often as this can result in RATE_EXCEEDED_ERROR error. We recommend pausing for 30 seconds between get requests with an exponential backoff.
- For better throughput, fewer large jobs are preferred over many smaller jobs. Once a job is scheduled and is executing, its progress will be very rapid.
- When submitting many jobs for the same customerID, overall operation throughput will be optimal if no two outstanding jobs will be modifying the same AdGroup. Making all your jobs touch all AdGroups can cause severe slow-down or even job failures.
MutateJobService is covered in more details in our video presentation: Efficient API Usage with the MutateJobService. As always, please feel free to ask any questions regarding the AdWords API on our forum or during scheduled office hours.