checkpoint

二、SparkCore

安稳与你 提交于 2019-12-04 13:56:12
第1章 RDD概述 1.1 什么是RDD RDD(Resilient Distributed Dataset)叫做弹性分布式 数据集 ,是Spark中最基本的数据(计算)抽象。代码中是一个抽象类,它代表一个不可变、可分区、里面的元素可并行计算的集合。 分布式:数据的来源 数据集:数据的类型&计算类型的封装(数据模型) 弹性: 不可变:计算逻辑不可变 可分区:提高数据处理能力 并行计算:多任务同时执行 1.2 RDD的属性 一组分区(Partition),即数据集的基本组成单位; 一个计算每个分区的函数; RDD之间的依赖关系; 一个Partitioner,即RDD的分片函数; 一个列表,存储存取每个Partition的优先位置(preferred location)。 1.3 RDD特点 RDD表示 只读 的分区的数据集,对RDD进行改动,只能通过RDD的转换操作,由一个RDD得到一个新的RDD,新的RDD包含了从其他RDD衍生所必需的信息。RDDs之间存在依赖,RDD的执行是按照血缘关系 延时计算 的。如果血缘关系较长,可以通过持久化RDD来切断血缘关系。 1.3.1 分区 RDD逻辑上是分区的,每个分区的数据是抽象存在的,计算的时候会通过一个 compute 函数得到每个分区的数据**。 如果RDD是通过已有的文件系统构建,则compute函数是 读取指定文件系统中的数据 ,

How to manually perform checkpoint in SQLite android?

霸气de小男生 提交于 2019-12-04 12:03:12
I'm trying to create a backup of my sqlite database and I want to flush the content of the WAL file in the db first. Here is my SQLiteOpenHelper: public class MyDBHelper extends SQLiteOpenHelper { private Context mContext; private static MyDBHelper mInstance = null; private MyDBHelper(final Context context, String databaseName) { super(new MYDB(context), databaseName, null, DATABASE_VERSION); this.mContext = context; } @Override public void onCreate(SQLiteDatabase db) { } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } public static MyDBHelper getInstance

PostgreSQL 参数调整(性能优化)

别说谁变了你拦得住时间么 提交于 2019-12-04 10:26:08
昨天分别在外网和无外网环境下安装PostgreSQL,有外网环境下安装的相当顺利。但是在无外网环境下就是两个不同的概念了,可谓十有八折。感兴趣的同学可以搭建一下。 PostgreSQL安装完成后第一件事便是做相关测试,然后调整参数。 /*CPU 查看CPU型号*/ cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c /*查看物理CPU个数*/ cat /proc/cpuinfo | grep "physical id" | sort -u | wc -l /*查看逻辑CPU个数*/ cat /proc/cpuinfo | grep "processor" | wc -l /*查看CPU内核数*/ cat /proc/cpuinfo | grep "cpu cores" | uniq /*查看单个物理CPU封装的逻辑CPU数量*/ cat /proc/cpuinfo | grep "siblings" | uniq /*计算是否开启超线程 ##逻辑CPU > 物理CPU x CPU核数 #开启超线程 ##逻辑CPU = 物理CPU x CPU核数 #没有开启超线程或不支持超线程*/ /*查看是否超线程,如果cpu cores数量和siblings数量一致,则没有启用超线程,否则超线程被启用。*/ cat /proc

pg几个重要的参数调优

[亡魂溺海] 提交于 2019-12-03 22:54:07
介绍 pg数据库在不同的业务场景下,参数最好也需要进行针对的调整。默认值是在确保资源消耗最小的情况下,pg都能够运行起来,不会导致任何致命性的威胁。而实际中,默认的参数需要进行优化来达到性能的最大化,本文介绍一些常用的参数配置。 参数 pg数据库默认安装完后在data目录会有一个postgresql.conf文件,这个里面有非常多的参数来配置数据库。 shared_buffers PostgreSQL既使用自身的缓冲区,也使用内核缓冲IO。这意味着数据会在内存中存储两次,首先是存入PostgreSQL缓冲区,然后是内核缓冲区。这被称为双重缓冲区处理。对大多数操作系统来说,这个参数是最有效的用于调优的参数。此参数的作用是设置PostgreSQL中用于缓存的专用内存量。 shared_buffers的默认值设置得非常低,因为某些机器和操作系统不支持使用更高的值。但在大多数现代设备中,通常需要增大此参数的值才能获得最佳性能。 建议的设置值为机器总内存大小的25%,但是也可以根据实际情况尝试设置更低和更高的值。实际值取决于机器的具体配置和工作的数据量大小。举个例子,如果工作数据集可以很容易地放入内存中,那么可以增加shared_buffers的值来包含整个数据库,以便整个工作数据集可以保留在缓存中。 在生产环境中,将shared_buffers设置为较大的值通常可以提供非常好的性能

SQL Server checkpoints

