Finally, this can be further optimized by reusing connection objects across multiple RDDs/batches. One can maintain a static pool of connection objects than can be reused as RDDs of multiple batches are pushed to the external system, thus further reducing the overheads.

Scala
Python
dstream.foreachRDD { rdd =>
rdd.foreachPartition { partitionOfRecords =>
// ConnectionPool is a static, lazily initialized pool of connections
val connection = ConnectionPool.getConnection()
partitionOfRecords.foreach(record => connection.send(record))
ConnectionPool.returnConnection(connection) // return to the pool for future reuse
}
}

http://spark.apache.org/docs/1.6.1/streaming-programming-guide.html#output-operations-on-dstreams

output-operations-on-dstreams的更多相关文章

  1. No output operations registered, so nothing to execute

    SparkStreaming和KafKa结合报错!报错之前代码如下: object KafkaWordCount{ val updateFunc = (iter:Iterator[(String,Se ...

  2. 2、 Spark Streaming方式从socket中获取数据进行简单单词统计

    Spark 1.5.2 Spark Streaming 学习笔记和编程练习 Overview 概述 Spark Streaming is an extension of the core Spark ...

  3. Spark Streaming编程指南

    Overview A Quick Example Basic Concepts Linking Initializing StreamingContext Discretized Streams (D ...

  4. 通过Spark Streaming的foreachRDD把处理后的数据写入外部存储系统中

    转载自:http://blog.csdn.net/erfucun/article/details/52312682 本博文主要内容包括: 技术实现foreachRDD与foreachPartition ...

  5. Spark的Streaming和Spark的SQL简单入门学习

    1.Spark Streaming是什么? a.Spark Streaming是什么? Spark Streaming类似于Apache Storm,用于流式数据的处理.根据其官方文档介绍,Spark ...

  6. Spark Streaming笔记

    Spark Streaming学习笔记 liunx系统的习惯创建hadoop用户在hadoop根目录(/home/hadoop)上创建如下目录app 存放所有软件的安装目录 app/tmp 存放临时文 ...

  7. Spark Streaming核心概念与编程

    Spark Streaming核心概念与编程 1. 核心概念 StreamingContext Create StreamingContext import org.apache.spark._ im ...

  8. Spark之 Spark Streaming流式处理

    SparkStreaming Spark Streaming类似于Apache Storm,用于流式数据的处理.Spark Streaming有高吞吐量和容错能力强等特点.Spark Streamin ...

  9. Spark Streaming - DStream

    1 Overview Spark Streaming is an extension of the core Spark API that enables scalable, high-through ...

  10. <译>Spark Sreaming 编程指南

    Spark Streaming 编程指南 Overview A Quick Example Basic Concepts Linking Initializing StreamingContext D ...

随机推荐

  1. IE6,IE7浏览器下 margin 无效的解决方法

    今天有时间,所以特意做了一个测试. 复制代码 代码如下: <style type="text/css"> .test-1,.test-2{border:5px soli ...

  2. Oracle 12C -- purge dba_recyclebin

    SQL> create user abce identified by abce; User created. SQL> grant resource,connect to abce; G ...

  3. pthread编译时报错的解决方法

    最近在学习POSIX thread编程,今天编译一个程序报如下错误: /tmp/ccXH8mJy.o:在函数‘main’中:deadlock.c:(.text+0xbb):对‘pthread_crea ...

  4. 转: springboot2.0下hystrix.stream 404

    springboot2.0下hystrix dashboard Unable to connect to Command Metric Stream解决办法https://blog.csdn.net/ ...

  5. activiti 6 查询api

    1 activiti 查询多字段排序 每个字段都要有 sortBy -> desc/asc [sortBy -> desc/asc] [sortBy -> desc/asc] 2 使 ...

  6. OAuth 2.0介绍

    简介 OAuth是一个关于授权(authorization)的开放网络标准,在全世界得到广泛应用,目前的版本是2.0版. 一.应用场景 为了理解OAuth的适用场合,让我举一个假设的例子. 有一个&q ...

  7. c# vs2010 excel 上传oracle数据

    excel 数据表上传到oracle数据库.过程例如以下: 1.打开本地excel文件 2.用OleDb连接excel文件 3.将来excel的数据读取到dataset中 4.把dataset 中数据 ...

  8. Spring boot 通用配置文件模板

    # =================================================================== # COMMON SPRING BOOT PROPERTIE ...

  9. Atitit 架构的原则attilax总结

    Atitit 架构的原则attilax总结 1.1. Rule of three称为"三次原则",指的是当某个功能第三次出现时,才进行"抽象化".是DRY原则和 ...

  10. Chrome浏览器查看 iframe信息 OpenFrame

    https://chrome.google.com/webstore/search/openframe?hl=zh-CN&_category=extensions 搜索 OpenFrame 添 ...