【问题标题】:Writing large Spark dataframes to Cassandra - Performance Tuning将大型 Spark 数据帧写入 Cassandra - 性能调优
【发布时间】:2017-10-11 18:01:33
【问题描述】:

我在 Spark 2.1.0 / Cassandra 3.10 集群(4 台机器 * 12 核 * 256 RAM * 2 SSD)上工作,并且在使用向 Cassandra 写入特定大数据帧的性能方面挣扎了很长时间spark-cassandra-connector 2.0.1.

这是我的表的架构

CREATE TABLE sample_table (
        hash blob,
        field1 int,
        field2 int,
        field3 boolean,
        field4 bigint,
        field5 bigint,
        field6 list<FROZEN<some_type>>,
        field7 list<FROZEN<some_other_type>>,
        PRIMARY KEY (hash)
);

用作主键的哈希是256位的;列表字段包含最多 1MB 的某些结构化类型的数据。我总共需要写几亿行。

目前我正在使用以下写入方法:

  def storeDf(df: Dataset[Row]) = {
    df.write
      .cassandraFormat(sample_table, sample_keyspace)
      .options(
          WriteConf.ConsistencyLevelParam.option(ConsistencyLevel.ANY)
      )
      .save
  }

...Spark 使用 48 个并行任务写入数据帧,每个任务写入大约 48 个并行任务。 1.2h 95MB,这当然不是我想要的。

我很感激有关如何调整写入性能和/或可能在这种设置中修改我的架构的建议。在一个分区内通过哈希和排序进行重新分区有意义吗?

谢谢!

【问题讨论】:

    标签: apache-spark cassandra spark-cassandra-connector


    【解决方案1】:

    您可以参考此blog 进行 Spark-Cassandra 连接器调优。您将对可以预期的性能数字有所了解。您还可以尝试另一个开源产品 SnappyData,它是 Spark 数据库,它将在您的用例中为您提供非常高的性能。

    【讨论】:

      猜你喜欢
      • 2020-09-27
      • 2020-07-17
      • 2016-07-12
      • 2020-03-24
      • 1970-01-01
      • 2016-05-14
      • 2019-03-04
      • 1970-01-01
      • 2018-08-13
      相关资源
      最近更新 更多