时光毁灭记忆、已成空白 提交于 2019-12-03 14:59:31
can anyone explain when SQL Server issues a checkpoint? Eric from: http://msdn.microsoft.com/en-us/library/ms188748.asp Events That Cause Checkpoints Before a database backup, the Database Engine automatically performs a checkpoint so that all changes to the database pages are contained in the backup. In addition, checkpoints occur automatically when either of the following conditions occur: The active portion of the log exceeds the size that the server could recover in the amount of time specified in the recovery interval server configuration option. The log becomes 70 percent full, and the

MobileNet-v2 pytorch 代码实现

99封情书 提交于 2019-12-03 10:13:39
MobileNet-v2 pytorch 代码实现 标签(空格分隔): Pytorch 源码 MobileNet-v2 pytorch 代码实现 主函数 model.py inverted_residual_sequence、InvertedResidualBlock、conv2d_bn_relu6 train.py 总结 主函数 import torch.backends.cudnn as cudnn from cifar10data import CIFAR10Data from model import MobileNetV2 from train import Train from utils import parse_args, create_experiment_dirs def main () : # Parse the JSON arguments config_args = parse_args() # Create the experiment directories _, config_args.summary_dir, config_args.checkpoint_dir = create_experiment_dirs( config_args.experiment_dir) model = MobileNetV2(config_args) #建立图模型

java.lang.IllegalStateException: Error reading delta file, spark structured streaming with kafka

跟風遠走 提交于 2019-12-03 08:56:10
I am using Structured Streaming + Kafka for realtime data analytics in our project. I am using Spark 2.2, kafka 0.10.2. I am facing an issue during streaming query recovery from checkpoint at application startup. As there are multiple streaming queries derived from a single kafka streaming point and there are different checkpint directories for every streaming query. So in case of job failure, when we restart the job there are some streaming queries which fails to recover from checkpoint location hence throw an exception of Error reading delta file . Here are the logs : Job aborted due to

图像识别模型

£可爱£侵袭症+ 提交于 2019-12-03 07:31:22
一、数据准备    首先要做一些数据准备方面的工作:一是把数据集切分为训练集和验证集, 二是转换为tfrecord 格式。在data_prepare/文件夹中提供了会用到的数据集和代码。首先要将自己的数据集切分为训练集和验证集,训练集用于训练模型, 验证集用来验证模型的准确率。这篇文章已经提供了一个实验用的卫星图片分类数据集,这个数据集一共6个类别, 见下表所示       在data_prepare目录中,有一个pic文件夹保存原始的图像文件,这里面有train 和validation 两个子目录,分别表示训练使用的图片和验证使用的图片。在每个目录中,分别以类别名为文件夹名保存所有图像。在每个类别文件夹下,存放的就是原始的图像(如jpg 格式的图像文件)。下面在data_prepare 文件夹下,使用预先编制好的脚本data_convert .py,使用以下命令将图片转换为为tfrecord格式。 python data_convert.py   data_convert.py代码中的一些参数解释为: # -t pic/: 表示转换pic文件夹中的数据。pic文件夹中必须有一个train目录和一个validation目录,分别代表训练和验证数据集。 #–train-shards 2:将训练数据集分成两块,即最后的训练数据就是两个tfrecord格式的文件。如果自己的数据集较大

大数据-SparkStreaming

北城余情 提交于 2019-12-03 03:43:26
SparkStreaming SparkStreaming是一种 微批处理 ,准实时的流式框架。数据来源包括:Kafka, Flume,TCP sockets,Twitter,ZeroMQ等 SparkStreaming与storm的区别: SparkStreaming微批处理数据,storm按条处理数据 SparkStreaming支持稍复杂的逻辑 SparkStreaming与storm都支持资源动态调整和事务机制 SparkStreaming的处理架构:采用recevier task持续拉取数据,拉取时间间隔为batch Interval,每次来去的数据封装为batch,batch被封装到RDD中,RDD被封装进DStream中。SparkStreaming对DStream进程处理。 数据处理与数据拉取同时进行,数据处理的速度需要与数据拉取量均衡,数据存储方式为memory_only,若数据处理速度慢于拉取速度会产生数据堆积,进而导致OOM。若数据存储方式包含disk,会加大延迟 代码实现 使用TCP sockets实现测试,liunx中命令:nc -lk 9999 实现模拟向9999端口发数据。 数据拉取的间隔时长 + sparkconf/sparkcontext => JavaStreamingContext (stream上下文) 数据源配置 + stream上下文 =

How to checkpoint DataFrames?

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm looking for a way to checkpoint DataFrames. Checkpoint is currently an operation on RDD but I can't find how to do it with DataFrames. persist and cache (which are synonyms for each other) are available for DataFrame but they do not "break the lineage" and are thus unsuitable for methods that could loop for hundreds (or thousands) of iterations. As an example, suppose that I have a list of functions whose signature is DataFrame => DataFrame. I want to have a way to compute the following even when myfunctions has hundreds or thousands of