Apache Spark或Spark-Cassandra-Connector看起来不像并行读取多个分区?

时间:2016-11-25 03:21:54

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

Apache Spark或Spark-Cassandra-Connector看起来并不像是并行读取多个分区。

这是我的代码使用spark-shell

    private void ComboBox_SelectedIndexChanged(object sender, EventArgs e)
    {
        DescriptionTextBox.Text = dt.Rows[ComboBox.SelectedIndex][1].ToString();
    }

我每行大约有7亿行,大约是1KB,这行

import org.apache.spark.sql._ import org.apache.spark.sql.types.StringType spark.sql("""CREATE TEMPORARY VIEW hello USING org.apache.spark.sql.cassandra OPTIONS (table "hello", keyspace "db", cluster "Test Cluster", pushdown "true")""") val df = spark.sql("SELECT test from hello") val df2 = df.select(df("test").cast(StringType).as("test")) val rdd = df2.rdd.map { case Row(j: String) => j } val df4 = spark.read.json(rdd) // This line takes forever 需要永远,因为我得到以下输出。

第1阶段:==========> (4866 + 24)/ 25256]

所以在这个速度下它可能需要大约3小时。

我使用iftop测量了火花工作者节点的网络吞吐率,它大约是75MB / s(每秒兆字节),这是相当不错的但是我不确定它是否并行读取分区。关于如何加快速度的任何想法?

这是我的DAG。

enter image description here

enter image description here

enter image description here

0 个答案:

没有答案