With a PerformanceProfile that loads collections completely into memory, available hardware limits concurrent requests. When collections are read partly or entirely from a file, configure concurrency for the number of threads that will access the Pipeline.
For PerformanceProfiles such as LowMemory and Balanced, the concurrency is limited by the number of file handles available in the file pool. In most implementations, the default value for this is the number of cores available on the machine. If more threads than this will be used, the expected concurrency must be configured when creating the engine, so that the file pool is created with the correct size to handle the expected number of concurrent accesses.
The snippet below shows how to set this when creating the engine:
Select a tab to view language specific information on setting the concurrency.
In code:
var pipeline = new DeviceDetectionPipelineBuilder(loggerFactory)
The resource manager can be shared by every thread. Each thread creates its own results with ResultsHashCreate, because reading a value writes into the results, so a set of results is used by one thread at a time.
ConfigHash* config = new ConfigHash();
config->setLowMemory();
config->setConcurrency(threadCount);
EngineHash *engine =
new DeviceDetection::Hash::EngineHash(
dataFilePath,
config,
properties);
The engine can be shared by every thread. Each call to process returns new results for the thread that made it, because reading a value writes into the results, so a set of results is used by one thread at a time.
In code:
use fiftyone_device_detection::{DeviceDetectionPipelineBuilder, PerformanceProfile};
let pipeline = DeviceDetectionPipelineBuilder::on_premise(data_file)