【问题标题】:DataStax Enterprise: Spark Cassandra Batch SizeDataStax Enterprise:Spark Cassandra 批量大小
【发布时间】:2015-01-18 07:15:38
【问题描述】:

我在我的 SparkConf 中将参数 spark.cassandra.output.batch.size.rows 设置如下:

val conf = new SparkConf(true)
        .set("spark.cassandra.connection.host", "host")
        .set("spark.cassandra.auth.username", "cassandra")            
        .set("spark.cassandra.auth.password", "cassandra")
        .set("spark.cassandra.output.batch.size.rows", "5120")
        .set("spark.cassandra.output.concurrent.writes", "10")

但是当我执行时

saveToCassandra("data","ten_days")

我继续在我的 system.log 中看到警告

NFO [FlushWriter:7] 2014-11-20 11:11:16,498 Memtable.java (line 395) Completed flushing /var/lib/cassandra/data/system/hints/system-hints-jb-76-Data.db (5747287 bytes) for commitlog position ReplayPosition(segmentId=1416480663951, position=44882909)
 INFO [FlushWriter:7] 2014-11-20 11:11:16,499 Memtable.java (line 355) Writing Memtable-ten_days@1656582530(32979978/329799780 serialized/live bytes, 551793 ops)
 WARN [Native-Transport-Requests:761] 2014-11-20 11:11:16,499 BatchStatement.java (line 226) Batch of prepared statements for [data.ten_days] is of size 36825, exceeding specified threshold of 5120 by 31705.
 WARN [Native-Transport-Requests:777] 2014-11-20 11:11:16,500 BatchStatement.java (line 226) Batch of prepared statements for [data.ten_days] is of size 36813, exceeding specified threshold of 5120 by 31693.
 WARN [Native-Transport-Requests:822] 2014-11-20 11:11:16,501 BatchStatement.java (line 226) Batch of prepared statements for [data.ten_days] is of size 36823, exceeding specified threshold of 5120 by 31703.
 WARN [Native-Transport-Requests:835] 2014-11-20 11:11:16,500 BatchStatement.java (line 226) Batch of prepared statements for [data.ten_days] is of size 36817, exceeding specified threshold of 5120 by 31697.
 WARN [Native-Transport-Requests:781] 2014-11-20 11:11:16,501 BatchStatement.java (line 226) Batch of prepared statements for [data.ten_days] is of size 36817, exceeding specified threshold of 5120 by 31697.
 WARN [Native-Transport-Requests:755] 2014-11-20 11:11:16,501 BatchStatement.java (line 226) Batch of prepared statements for [data.ten_days] is of size 36822, exceeding specified threshold of 5120 by 31702.

我知道这只是警告,但我想了解为什么我的设置没有按预期工作。然后我可以在我的集群中看到很多提示。批量大小会影响集群中的提示数量吗?

谢谢

【问题讨论】:

    标签: cassandra apache-spark datastax-enterprise


    【解决方案1】:

    您设置了批量大小的行而不是批量大小的字节。这意味着连接器限制了行数,而不是批处理的内存大小。

    spark.cassandra.output.batch.size.rows:每单行数 批;默认为“自动”,这意味着连接器将调整 基于每行数据量的行数

    spark.cassandra.output.batch.size.bytes:最大总大小 以字节为单位的批处理;默认为 64 kB。

    https://github.com/datastax/spark-cassandra-connector/blob/master/doc/5_saving.md

    更重要的一点是,使用更大的批处理大小 (64kb) 并更改 cassandra.yaml 文件中的警告限制很可能会更好。

    编辑:

    最近我们发现,较大的批次可能会导致某些 C* 配置不稳定,因此如果系统变得不稳定,请降低该值。

    【讨论】:

    • 先生,我在将 2.04 亿条记录写入 cassandra 时遇到了类似的问题,这需要 24 小时,我只是从 oracle 获取数据帧并将其放入 C* .... 请帮助我应该怎么做周?下面是我的 cassandra 配置
    • ,spark.cassandra.output.concurrent.writes=2 spark.cassandra.output.batch.size.rows=1
    • 我们可以将 Eclipse 中的 C* args 作为 VM args 传递吗?如果是这样怎么办??样品请
    猜你喜欢
    • 1970-01-01
    • 2015-05-18
    • 2017-05-10
    • 2020-08-27
    • 2015-01-04
    • 2016-01-22
    • 2021-08-20
    • 2020-09-27
    • 1970-01-01
    相关资源
    最近更新 更多