Re: TaskMemoryManager: Failed to allocate a page
Usually using broadcast join could boost the performance when you have enough memory, You should decrease it or even disable it when there is no enough memory. On Thu, Oct 27, 2016 at 1:22 PM, Pietro Pugni wrote: > Thank you Davies, > this worked! But what are the consequences of setting > spark.sql.autoBroadcastJoinThreshold=0? > Will it degrade or boost performance? > Thank you again > Pietro > >> Il giorno 27 ott 2016, alle ore 18:54, Davies Liu ha >> scritto: >> >> I think this is caused by BroadcastHashJoin try to use more memory >> than the amount driver have, could you decrease the >> spark.sql.autoBroadcastJoinThreshold (-1 or 0 means disable it)? >> >> On Thu, Oct 27, 2016 at 9:19 AM, Pietro Pugni wrote: >>> I’m sorry, here’s the formatted message text: >>> >>> >>> >>> I'm running an ETL process that joins table1 with other tables (CSV files), >>> one table at time (for example table1 with table2, table1 with table3, and >>> so on). The join is written inside a PostgreSQL istance using JDBC. >>> >>> The entire process runs successfully if I use table2, table3 and table4. If >>> I add table5, table6, table7, the process run successfully with table5, >>> table6 and table7 but as soon as it reaches table2 it starts displaying a >>> lot of messagges like this: >>> >>> 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page >>> (33554432 bytes), try again. >>> 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page >>> (33554432 bytes), try again. >>> 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page >>> (33554432 bytes), try again. >>> ... >>> 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page >>> (33554432 bytes), try again. >>> ... >>> Traceback (most recent call last): >>> File "/Volumes/Data/www/beaver/tmp/ETL_Spark/etl.py", line 1200, in >>> >>> >>>sparkdf2database(flusso['sparkdf'], schema + "." + postgresql_tabella, >>> "append") >>> File "/Volumes/Data/www/beaver/tmp/ETL_Spark/etl.py", line 144, in >>> sparkdf2database >>>properties={"ApplicationName":info["nome"] + " - Scrittura della tabella >>> " + dest, "disableColumnSanitiser":"true", "reWriteBatchedInserts":"true"} >>> File >>> "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/pyspark.zip/pyspark/sql/readwriter.py", >>> line 762, in jdbc >>> File >>> "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/py4j-0.10.3-src.zip/py4j/java_gateway.py", >>> line 1133, in __call__ >>> File >>> "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/pyspark.zip/pyspark/sql/utils.py", >>> line 63, in deco >>> File >>> "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/py4j-0.10.3-src.zip/py4j/protocol.py", >>> line 319, in get_return_value >>> py4j.protocol.Py4JJavaError: An error occurred while calling o301.jdbc. >>> : org.apache.spark.SparkException: Exception thrown in awaitResult: >>>at >>> org.apache.spark.util.ThreadUtils$.awaitResult(ThreadUtils.scala:194) >>>at >>> org.apache.spark.sql.execution.exchange.BroadcastExchangeExec.doExecuteBroadcast(BroadcastExchangeExec.scala:120) >>>at >>> org.apache.spark.sql.execution.InputAdapter.doExecuteBroadcast(WholeStageCodegenExec.scala:229) >>>at >>> org.apache.spark.sql.execution.SparkPlan$$anonfun$executeBroadcast$1.apply(SparkPlan.scala:125) >>>at >>> org.apache.spark.sql.execution.SparkPlan$$anonfun$executeBroadcast$1.apply(SparkPlan.scala:125) >>>at >>> org.apache.spark.sql.execution.SparkPlan$$anonfun$executeQuery$1.apply(SparkPlan.scala:136) >>>at >>> org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151) >>>at >>> org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:133) >>>at >>> org.apache.spark.sql.execution.SparkPlan.executeBroadcast(SparkPlan.scala:124) >>>at >>> org.apache.spark.sql.execution.joins.BroadcastHashJoinExec.prepareBroadcast(BroadcastHashJoinExec.scala:98) >>>at >>> org.apache.spark.sql.execution.joins.BroadcastHashJoinExec.codegenSemi(BroadcastHashJoinExec.scala:318) >>>at >>> org.apache.spark.sql.execution.joins.BroadcastHashJoinExec.doConsume(BroadcastHashJoinExec.scala:84) >>>at >>> org.apache.spark.sql.execution.CodegenSupport$class.consume(WholeStageCodegenExec.scala:153) >>>at >>> org.apache.spark.sql.execution.FilterExec.consume(basicPhysicalOperators.scala:79) >>>at >>> org.apache.spark.sql.execution.FilterExec.doConsume(basicPhysicalOperators.scala:194) >>>at >>> org.apache.spark.sql.execution.CodegenSupport$class.consume(WholeStageCodegenExec.scala:153) >>>at >>> org.apache.spark.sql.execution.RowDataSourceScanExec.consume(ExistingRDD.scala:150) >>>at >>> org.apache.spark.sql.execution.RowDataSourceScanExec.doProduce(ExistingRDD.scala:217) >>>at >>> org.apache.spark.sql.execution.CodegenSupport$$anonfun$produce$1.apply(WholeStageCodegenExec.scala:83) >>>at >>> org.apac
Re: TaskMemoryManager: Failed to allocate a page
Thank you Davies, this worked! But what are the consequences of setting spark.sql.autoBroadcastJoinThreshold=0? Will it degrade or boost performance? Thank you again Pietro > Il giorno 27 ott 2016, alle ore 18:54, Davies Liu ha > scritto: > > I think this is caused by BroadcastHashJoin try to use more memory > than the amount driver have, could you decrease the > spark.sql.autoBroadcastJoinThreshold (-1 or 0 means disable it)? > > On Thu, Oct 27, 2016 at 9:19 AM, Pietro Pugni wrote: >> I’m sorry, here’s the formatted message text: >> >> >> >> I'm running an ETL process that joins table1 with other tables (CSV files), >> one table at time (for example table1 with table2, table1 with table3, and >> so on). The join is written inside a PostgreSQL istance using JDBC. >> >> The entire process runs successfully if I use table2, table3 and table4. If >> I add table5, table6, table7, the process run successfully with table5, >> table6 and table7 but as soon as it reaches table2 it starts displaying a >> lot of messagges like this: >> >> 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page >> (33554432 bytes), try again. >> 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page >> (33554432 bytes), try again. >> 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page >> (33554432 bytes), try again. >> ... >> 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page >> (33554432 bytes), try again. >> ... >> Traceback (most recent call last): >> File "/Volumes/Data/www/beaver/tmp/ETL_Spark/etl.py", line 1200, in >> >> >>sparkdf2database(flusso['sparkdf'], schema + "." + postgresql_tabella, >> "append") >> File "/Volumes/Data/www/beaver/tmp/ETL_Spark/etl.py", line 144, in >> sparkdf2database >>properties={"ApplicationName":info["nome"] + " - Scrittura della tabella >> " + dest, "disableColumnSanitiser":"true", "reWriteBatchedInserts":"true"} >> File >> "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/pyspark.zip/pyspark/sql/readwriter.py", >> line 762, in jdbc >> File >> "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/py4j-0.10.3-src.zip/py4j/java_gateway.py", >> line 1133, in __call__ >> File >> "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/pyspark.zip/pyspark/sql/utils.py", >> line 63, in deco >> File >> "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/py4j-0.10.3-src.zip/py4j/protocol.py", >> line 319, in get_return_value >> py4j.protocol.Py4JJavaError: An error occurred while calling o301.jdbc. >> : org.apache.spark.SparkException: Exception thrown in awaitResult: >>at >> org.apache.spark.util.ThreadUtils$.awaitResult(ThreadUtils.scala:194) >>at >> org.apache.spark.sql.execution.exchange.BroadcastExchangeExec.doExecuteBroadcast(BroadcastExchangeExec.scala:120) >>at >> org.apache.spark.sql.execution.InputAdapter.doExecuteBroadcast(WholeStageCodegenExec.scala:229) >>at >> org.apache.spark.sql.execution.SparkPlan$$anonfun$executeBroadcast$1.apply(SparkPlan.scala:125) >>at >> org.apache.spark.sql.execution.SparkPlan$$anonfun$executeBroadcast$1.apply(SparkPlan.scala:125) >>at >> org.apache.spark.sql.execution.SparkPlan$$anonfun$executeQuery$1.apply(SparkPlan.scala:136) >>at >> org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151) >>at >> org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:133) >>at >> org.apache.spark.sql.execution.SparkPlan.executeBroadcast(SparkPlan.scala:124) >>at >> org.apache.spark.sql.execution.joins.BroadcastHashJoinExec.prepareBroadcast(BroadcastHashJoinExec.scala:98) >>at >> org.apache.spark.sql.execution.joins.BroadcastHashJoinExec.codegenSemi(BroadcastHashJoinExec.scala:318) >>at >> org.apache.spark.sql.execution.joins.BroadcastHashJoinExec.doConsume(BroadcastHashJoinExec.scala:84) >>at >> org.apache.spark.sql.execution.CodegenSupport$class.consume(WholeStageCodegenExec.scala:153) >>at >> org.apache.spark.sql.execution.FilterExec.consume(basicPhysicalOperators.scala:79) >>at >> org.apache.spark.sql.execution.FilterExec.doConsume(basicPhysicalOperators.scala:194) >>at >> org.apache.spark.sql.execution.CodegenSupport$class.consume(WholeStageCodegenExec.scala:153) >>at >> org.apache.spark.sql.execution.RowDataSourceScanExec.consume(ExistingRDD.scala:150) >>at >> org.apache.spark.sql.execution.RowDataSourceScanExec.doProduce(ExistingRDD.scala:217) >>at >> org.apache.spark.sql.execution.CodegenSupport$$anonfun$produce$1.apply(WholeStageCodegenExec.scala:83) >>at >> org.apache.spark.sql.execution.CodegenSupport$$anonfun$produce$1.apply(WholeStageCodegenExec.scala:78) >>at >> org.apache.spark.sql.execution.SparkPlan$$anonfun$executeQuery$1.apply(SparkPlan.scala:136) >>at >> org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151) >>at >> o
Re: TaskMemoryManager: Failed to allocate a page
I think this is caused by BroadcastHashJoin try to use more memory than the amount driver have, could you decrease the spark.sql.autoBroadcastJoinThreshold (-1 or 0 means disable it)? On Thu, Oct 27, 2016 at 9:19 AM, Pietro Pugni wrote: > I’m sorry, here’s the formatted message text: > > > > I'm running an ETL process that joins table1 with other tables (CSV files), > one table at time (for example table1 with table2, table1 with table3, and > so on). The join is written inside a PostgreSQL istance using JDBC. > > The entire process runs successfully if I use table2, table3 and table4. If > I add table5, table6, table7, the process run successfully with table5, > table6 and table7 but as soon as it reaches table2 it starts displaying a > lot of messagges like this: > > 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page > (33554432 bytes), try again. > 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page > (33554432 bytes), try again. > 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page > (33554432 bytes), try again. > ... > 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page > (33554432 bytes), try again. > ... > Traceback (most recent call last): > File "/Volumes/Data/www/beaver/tmp/ETL_Spark/etl.py", line 1200, in > > > sparkdf2database(flusso['sparkdf'], schema + "." + postgresql_tabella, > "append") > File "/Volumes/Data/www/beaver/tmp/ETL_Spark/etl.py", line 144, in > sparkdf2database > properties={"ApplicationName":info["nome"] + " - Scrittura della tabella > " + dest, "disableColumnSanitiser":"true", "reWriteBatchedInserts":"true"} > File > "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/pyspark.zip/pyspark/sql/readwriter.py", > line 762, in jdbc > File > "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/py4j-0.10.3-src.zip/py4j/java_gateway.py", > line 1133, in __call__ > File > "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/pyspark.zip/pyspark/sql/utils.py", > line 63, in deco > File > "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/py4j-0.10.3-src.zip/py4j/protocol.py", > line 319, in get_return_value > py4j.protocol.Py4JJavaError: An error occurred while calling o301.jdbc. > : org.apache.spark.SparkException: Exception thrown in awaitResult: > at > org.apache.spark.util.ThreadUtils$.awaitResult(ThreadUtils.scala:194) > at > org.apache.spark.sql.execution.exchange.BroadcastExchangeExec.doExecuteBroadcast(BroadcastExchangeExec.scala:120) > at > org.apache.spark.sql.execution.InputAdapter.doExecuteBroadcast(WholeStageCodegenExec.scala:229) > at > org.apache.spark.sql.execution.SparkPlan$$anonfun$executeBroadcast$1.apply(SparkPlan.scala:125) > at > org.apache.spark.sql.execution.SparkPlan$$anonfun$executeBroadcast$1.apply(SparkPlan.scala:125) > at > org.apache.spark.sql.execution.SparkPlan$$anonfun$executeQuery$1.apply(SparkPlan.scala:136) > at > org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151) > at > org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:133) > at > org.apache.spark.sql.execution.SparkPlan.executeBroadcast(SparkPlan.scala:124) > at > org.apache.spark.sql.execution.joins.BroadcastHashJoinExec.prepareBroadcast(BroadcastHashJoinExec.scala:98) > at > org.apache.spark.sql.execution.joins.BroadcastHashJoinExec.codegenSemi(BroadcastHashJoinExec.scala:318) > at > org.apache.spark.sql.execution.joins.BroadcastHashJoinExec.doConsume(BroadcastHashJoinExec.scala:84) > at > org.apache.spark.sql.execution.CodegenSupport$class.consume(WholeStageCodegenExec.scala:153) > at > org.apache.spark.sql.execution.FilterExec.consume(basicPhysicalOperators.scala:79) > at > org.apache.spark.sql.execution.FilterExec.doConsume(basicPhysicalOperators.scala:194) > at > org.apache.spark.sql.execution.CodegenSupport$class.consume(WholeStageCodegenExec.scala:153) > at > org.apache.spark.sql.execution.RowDataSourceScanExec.consume(ExistingRDD.scala:150) > at > org.apache.spark.sql.execution.RowDataSourceScanExec.doProduce(ExistingRDD.scala:217) > at > org.apache.spark.sql.execution.CodegenSupport$$anonfun$produce$1.apply(WholeStageCodegenExec.scala:83) > at > org.apache.spark.sql.execution.CodegenSupport$$anonfun$produce$1.apply(WholeStageCodegenExec.scala:78) > at > org.apache.spark.sql.execution.SparkPlan$$anonfun$executeQuery$1.apply(SparkPlan.scala:136) > at > org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151) > at > org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:133) > at > org.apache.spark.sql.execution.CodegenSupport$class.produce(WholeStageCodegenExec.scala:78) > at > org.apache.spark.sql.execution.RowDataSourceScanExec.produce(ExistingRDD.scala:150) > at > org.apache.spark.sql.execution
Re: TaskMemoryManager: Failed to allocate a page
I’m sorry, here’s the formatted message text: I'm running an ETL process that joins table1 with other tables (CSV files), one table at time (for example table1 with table2, table1 with table3, and so on). The join is written inside a PostgreSQL istance using JDBC. The entire process runs successfully if I use table2, table3 and table4. If I add table5, table6, table7, the process run successfully with table5, table6 and table7 but as soon as it reaches table2 it starts displaying a lot of messagges like this: 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page (33554432 bytes), try again. 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page (33554432 bytes), try again. 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page (33554432 bytes), try again. ... 16/10/27 17:33:47 WARN TaskMemoryManager: Failed to allocate a page (33554432 bytes), try again. ... Traceback (most recent call last): File "/Volumes/Data/www/beaver/tmp/ETL_Spark/etl.py", line 1200, in sparkdf2database(flusso['sparkdf'], schema + "." + postgresql_tabella, "append") File "/Volumes/Data/www/beaver/tmp/ETL_Spark/etl.py", line 144, in sparkdf2database properties={"ApplicationName":info["nome"] + " - Scrittura della tabella " + dest, "disableColumnSanitiser":"true", "reWriteBatchedInserts":"true"} File "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/pyspark.zip/pyspark/sql/readwriter.py", line 762, in jdbc File "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/py4j-0.10.3-src.zip/py4j/java_gateway.py", line 1133, in __call__ File "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/pyspark.zip/pyspark/sql/utils.py", line 63, in deco File "/Volumes/Data/www/beaver/tmp/ETL_Spark/spark/python/lib/py4j-0.10.3-src.zip/py4j/protocol.py", line 319, in get_return_value py4j.protocol.Py4JJavaError: An error occurred while calling o301.jdbc. : org.apache.spark.SparkException: Exception thrown in awaitResult: at org.apache.spark.util.ThreadUtils$.awaitResult(ThreadUtils.scala:194) at org.apache.spark.sql.execution.exchange.BroadcastExchangeExec.doExecuteBroadcast(BroadcastExchangeExec.scala:120) at org.apache.spark.sql.execution.InputAdapter.doExecuteBroadcast(WholeStageCodegenExec.scala:229) at org.apache.spark.sql.execution.SparkPlan$$anonfun$executeBroadcast$1.apply(SparkPlan.scala:125) at org.apache.spark.sql.execution.SparkPlan$$anonfun$executeBroadcast$1.apply(SparkPlan.scala:125) at org.apache.spark.sql.execution.SparkPlan$$anonfun$executeQuery$1.apply(SparkPlan.scala:136) at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151) at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:133) at org.apache.spark.sql.execution.SparkPlan.executeBroadcast(SparkPlan.scala:124) at org.apache.spark.sql.execution.joins.BroadcastHashJoinExec.prepareBroadcast(BroadcastHashJoinExec.scala:98) at org.apache.spark.sql.execution.joins.BroadcastHashJoinExec.codegenSemi(BroadcastHashJoinExec.scala:318) at org.apache.spark.sql.execution.joins.BroadcastHashJoinExec.doConsume(BroadcastHashJoinExec.scala:84) at org.apache.spark.sql.execution.CodegenSupport$class.consume(WholeStageCodegenExec.scala:153) at org.apache.spark.sql.execution.FilterExec.consume(basicPhysicalOperators.scala:79) at org.apache.spark.sql.execution.FilterExec.doConsume(basicPhysicalOperators.scala:194) at org.apache.spark.sql.execution.CodegenSupport$class.consume(WholeStageCodegenExec.scala:153) at org.apache.spark.sql.execution.RowDataSourceScanExec.consume(ExistingRDD.scala:150) at org.apache.spark.sql.execution.RowDataSourceScanExec.doProduce(ExistingRDD.scala:217) at org.apache.spark.sql.execution.CodegenSupport$$anonfun$produce$1.apply(WholeStageCodegenExec.scala:83) at org.apache.spark.sql.execution.CodegenSupport$$anonfun$produce$1.apply(WholeStageCodegenExec.scala:78) at org.apache.spark.sql.execution.SparkPlan$$anonfun$executeQuery$1.apply(SparkPlan.scala:136) at org.apache.spark.rdd.RDDOperationScope$.withScope(RDDOperationScope.scala:151) at org.apache.spark.sql.execution.SparkPlan.executeQuery(SparkPlan.scala:133) at org.apache.spark.sql.execution.CodegenSupport$class.produce(WholeStageCodegenExec.scala:78) at org.apache.spark.sql.execution.RowDataSourceScanExec.produce(ExistingRDD.scala:150) at org.apache.spark.sql.execution.FilterExec.doProduce(basicPhysicalOperators.scala:113) at org.apache.spark.sql.execution.CodegenSupport$$anonfun$produce$1.apply(WholeStageCodegenExec.scala:83) at org.apache.spark.sql.execution.CodegenSupport$$anonfun$produce$1.apply(WholeStageCodegenExec.scala:78) at org.apache.spark.sql.e