Figure out better way of caching MOJO Pipelines in H2OMOJOPipelineModel transformer

Description

Problem

The code:
https://github.com/h2oai/sparkling-water/blob/ea5b11a4c77a20211ee04dde3c6941026042dd61/scoring/src/main/scala/ai/h2o/sparkling/ml/models/H2OMOJOPipelineModel.scala#L36-L39
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.

Goal
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

Activity

Show:
Michal Malohlava
October 2, 2019, 4:19 AM
Edited

Should we broadcast the model? (similar to idea sketch here: https://stackoverflow.com/questions/40435741/object-cache-on-spark-executors)

Jakub Hava
October 2, 2019, 5:17 AM

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

Assignee

Jakub Hava

Reporter

Michal Malohlava

Labels

None

CustomerVisible

No

testcase 1

None

testcase 2

None

testcase 3

None

h2ostream link

None

Affected Spark version

None

AffectedContact

None

AffectedCustomers

None

AffectedPilots

None

AffectedOpenSource

None

Support Assessment

None

Customer Request Type

None

Support ticket URL

None

End date

None

Baseline start date

None

Baseline end date

None

Task progress

None

Task mode

None

ReleaseNotesHidden

None

Fix versions

Priority

Major
Configure