{"id":225,"date":"2009-06-16T09:16:09","date_gmt":"2009-06-16T14:16:09","guid":{"rendered":"http:\/\/blog.espol.edu.ec\/hadoop\/?p=225"},"modified":"2009-06-16T09:16:09","modified_gmt":"2009-06-16T14:16:09","slug":"tip-de-rendimiento-reutilizar-la-jvm-entre-tareas-map","status":"publish","type":"post","link":"https:\/\/blog.espol.edu.ec\/hadoop\/2009\/06\/16\/tip-de-rendimiento-reutilizar-la-jvm-entre-tareas-map\/","title":{"rendered":"Tip de rendimiento: reutilizar la JVM entre tareas Map"},"content":{"rendered":"<p>En un e-mail de la lista core-user de hadoop, alguien <a href=\"http:\/\/mail-archives.apache.org\/mod_mbox\/hadoop-core-user\/200906.mbox\/%3c200906160811002813968@gmail.com%3e\">pregunt\u00f3<\/a> lo siguiente:<\/p>\n<blockquote><p>Subject:\u00a0Can I share datas for several map tasks?<br \/>\nHi,<br \/>\nI want to share some data structures for the map tasks on a same node(not through files), I mean, if one map task has already initialized some data structures (e.g. an array or a list), can other map tasks share these memorys and directly access them, for I don't want to reinitialize these datas and I want to save some memory. Can hadoop help me do this?<\/p><\/blockquote>\n<p><a href=\"http:\/\/mail-archives.apache.org\/mod_mbox\/hadoop-core-user\/200906.mbox\/%3ca757a1c00906151828r326d6e9an62bf1022ad8caa55@mail.gmail.com%3e\">Eason.Lee sugiri\u00f3<\/a>:<\/p>\n<blockquote><p>I think you can just define the data structures in your map classinit it in<br \/>\nsetup(Context context) and use it in your map method<br \/>\nhope it is helpful!<\/p><\/blockquote>\n<p>Pero si lo que se quiere es que los mappers que se levanten en el mismo nodo re-utilicen la estructura de datos creada por el primer Map task levantado en ese nodo, entonces la soluci\u00f3n\u2014<a href=\"http:\/\/mail-archives.apache.org\/mod_mbox\/hadoop-core-user\/200906.mbox\/%3c2C52DBBEC4855C438BB330CB0D3B465903BFACFD@SNV-EXVS01.ds.corp.yahoo.com%3e\">planteada por Sharad Agarwal de Yahoo!<\/a>\u2014es re-utilizar la JVM:<\/p>\n<blockquote><p>You can enable jvm reuse across tasks. See mapred.job.reuse.jvm.num.tasks in mapred-default.xml for usage. Then you can cache the data in a static variable in your mapper.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>En un e-mail de la lista core-user de hadoop, alguien pregunt\u00f3 lo siguiente: Subject:\u00a0Can I share datas for several map tasks? Hi, I want to share some data structures for the map tasks on a same node(not through files), I mean, if one map task has already initialized some data structures (e.g. an array or [&hellip;]<\/p>\n","protected":false},"author":1510,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[945,852],"tags":[2860,7885,5939],"class_list":["post-225","post","type-post","status-publish","format-standard","hentry","category-desarrollo","category-educacion","tag-hadoop","tag-jvm","tag-mapreduce"],"_links":{"self":[{"href":"https:\/\/blog.espol.edu.ec\/hadoop\/wp-json\/wp\/v2\/posts\/225","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.espol.edu.ec\/hadoop\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.espol.edu.ec\/hadoop\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/hadoop\/wp-json\/wp\/v2\/users\/1510"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/hadoop\/wp-json\/wp\/v2\/comments?post=225"}],"version-history":[{"count":2,"href":"https:\/\/blog.espol.edu.ec\/hadoop\/wp-json\/wp\/v2\/posts\/225\/revisions"}],"predecessor-version":[{"id":227,"href":"https:\/\/blog.espol.edu.ec\/hadoop\/wp-json\/wp\/v2\/posts\/225\/revisions\/227"}],"wp:attachment":[{"href":"https:\/\/blog.espol.edu.ec\/hadoop\/wp-json\/wp\/v2\/media?parent=225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/hadoop\/wp-json\/wp\/v2\/categories?post=225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.espol.edu.ec\/hadoop\/wp-json\/wp\/v2\/tags?post=225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}