Question
· Dec 17

Production pooled component index

I have a business service which is responsible for some batch operations with an SQL table. The process is generally slow but it is possible to scale the performance using multithreading and/or parallel processing and logical partitioning (postgres):


select id, col1, col2, mod(row_number() over (), 4) as partition from some_table;

Thus, a partition index will be assigned to each table row. The idea is to create several instances of my business service using pooling (e.g. Pool Size = 4) so each business service instance will be responsible to hande rows belonging to a certain partition, e.g.:

#Dim partition
Set partition = ..FindPoolIndex($this)
#Dim sql 
Set sql = "with tmp as (select id, col1, col2, mod(row_number() over (), 4) as partition from some_table) select * from tmp where partition = " _ partition

Is it possible to somehow programmatically find out the index of a pooled component in a pool?

Product version: IRIS 2024.3
Discussion (4)1
Log in or sign up to continue

Yes, you can programmatically determine the index of a pooled component in InterSystems IRIS by using the FindPoolIndex method, which will return the index of the current component in the pool. This method can help you identify which partition of the data each business service instance should handle, allowing you to assign the correct partition in your SQL query. Ensure that the FindPoolIndex method is properly implemented to map the instance to the correct partition index, as shown in your example. This will allow you to scale the batch operations effectively using pooling and partitioning. 🚀