MapReduce Interview Questions

  • (5.0)
If you're looking for MapReduce Interview Questions for Experienced or Freshers, you are at right place. There are lot of opportunities from many reputed companies in the world. According to research MapReduce average salary ranges from $112,373 to $141,521. So, You still have opportunity to move ahead in your career in MapReduce Development. Mindmajix offers Advanced MapReduce Interview Questions 2018 that helps you in cracking your interview & acquire dream career as MapReduce Developer.
Q. Brief on Hadoop Map Reduce?
MapReduce is a framework for processing big data (huge datasets using a large number of commodity computers). It processes the data in two phases namely Map and Reduces phase. This programming model is inherently parallel and can easily process large-scale data with the commodity hardware itself.
It is highly integrated with hadoop distributed file system for processing distributed across data nodes of clusters.
Interested in mastering MapReduce? Enroll now for FREE demo on MapReduce training
Q. What is YARN?
YARN stands for Yet Another Resource Negotiator which is also called as Next generation Mapreduce or Mapreduce 2 or MRv2.
It is implemented in hadoop 0.23 release to overcome the scalability short come of classic Mapreduce framework by splitting the functionality of Job tracker in Mapreduce frame work into Resource Manager and Scheduler.
Q. What is data serialization?
Serialization is the process of converting object data into byte stream data for transmission over a network across different nodes in a cluster or for persistent data storage.
Q. What is deserialization of data?
Deserialization is the reverse process of serialization and converts byte stream data into object data for reading data from HDFS. Hadoop provides Writables for serialization and deserialization purpose.
Q. What are the Key/Value Pairs in Mapreduce framework?
Mapreduce framework implements a data model in which data is represented as key/value pairs. Both input and output data to mapreduce framework should be in key/value pairs only.
Q. What are the constraints to Key and Value classes in Mapreduce?
Any data type that can be used for a Value field in a mapper or reducer must implement Interface to enable the field to be serialized and deserialized.
By default Key fields should be comparable with each other.  So, these must implement hadoop’ Interface which in turn extends hadoop’s Writable interface and java.lang.Comparableinterfaces.
Q. Explain the major components of Mapreduce Job?
Main driver class which provides job configuration parameters.
Mapper class which must extend org.apache.hadoop.mapreduce.Mapper class and provide implementation for map () method.
Reducer class which should extend org.apache.hadoop.mapreduce.Reducer class.
Q. What are the main components of Job flow in YARN architecture?
Mapreduce job flow on YARN involves below components.
A Client node, which submits the Mapreduce job.
The YARN Resource Manager, which allocates the cluster resources to jobs.
The YARN Node Managers, which launch and monitor the tasks of jobs.
The MapReduce Application Master, which coordinates the tasks running in the MapReduce job.
The HDFS file system  is utilized for sharing job files between the above entities.
Q. What is the role of Application Master in YARN architecture?
Application Master performs the role of negotiating resources from the Resource Manager and working with the Node Manager(s) toexecute and monitor the tasks.
Application Master requests containers for all map tasks and reduce tasks.Once Containers are assigned to tasks, Application Master starts containers by notifying its Node Manager. Application Master collects progress information from all tasks and aggregate values are propagated to Client Node or user.
Application master is specific to a single application which is a single job in classic mapreduce or a cycle of jobs. Once the job execution is completed, application master will no longer exist.
Q. What is identity Mapper?
Identity Mapper is a default Mapper class provided by hadoop. When no mapper is class is specified in Mapreduce job, then this mapper will be executed.
It doesn’t process/manipulate/ perform any computation on input data rather it simply writes the input data into output. It’s class name is org.apache.hadoop.mapred.lib.IdentityMapper.
Q. What is identity Reducer?
It is a reduce phase’s counter part for Identity mapper in map phase. It simply passes on the input key/value pairs into output directory. Its class name is org.apache.hadoop.mapred.lib.IdentityReducer.
When no reducer class is specified in Mapreduce job, then this class will be picked up by the job automatically.
Q. What is chain Mapper?
Chain Mapper class is a special implementation of Mapper class through which a set of mapper classes can be run in a chain fashion, within a single map task.
In this chained pattern execution, first mapper output will become input for second mapper and second mappers output to third mapper, and so on until the last mapper.
Its class name is org.apache.hadoop.mapreduce.lib.ChainMapper.
Q. What is chain reducer?
Chain reducer is similar to Chain Mapper class through which a chain of mappers followed by a single reducer can be run in a single reducer task. Unlike Chain Mapper, chain of reducers will not be executed in this, but chain of mappers will be run followed by a single reducer.
Its class name is org.apache.hadoop.mapreduce.lib.ChainReducer.
Q. How can we mention multiple mappers and reducer classes in Chain Mapper or Chain Reducer classes?
In Chain Mapper,
ChainMapper.addMapper() method is used to add mapper classes.
In ChainReducer,
ChainReducer.setReducer() method is used to specify the single reducer class.
ChainReducer.addMapper() method can be used to add mapper classes.
Q. What is side data distribution in Mapreduce framework?
The extra read-only data needed by a mapreduce job to process the main data set is called as side data.
There are two ways to make side data available to all the map or reduce tasks.
Job Configuration
Distributed cache
Q. How to distribute side data using job configuration?
Side data can be distributed by setting an arbitrary key-value pairs in the job configuration using the various setter methods onConfiguration object.
In the task, we can retrieve the data from the configuration returned by Context ’s
getConfiguration() method.
Q. When can we use side data distribution by Job Configuration and when it is not supposed?
Side data distribution by job configuration is useful only when we need to pass a small piece of meta data to map/reduce tasks.
We shouldn’t use this mechanism for transferring more than a few KB’s of data because it put pressure on the memory usage, particularly in a system running hundreds of jobs.
Q. What is Distributed Cache in Mapreduce?
Distributed cache mechanism is an alternative way of side data distribution by copying files and archives to the task nodes in time for the tasks to use them when they run.
To save network bandwidth, files are normally copied to any particular node once per job.
Q. How to supply files or archives to mapreduce job in distributed cache mechanism?
The files that need to be distributed can be specified as a comma-separated list of URIs as the argument to the -files option in hadoop job command. Files can be on the local file system, on HDFS.
Archive files (ZIP files, tar files, and gzipped tar files) can also be copied to task nodes by distributed cache by using -archives option.these are un-archived on the task node.
The -libjars option will add JAR files to the classpath of the mapper and reducer tasks.
jar command with distributed cache
12 $ hadoop jar example.jar ExampleProgram -files Inputpath/example.txt input/filename /output/
Q. How distributed cache works in Mapreduce Framework?
When a mapreduce job is submitted with distributed cache options, the node managers copies the the files specified by the -files , -archives and -libjars options from distributed cache to a local disk. The files are said to be localized at this point.
local.cache.size property can be configured to setup cache size on local disk of node managers. Files are localized under the${hadoop.tmp.dir}/mapred/local directory on the node manager nodes.
Q. What will hadoop do when a task is failed in a list of suppose 50 spawned tasks?
It restarts the map or reduce task again to another node manager and only if in case task fails, four or more than 4 times then it will kill the job. The default number of maximum attempts for map tasks and reduce tasks can be configured with below properties in mapred-site.xml file.
The default value for the above two properties is 4 only.
Q. Consider case scenario: In Mapreduce system, HDFS block size is 256 MB and we have 3 files of size 256 KB, 266 MB and 500 MB then how many input splits will be made by Hadoop's frameworks?
Hadoop will make 5 splits as follows
– One split for 256 KB file
– 2 splits for 266 MB file  (1 split of size 256 MB and another split of size 10 MB)
– Two splits for 500 MB file  (1 Split of size 256 MB and another of size 244 MB)
Q. Why can’t we just have the file in HDFS and have the application read it instead of distributed cache?
Distributed cache copies the file to all node managers at the start of the job. Now if the node manager runs 10 or 50 map or reduce tasks, it will use the same file copy from distributed cache.
On the other hand, if a file needs to read from HDFS in the job then every map or reduce task will access it from HDFS and hence if a node manager runs 100 map tasks then it will read this file 100 times from HDFS. Accessing the same file from node manager’s Local FS is much faster than from HDFS data nodes.
Q. What mechanism does Hadoop framework provides to synchronize changes made in Distribution Cache during run time of the application?
Distributed cache mechanism provides service for copying just read-only data needed by a mapreduce job but not the files which can be updated. So, there is no mechanism to synchronize the changes made in distributed cache as changes are not allowed to distributed cached files.
Explore MapReduce Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!

Popular Courses in 2018

Get Updates on Tech posts, Interview & Certification questions and training schedules