title: Insert through parallel thread of dataframe in Cassandra
body: <p>I have following code :-</p>
  
  <pre><code>collection.foreachRDD(rdd =&gt;
    {
      if (!rdd.partitions.isEmpty) {
        println("RDD collected")
        try {
          val dfs = rdd.toDF()
   dfs.write.format("org.apache.spark.sql.cassandra").options(Map("table" -&gt; "table", "keyspace" -&gt; "db", "cluster" -&gt; "Test Cluster"))
            .mode(SaveMode.Append).save()
        } catch {
          case e: Exception =&gt; e.printStackTrace
        }
        println("Written to cassandra")
      } else {
        println("blank rdd")
      }
    })
  </code></pre>
  
  <p>Now, I'm looking for a solution where I can write to Cassandra in parallel using thread or whatever because my write is very very slow it is going at around 2000-2200 per second. Thanks,</p>