Bulk Tags
To reduce requests to the device, improve throughput from a device, process tags faster, or obtain similar data at the same time, the script can define the bulkId field in the result of the onValidateTag function for each non-array tag. Tags that share the same bulkId are blocked together and provided to the onTagsRequest, onFileTagsRequest, onData, onFileOperations, and onFileChange functions allowing the script to complete all the tags in the block.
If script defines one bulkId, it must define a bulkId for all non-array tags
If the bulkId is not defined in the onValidateTag function, the Universal Device Driver assigns a unique value to each tag that does not have the arrayColumns defined.
  Caution: If the script defines the bulkId of one non-array tag, it must define a bulkId for every non-array tag. Otherwise, the value chosen by the Universal Device Driver may conflict with a value previously chosen by the script.
Tags with a valid array data type and non-zero array Columns are not blocked
The Universal Device Driver does not allow blocking array tags. If a bulkId is assigned to a tag in onValidateTag with a valid array data type and arrayColumns, the bulkId is ignored. The bulkId of the array tag is 0 when received in other API functions.
Block Size Performance vs. CPU Usage
The onValidateTag function does not limit the number of tags defined with the same bulkId. However, to prevent unnecessary strain on the script engine, the Universal Device Driver fails Read requests if more than 8000 tags are in the same block.
 Caution:  The script writer should monitor the performance and CPU usage of the server runtime and script engine processes to ensure that the size of the block is optimal for the use case.
Example with Modbus Protocol
Modbus devices allow requests to specify a certain number of registers starting with a particular address. The script could assign the same bulkId to those tags that could be included in the same request to the device. This reduces the number of transactions required over the wire and improves performance.
Example with MQTT Pub / Sub Protocol
The script could assign the same bulkId to all the tags in the same topic to allow updating them at the same time. This would allow the entire transaction to be processed together, improving performance.
Example with Structure
The tags in a structure often represent the state of the device cycle at a given moment in time. If the tags are updated one at a time, there is no guarantee that the data in one tag was related to the data in another tag. Assigning the same bulkId to those related tags allows the script to issue the necessary requests to the device, save the results, and ultimately update the tags at the same time, ensuring the data is related. For example, if a tag holds the temperature from a temperature sensor and another tag holds the time that was taken, in a non-bulked configuration, the temperature tag could be from a previous read from the time tag. This is dependent on how many tags are in the project and how quickly they are scanned. But if only processing one tag at a time, there is no guarantee of the relationship of the data to other tag data. However, if the tags were assigned the same bulkId, then the script can control the update of the data and ensure that relationship.
 
Was this helpful?