Configure bulk requests to optimize performance by combining multiple requests into one request that the Machine Learning transformation sends to the machine learning model. Bulk requests can improve performance by reducing processing overhead and the amount of time that it takes to communicate with the model.
To create a bulk request, the Machine Learning transformation selects the highest-level array field in the request schema. In the JSON request body for the bulk request, the transformation combines request rows as elements of the selected array field so that one JSON request body contains data for multiple requests. You can configure bulk request options to determine how much data each bulk request contains.
For example, the request schema might have the following structure:
The Machine Learning transformation selects the
data
array as the highest-level array field to combine requests. If you configure each bulk request to send 2 MB of data to the machine learning model, the Machine Learning transformation configures the
data
array in the JSON request body to include data for 2 MB of request rows.
The highest-level array cannot have sibling array fields. If the highest-level array has a sibling field of a primitive data type, the data in the sibling field will not be combined. Instead, one random record in the sibling field will be sent to the machine learning model.
To create a bulk response, the machine learning endpoint must combine response rows as elements of the highest-level array in the response schema. The Machine Learning transformation parses the array into output rows. Review the bulk request options to verify which field the Machine Learning transformation will parse.
To use bulk requests in the Machine Learning transformation, the machine learning endpoint must be configured to accept bulk requests and send bulk responses.