GeezerVison is showing github.com — Add Spark materialization engine for parallel, distributed materialization of large datasets. · Issue #3167 · feast-dev/feast
Add Spark materialization engine for parallel, distributed materialization of large datasets. #3167DescriptionIs your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Current implementation of Spark offline store doesn't have Spark based materialization engine. This makes materialization slow, inefficient and makes Spark offline store not very useful since materialization is still happening in driver node and will be limited by its resources.
Describe the solution you'd like
A clear and concise description of what you want to happen.
Spark based materialization engine.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
BytewaxMaterializationEngine - it relies on offline_job.to_remote_storage() but SparkRetrievalJob doesn't support to_remote_storage(). Also, would rather use one stack for job execution (preferably Spark) instead of two.
Additional context
Add any other context or screenshots about the feature request here.
spark_materialization_engine would make Feast highly scalable and leverage full Spark potential. Right now it it very limited. Activityadchia commented on Sep 1, 2022 Hey! Thanks for the FR. Are you in the Slack? There have been recent discussions in the #feast-development Slack about this topic niklasvm commented on Sep 4, 2022 Hi @ckarwicki
I'm taking a look at potential designs for a SparkBatchMaterializationEngine. I've got an open PR that implements the to_remote_storage method for a SparkRetrievalJob in the mean time. I currently see 3 solutions:
(1) The default LocalMaterializationEngine writes the data to the local file system on the driver node and then loops over each parquet file in series. One possible solution is to parallelise this process however the success of this will still be limited by the size of the driver node.
(2) Alternatively, data can be written to remote storage (like S3) and the LambdaMaterializationEngine can be used however this requires the use of AWS Lambda.
(3) I don't know if it's possible to parallelise the code from the LocalMaterializationEngine to run over the executor nodes.
Any thoughts or ideas? ckarwicki commented on Sep 5, 2022 ContributorAuthor More actions niklasvm commented on Sep 5, 2022 Thanks @ckarwicki for the explanation. I have actually gone ahead and implemeted something quite similar in #3184 but instead of using foreachPartition I've used applyInPandas. I'm not sure which is superior. ckarwicki commented on Sep 5, 2022 ContributorAuthor More actions niklasvm commented on Sep 5, 2022 ckarwicki commented on Sep 5, 2022 ContributorAuthor More actions @niklasvm You should also use repartition() on df before calling foreachPartition() where number of partitions should be number of simultaneous connections (writes) to online store. We can call it without arguments - it will create 200 partitions (number taken from spark.sql.shuffle.partitions). It will be that many simultaneous connections (parallel writes) to Redis. Redis default is 10K connections. You can change it on Redis side if you need more. niklasvm commented on Sep 6, 2022 I believe repartition will cause a shuffle operation. Here's the DAG that uses repartition:

And without repartition:

Is the intention to only repartition to a number that redis can handle? Unfortunately numPartitions is a required parameter of repartition.
Could we use coalesce()? ckarwicki commented on Sep 7, 2022 ContributorAuthor More actions @niklasvm coalesce() should be used when partitioning down. It would be useful to call repartition() since it would allow control on the parallelism of materialization and simultaneous writes. They are saying it should be possible to call it without arguments:
numPartitions : int
can be an int to specify the target number of partitions or a Column. If it is a Column, it will be used as the first partitioning column. If not specified, the default number of partitions is used.
niklasvm commented on Sep 8, 2022 Thanks @ckarwicki. I have tested running this without a parameter and it fails.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|