loads MOJO pipeline from actual bytes, however, it will happen for each thread running in executor (i.e., thread representing executor core). This brings significant memory, time overhead for bigger MOJO models.
Load the MOJO model only once per JVM and share it cross multiple executor threads.
If we decide to cache MOJO, we have to make sure we will not leave it in memory for too long,
and also expect that Spark job can use multiple MOJOs
We already broadcast the mojo bytes → spark driver registers it as the broadcast variable and executors just fetch it when they need it.
We could also try create instance of the MOJO model on driver and broadcast it, but not sure if we hit any serialization issues. But that would be definitely good improvement. I can have a look on it today and at least check if the model be serialized or not