Atlantiraptor Docs

parallelize

Type: Plugin · Category: server

Runs query on result batches in parallel.

Normally the source() plugin reads result sets from disk in series. This is fine when the result set is not too large but when we need to filter a lot of rows at the same time it is better to use all cores by reading and filtering in parallel.

The parallelize() plugin is a parallel version of source() which breaks result sets into batches and applies a query over each batch in parallel. If you have a multi threaded machine, it will be a lot faster.

The query passed to parallelize() will receive a special scope in which the source() plugin will returns results from a small batch of the total. The size of this batch is controlled by the batch parameter.

This is especially useful when we need to filter rows from a hunt - each client’s result set will be filtered in parallel on a different core.

Example

SELECT * FROM parallelize(hunt_id=HuntId, artifact=ArtifactName, query={
   SELECT * FROM source()
   WHERE FullPath =~ "XYZ"
})
Argument Type Description
client_id string The client id to extract
flow_id string A flow ID (client or server artifacts)
hunt_id string Retrieve sources from this hunt (combines all results from all clients)
artifact string The name of the artifact collection to fetch
source string An optional named source within the artifact
start_time int64 Start return events from this date (for event sources)
end_time int64 Stop end events reach this time (event sources).
notebook_id string The notebook to read from (should also include cell id)
notebook_cell_id string The notebook cell read from (should also include notebook id)
notebook_cell_table int64 A notebook cell can have multiple tables.)
query StoredQuery (required) The query will be run in parallel over batches.
workers int64 Number of workers to spawn.)
batch int64 Number of rows in each batch.)

Required permissions: READ_RESULTS

Platforms: macOS, Linux, Windows

Source: vql/server/flows/parallel.go