Hadoop HPROF分析报告未写入CPU样本。

3

我希望使用HPROF对我的Hadoop作业进行剖析。问题在于,我获得了TRACES,但在profile.out文件中没有CPU SAMPLES。我在运行方法内部使用的代码是:

    /** Get configuration */
    Configuration conf = getConf();
    conf.set("textinputformat.record.delimiter","\n\n");
    conf.setStrings("args", args);

    /** JVM PROFILING */
    conf.setBoolean("mapreduce.task.profile", true);
    conf.set("mapreduce.task.profile.params", "-agentlib:hprof=cpu=samples," +
       "heap=sites,depth=6,force=n,thread=y,verbose=n,file=%s");
    conf.set("mapreduce.task.profile.maps", "0-2");
    conf.set("mapreduce.task.profile.reduces", "");

    /** Job configuration */
    Job job = new Job(conf, "HadoopSearch");
    job.setJarByClass(Search.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(NullWritable.class);

    /** Set Mapper and Reducer, use identity reducer*/
    job.setMapperClass(Map.class);
    job.setReducerClass(Reducer.class);

    /** Set input and output formats */
    job.setInputFormatClass(TextInputFormat.class);
    job.setOutputFormatClass(TextOutputFormat.class);

    /** Set input and output path */
    FileInputFormat.addInputPath(job, new Path("/user/niko/16M"));  
    FileOutputFormat.setOutputPath(job, new Path(cmd.getOptionValue("output")));

    job.waitForCompletion(true);

    return 0;

我该如何让输出中显示 CPU SAMPLES
此外,我在 stderr 中看到一条奇怪的错误消息,但我认为它与此无关,因为无论是关闭分析还是注释启用分析的代码时,该错误都存在。该错误消息为:
 log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.impl.MetricsSystemImpl).
 log4j:WARN Please initialize the log4j system properly.
 log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
2个回答

3

在你的任务完成后,Yarn(或MRv1)会杀死容器。 CPU采样无法写入到你的分析文件中。实际上,你的跟踪也应该被截断。

你需要添加以下选项(或者在你的Hadoop版本中等效的选项):

yarn.nodemanager.sleep-delay-before-sigkill.ms = 30000
# No. of ms to wait between sending a SIGTERM and SIGKILL to a container

yarn.nodemanager.process-kill-wait.ms = 30000
# Max time to wait for a process to come up when trying to cleanup a container

mapreduce.tasktracker.tasks.sleeptimebeforesigkill = 30000
# Same en MRv1 ?

(30秒似乎足够)


运行得十分顺利。 - Oleksandr Pryimak

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接