首页 \ 问答 \ 运行Cucumber时如何监控垃圾回收?(How to monitor garbage collection when running Cucumber?)

运行Cucumber时如何监控垃圾回收?(How to monitor garbage collection when running Cucumber?)

我试图获得Ruby Cucumber的详细GC信息,就像我可以用于JVM一样。 但我不知道该怎么办。 我见过GC.collectionsGC.dump但我不知道如何使用它们。 如果任何人遇到同样的问题,请通知我如何获取GC转储或GC统计数据或详细的GC进行黄瓜测试。


I was trying to get verbose GC information for Ruby Cucumber like I can for the JVM. But I am not sure how to proceed. I have seen GC.collections , GC.dump but I am not sure how to use them. If any one has faced the same issue then please inform me how to get GC dump or GC statistics or verbose GC for Cucumber tests.


原文:https://stackoverflow.com/questions/24444415
更新时间:2023-09-03 12:09

最满意答案

根据设计,Spark 转换是惰性的,您必须使用操作才能从中检索具体值。

例如,以下转换将始终保持惰性:

JavaRDD<String> lines = sc.textFile("data.txt");
JavaRDD<Integer> lineLengths = lines.map(s -> s.length());

map返回RDD这样的函数,你只能通过执行诸如reduce动作将这些RDD转换为实际值:

int totalLength = lineLengths.reduce((a, b) -> a + b);

没有标志会使map返回一个具体值(例如,整数列表)。

最重要的是,你可以使用collect或任何其他Spark动作来“防止变形的懒惰”:

JavaRDD<String> lines = sc.textFile("data.txt");
JavaRDD<Integer> lineLengths = lines.map(s -> s.length());
List<Integer> collectedLengths = lineLengths.collect()

但请记住,在大型数据集上使用collect可能是一个非常糟糕的做法,使您的驱动程序内存不足。


By design, Spark transformations are lazy, and you must use an action in order to retrieve a concrete value out of them.

For example, the following transformations will always remain lazy:

JavaRDD<String> lines = sc.textFile("data.txt");
JavaRDD<Integer> lineLengths = lines.map(s -> s.length());

Functions like map return RDDs, and you can only turn those RDDs into real values by performing actions, such as reduce:

int totalLength = lineLengths.reduce((a, b) -> a + b);

There is no flag that will make map return a concrete value (for example, a list of integers).

The bottom line is that you can use collect or any other Spark action to 'prevent the laziness' of a transformation:

JavaRDD<String> lines = sc.textFile("data.txt");
JavaRDD<Integer> lineLengths = lines.map(s -> s.length());
List<Integer> collectedLengths = lineLengths.collect()

Remember, though, the using collect on a large dataset will probably be a very bad practice, making your driver run out of memory.

相关问答

更多
  • 简化一些事情RDDs是描述谱系的递归数据结构。 每个RDD都有一组依赖项,并在特定的上下文中computed 。 传递给Spark动作和转换的函数是第一类对象,可以作为闭包的一部分进行存储,分配,传递和捕获,并且没有理由(更不用说手段)来存储源代码。 RDD属于Driver ,并不等同于数据。 当在工作人员上访问数据时,RDD早已消失,唯一重要的是给定任务。 Simplifying things a little bit RDDs are recursive data structures which de ...
  • 根据设计,Spark 转换是惰性的,您必须使用操作才能从中检索具体值。 例如,以下转换将始终保持惰性: JavaRDD lines = sc.textFile("data.txt"); JavaRDD lineLengths = lines.map(s -> s.length()); 像map返回RDD这样的函数,你只能通过执行诸如reduce动作将这些RDD转换为实际值: int totalLength = lineLengths.reduce((a, b) -> a ...
  • 它存储在内存中吗? 当你通过一个动作 ( count , print , foreach )运行一个spark变换,然后,只有这样你的图形才会被实现,在你的情况下,文件正被消耗。 RDD.cache旨在确保sc.textFile("testfile.csv")的结果在内存中可用,并且不需要再次读取。 不要将变量与幕后执行的实际操作混淆。 缓存允许您重新迭代数据,确保它在内存中(如果有足够的内存将其全部存储在其中)如果您想重新迭代所述RDD,并且只要您设置了正确的数据存储级别 (默认为StorageLevel ...
  • 好吧,从谷歌阅读StackOverflow问题,博客和邮件档案后。 我发现了.union()和其他转换是如何工作的,以及如何管理分区。 当我们使用.union() ,生成的RDD以及排序会丢失分区信息,这就是为什么我的输出序列没有得到维护。 我为克服这个问题所做的就是给唱片编号 Header = 1,Body = 2,Footer = 3 所以在RDD上使用sortBy ,它是所有三个的联合我用这个订单号和1个分区对它进行了排序。 然后使用密钥作为文件名写入多个文件我使用HashPartitioner,以便 ...
  • 问题:例如,在过滤操作中,如何创建新的RDD而不将RDD实际加载到内存中并进行处理? Apache Spark中的转换过程: 例如: firstRDD=spark.textFile("hdfs://...") secondRDD=firstRDD.filter(someFunction); thirdRDD = secondRDD.map(someFunction); result = thirdRDD.count() 由于RDD是通过一组转换创建的, 它会记录这些转换,而不是实际数据 (这就像我们 ...
  • 当您编写使用mapPartition或foreachPartition的Spark作业时,您可以只修改分区数据本身,或者分别遍历分区数据。 作为参数传递的匿名函数将在执行器上执行,因此没有可行的方法来执行调用所有节点的代码,例如:来自一个特定执行器的df.reduceByKey。 该代码只能从驱动程序节点执行。 因此只有从驱动程序代码中才能访问数据框,数据集和spark会话。 请在这里找到关于这个问题和可能的解决方案的详细讨论 When you write Spark jobs that uses eith ...
  • Spark使用弹性分布式数据集(RDD),它表示一组数据。 Spark可以将其存储在分布式内存中。 正如你所提到的,RDD是建立在DAG中的。 在你的情况下: 在第一个操作中,计算来自DAG的计算,并导致RDD。 在第3步中,将此新创建的RDD用作新DAG的输入。 在步骤4中,计算该DAG,并导致最终的RDD。 Spark uses Resilient Distributed Datasets (RDD), which represent a collection of data. Spark can st ...
  • 我认为你并没有真正理解treeAggregate operation 。 在你张贴图片后,让我thorough description你的问题。 之后,你会明白为什么源代码可以正确地匹配事物! 如果你发现treeAggregate混淆,你可以先理解它的简单但相似的版本 - aggregate 。 聚合的原型是: def aggregate[U](zeroValue: U)(seqOp: (U, T) ⇒ U, combOp: (U, U) ⇒ U)(implicit arg0: ClassTag[U]): ...
  • 我从来没有使用过Squoop,但答案可能取决于你的使用案例。 对于您想要从Spark查询某些关系SQL数据的单个作业,您应该只使用内置的JDBC连接器。 这就是分析数据库的重点:它是一种以统一结构存储大量记录的方式,可以快速准确地查询。 如果您的SQL数据库和Spark集群之间存在网络限制,并且在结果数据集中运行了大量作业,并且尝试最小化对数据库的请求,那么首先传输数据可能是有意义的。 一个可能值得构建复制任务的实际示例(听起来它不适用于您的情况)可能是您的数据库和群集位于不同的防火墙后面。 另一个说明。 ...
  • 答案是使用spark中的函数explode 。 The answer was to use the function explode in spark.

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。