在使用PySpark 2.4.0和MlFlow提供ml模型时,我遇到了一个问题
执行器失败,出现以下异常:
org.apache.spark.util.TaskCompletionListenerException: Memory was leaked by query. Memory leaked: (2048) Allocator(stdin reader for ./my-job-impl-condaenv.tar.gz/bin/python) 0/2048/8194/9223372036854775807 (res/actual/peak/limit)
从关于PySpark的文章中,我了解到以下几点:
spark.executor.memory
参数只配置JVM内存限制,不影响python进程李>spark.yarn.executor.memoryOverhead
配置李>spark.executor.pyspark.memory
显式地为python工作者保留内存,这允许我们更精确地规划内存,并停止使用spark.yarn.executor.memoryOverhead
过度分配内存李>以下是官方文件对spark.executor.pyspark.memory
的解释:
The amount of memory to be allocated to PySpark in each executor, in MiB unless otherwise specified. If set, PySpark memory for an executor will be limited to this amount. If not set, Spark will not limit Python's memory use and it is up to the application to avoid exceeding the overhead memory space shared with other non-JVM processes. When PySpark is run in YARN or Kubernetes, this memory is added to executor resource requests.
起初,我只是使用spark.yarn.executor.memoryOverhead
增加了内存量,错误终于消失了
然后我决定做得更好,并使用导致相同错误的spark.executor.pyspark.memory
指定python worker的内存量
所以,似乎我没有正确理解spark.executor.pyspark.memory
的确切结构以及它与spark.yarn.executor.memoryOverhead
的关系
我对PySpark没有太多的经验,所以我希望您能帮助我理解PySpark中的内存分配过程,谢谢
目前没有回答
相关问题 更多 >
编程相关推荐