apache-spark - 为什么 spark 没有在多个节点上重新分配我的数据帧?

标签 apache-spark pyspark pyspark-sql

我有 128 个内核、8 个节点、每个节点 186Gb ram。

我有从 jdbc 源加载的数据帧 (Df)。它有一个分区。然后我打电话:

c = Df.repartition(128*3).cache().count()

应用程序 Web UI 显示缓存的 rdd 有 384 个分区,但都位于一个节点(我们称之为节点 1)上,内存大小为 57Mb。

当我查看计数阶段时,我看到 384 个任务,全部在节点 1 上执行。

为什么 Spark 没有在所有节点上均匀分布数据帧?

我在 pycharm 中运行它。这是我设置的配置值:
spark = SparkSession \
        .builder \
        .master("spark://sparkmaster:7087") \
        .appName(__SPARK_APP_NAME__) \
        .config("spark.executor.memory", "80g") \
        .config("spark.eventlog.enabled", "True") \
        .config("spark.eventlog.dir", r"C:\Temp\Athena\UAT\Logs") \
        .config("spark.cores.max", 128) \
        .config("spark.sql.crossJoin.enabled", "True") \
        .config("spark.executor.extraLibraryPath","/net/share/grid/bin/spark/UAT/bin/vertica-jdbc-8.0.0-0.jar") \
        .config("spark.serializer", "org.apache.spark.serializer.KryoSerializer") \
        .getOrCreate()

这是我的 Spark 属性

enter image description here

最佳答案

here we specify the details of the resources and the application details while submitting the application


./bin/spark-submit \
      --class org.apache.spark.examples.SparkPi \
      --master spark://207.184.161.138:7077 \
      --deploy-mode cluster \
      --supervise \
      --executor-memory 20G \
      --total-executor-cores 100 \
      /path/to/examples.jar \

关于apache-spark - 为什么 spark 没有在多个节点上重新分配我的数据帧?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40588373/

相关文章:

apache-spark - 为什么默认的 persist() 会将数据作为非序列化对象存储在 JVM 堆中?

java - 如何缓存分区数据集并在多个查询中使用?

apache-spark - pySpark Dataframe 上聚合的多个标准

python - 运行Spark时遇到 "WARN ProcfsMetricsGetter: Exception when trying to compute pagesize"错误

apache-spark - 由于 SparkContext 已关闭,作业 65 被取消

apache-spark - 如何在pyspark中使用foreach sink?

python - 声明 UDF 时 Spark 出错

scala - Apache Spark K-Means 集群 - 用于输入的 RDD

apache-spark - 在 PySpark 数据框中删除包含特定值的行

apache-spark - 一个多小时执行pyspark.sql.DataFrame.take(4)