Quickstart Guide

Multi-threading and Retry

Multi-threading

Multi-threading is the process of splitting a job into multiple pieces that are run at the same time. In the context of a web service, this means sending multiple requests to the web server at the same time and processing the results as they come back. This design principle can greatly improve processing speeds when applied on medium to large sized datasets. As a general rule, we recommend a maximum size of 20 threads for most jobs.

Retry

When sending requests to a web service, it is important to take into account transmission errors which can occur from time to time. Unhandled transmission errors can cause an entire job to fail! Therefore it is critical that we handle these errors properly as they come up. Most commonly this may be seen as an HTTP 408 Request Timeout error. If the request you send times out or fails, we recommend retrying the request a minimum of 5 times, with a wait of 30 seconds between each request retry as a general rule. This amount of requests and time between requests can be adjusted as needed.

An Example of a retry block using pseudocode:

maxRetries = 5
for (currentTry = 0; currentTry < maxRetries; currentTry ++){
    try{
        response = SendWebRequest(request)
        }  catch (HTTPException) {
            continue; // retry sending request again, we had an error
        }
        if (response.Success == true){
            break; // exit loop we have a good response
        }
}

if (response.Success == true){
        // good response, send results forward
} else {
        // bad response, stop processing or skip record
}