This section includes 7 InterviewSolutions, each offering curated multiple-choice questions to sharpen your Current Affairs knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What Is The Jobtracker And What It Performs In A Hadoop Cluster? |
|
Answer» JobTracker is a daemon service which submits and tracks the MapReduce tasks to the HADOOP cluster. It runs its own JVM process. And usually it run on a separate machine, and each slave node is configured with job tracker node location. The JobTracker is single point of failure for the Hadoop MapReduce service. If it goes down, all running jobs are halted. JobTracker in Hadoop performs following actions
JobTracker is a daemon service which submits and tracks the MapReduce tasks to the Hadoop cluster. It runs its own JVM process. And usually it run on a separate machine, and each slave node is configured with job tracker node location. The JobTracker is single point of failure for the Hadoop MapReduce service. If it goes down, all running jobs are halted. JobTracker in Hadoop performs following actions |
|
| 2. |
How Many Instances Of Jobtracker Can Run On A Hadoop Cluster? |
|
Answer» Only ONE Only one |
|
| 3. |
What Happens If Number Of Reducers Are 0? |
|
Answer» In this case the outputs of the map-tasks GO directly to the FILESYSTEM, into the OUTPUT path set by setOutputPath(Path). The FRAMEWORK does not sort the map-outputs before writing them out to the FileSystem. In this case the outputs of the map-tasks go directly to the FileSystem, into the output path set by setOutputPath(Path). The framework does not sort the map-outputs before writing them out to the FileSystem. |
|
| 4. |
It Can Be Possible That A Job Has 0 Reducers? |
|
Answer» It is LEGAL to SET the number of reduce-tasks to ZERO if no REDUCTION is DESIRED. It is legal to set the number of reduce-tasks to zero if no reduction is desired. |
|
| 5. |
How Many Reducers Should Be Configured? |
|
Answer» The right number of reduces SEEMS to be 0.95 or 1.75 multiplied by With 0.95 all of the reduces can launch immediately and start transfering map outputs as the maps finish. With 1.75 the faster nodes will finish their first round of reduces and launch a second wave of reduces doing a much BETTER JOB of LOAD balancing. INCREASING the number of reduces increases the framework overhead, but increases load balancing and lowers the cost of failures. The right number of reduces seems to be 0.95 or 1.75 multiplied by With 0.95 all of the reduces can launch immediately and start transfering map outputs as the maps finish. With 1.75 the faster nodes will finish their first round of reduces and launch a second wave of reduces doing a much better job of load balancing. Increasing the number of reduces increases the framework overhead, but increases load balancing and lowers the cost of failures. |
|
| 6. |
Explain The Reducer's Reduce Phase? |
|
Answer» In this PHASE the REDUCE(MapOutKeyType, Iterable, CONTEXT) method is called for each pair in the grouped inputs. The output of the reduce task is typically written to the FileSystem via Context.write (ReduceOutKeyType, ReduceOutValType). Applications can use the Context to report progress, set application-level status messages and update Counters, or just indicate that they are alive. The output of the REDUCER is not sorted. In this phase the reduce(MapOutKeyType, Iterable, Context) method is called for each pair in the grouped inputs. The output of the reduce task is typically written to the FileSystem via Context.write (ReduceOutKeyType, ReduceOutValType). Applications can use the Context to report progress, set application-level status messages and update Counters, or just indicate that they are alive. The output of the Reducer is not sorted. |
|
| 7. |
Explain The Reducer's Sort Phase? |
|
Answer» The framework GROUPS Reducer inputs by keys (since different mappers may have OUTPUT the same key) in this stage. The shuffle and SORT phases occur simultaneously; while map-outputs are being FETCHED they are merged (It is similar to merge-sort). The framework groups Reducer inputs by keys (since different mappers may have output the same key) in this stage. The shuffle and sort phases occur simultaneously; while map-outputs are being fetched they are merged (It is similar to merge-sort). |
|
| 8. |
Explain The Shuffle? |
|
Answer» Input to the REDUCER is the sorted OUTPUT of the mappers. In this phase the framework FETCHES the relevant partition of the output of all the mappers, VIA HTTP. Input to the Reducer is the sorted output of the mappers. In this phase the framework fetches the relevant partition of the output of all the mappers, via HTTP. |
|
| 9. |
What Are The Primary Phases Of The Reducer? |
|
Answer» Shuffle, Sort and Reduce. |
|
| 10. |
Explain The Core Methods Of The Reducer? |
|
Answer» The API of Reducer is very similar to that of MAPPER, there's a run() method that receives a CONTEXT containing the job's CONFIGURATION as well as INTERFACING methods that return data from the reducer itself back to the framework. The run() method calls setup() once, reduce() once for each key associated with the reduce task, and cleanup() once at the end. Each of these methods can access the job's configuration data by using Context.getConfiguration(). As in Mapper, any or all of these methods can be overridden with custom implementations. If none of these methods are overridden, the DEFAULT reducer operation is the identity function; values are passed through without further processing. The heart of Reducer is its reduce() method. This is called once per key; the second argument is an Iterable which returns all the values associated with that key. The API of Reducer is very similar to that of Mapper, there's a run() method that receives a Context containing the job's configuration as well as interfacing methods that return data from the reducer itself back to the framework. The run() method calls setup() once, reduce() once for each key associated with the reduce task, and cleanup() once at the end. Each of these methods can access the job's configuration data by using Context.getConfiguration(). As in Mapper, any or all of these methods can be overridden with custom implementations. If none of these methods are overridden, the default reducer operation is the identity function; values are passed through without further processing. The heart of Reducer is its reduce() method. This is called once per key; the second argument is an Iterable which returns all the values associated with that key. |
|
| 11. |
What Is The Reducer Used For? |
|
Answer» REDUCER REDUCES a set of intermediate VALUES which share a key to a (usually smaller) set of values. The NUMBER of reduces for the job is set by the USER via Job.setNumReduceTasks(int). Reducer reduces a set of intermediate values which share a key to a (usually smaller) set of values. The number of reduces for the job is set by the user via Job.setNumReduceTasks(int). |
|
| 12. |
How Many Maps Are There In A Particular Job? |
|
Answer» The number of maps is usually driven by the total size of the inputs, that is, the total number of blocks of the input files. Generally it is around 10-100 maps per-node. TASK setup takes awhile, so it is best if the maps take at LEAST a minute to execute. SUPPOSE, if you expect 10TB of input data and have a block size of 128MB, you'll END up with 82,000 maps, to control the number of block you can use the mapreduce.job.maps parameter (which only provides a hint to the FRAMEWORK). Ultimately, the number of tasks is controlled by the number of splits returned by the InputFormat.getSplits() method (which you can override). The number of maps is usually driven by the total size of the inputs, that is, the total number of blocks of the input files. Generally it is around 10-100 maps per-node. Task setup takes awhile, so it is best if the maps take at least a minute to execute. Suppose, if you expect 10TB of input data and have a block size of 128MB, you'll end up with 82,000 maps, to control the number of block you can use the mapreduce.job.maps parameter (which only provides a hint to the framework). Ultimately, the number of tasks is controlled by the number of splits returned by the InputFormat.getSplits() method (which you can override). |
|
| 13. |
What Is The Use Of Combiner? |
|
Answer» It is an optional component or class, and can be specify via Job.setCombinerClass(ClassName), to PERFORM local aggregation of the INTERMEDIATE outputs, which HELPS to cut down the amount of data TRANSFERRED from the Mapper to the REDUCER. It is an optional component or class, and can be specify via Job.setCombinerClass(ClassName), to perform local aggregation of the intermediate outputs, which helps to cut down the amount of data transferred from the Mapper to the Reducer. |
|
| 14. |
How Can We Control Particular Key Should Go In A Specific Reducer? |
|
Answer» USERS can control which keys (and HENCE records) go to which REDUCER by implementing a custom Partitioned. Users can control which keys (and hence records) go to which Reducer by implementing a custom Partitioned. |
|
| 15. |
What Is Next Step After Mapper Or Maptask? |
|
Answer» The output of the MAPPER are sorted and PARTITIONS will be CREATED for the output. NUMBER of PARTITION depends on the number of reducer. The output of the Mapper are sorted and Partitions will be created for the output. Number of partition depends on the number of reducer. |
|
| 16. |
Which Object Can Be Used To Get The Progress Of A Particular Job ? |
|
Answer» Context Context |
|
| 17. |
How Does Mapper's Run() Method Works? |
|
Answer» The Mapper.run() METHOD then calls MAP(KeyInType, ValInType, CONTEXT) for each key/value pair in the InputSplit for that TASK The Mapper.run() method then calls map(KeyInType, ValInType, Context) for each key/value pair in the InputSplit for that task |
|
| 18. |
How Can You Add The Arbitrary Key-value Pairs In Your Mapper? |
|
Answer» You can set arbitrary (KEY, value) PAIRS of configuration data in your JOB, e.g. with You can set arbitrary (key, value) pairs of configuration data in your Job, e.g. with |
|
| 19. |
What Is The Use Of Context Object? |
|
Answer» The Context object allows the MAPPER to INTERACT with the REST of the Hadoop system. It INCLUDES configuration data for the job, as well as interfaces which ALLOW it to emit output. The Context object allows the mapper to interact with the rest of the Hadoop system. It Includes configuration data for the job, as well as interfaces which allow it to emit output. |
|
| 20. |
What Happens If You Don't Override The Mapper Methods And Keep Them As It Is? |
|
Answer» If you do not override any methods (leaving EVEN map as-is), it will act as the IDENTITY FUNCTION, EMITTING each input record as a separate output. If you do not override any methods (leaving even map as-is), it will act as the identity function, emitting each input record as a separate output. |
|
| 21. |
Which Are The Methods In The Mapper Interface? |
|
Answer» The Mapper contains the RUN() method, which call its own setup() method only once, it ALSO call a MAP() method for each input and finally calls it CLEANUP() method. All above methods you can override in your CODE. The Mapper contains the run() method, which call its own setup() method only once, it also call a map() method for each input and finally calls it cleanup() method. All above methods you can override in your code. |
|
| 22. |
How Mapper Is Instantiated In A Running Job? |
|
Answer» The MAPPER itself is INSTANTIATED in the running JOB, and will be passed a MapContext object which it can USE to configure itself. The Mapper itself is instantiated in the running job, and will be passed a MapContext object which it can use to configure itself. |
|
| 23. |
Where Do You Specify The Mapper Implementation? |
|
Answer» GENERALLY MAPPER IMPLEMENTATION is SPECIFIED in the JOB itself. Generally mapper implementation is specified in the Job itself. |
|
| 24. |
What Is The Inputformat ? |
|
Answer» The INPUTFORMAT is responsible for enumerate (itemise) the InputSplits, and PRODUCING a RECORDREADER which will turn those logical work units into actual physical input records. The InputFormat is responsible for enumerate (itemise) the InputSplits, and producing a RecordReader which will turn those logical work units into actual physical input records. |
|
| 25. |
What Is The Inputsplit In Map Reduce Software? |
|
Answer» An INPUTSPLIT is a logical representation of a UNIT (A chunk) of input work for a MAP task; e.g., a file name and a byte range within that file to process or a ROW set in a text file. An InputSplit is a logical representation of a unit (A chunk) of input work for a map task; e.g., a file name and a byte range within that file to process or a row set in a text file. |
|
| 26. |
What Mapper Does? |
|
Answer» Maps are the INDIVIDUAL TASKS that TRANSFORM input records into intermediate records. The TRANSFORMED intermediate records do not need to be of the same TYPE as the input records. A given input pair may map to zero or many output pairs. Maps are the individual tasks that transform input records into intermediate records. The transformed intermediate records do not need to be of the same type as the input records. A given input pair may map to zero or many output pairs. |
|
| 27. |
Which Interface Needs To Be Implemented To Create Mapper And Reducer For The Hadoop? |
|
Answer» org.apache.hadoop.mapreduce.Mapper org.apache.hadoop.mapreduce.Mapper |
|
| 28. |
Explain The Wordcount Implementation Via Hadoop Framework ? |
|
Answer» We will count the words in all the input file flow as below
< Hello, 1> The second map output: < Hello, 1> < Hello, 2> The output of the second map: < Hello, 2> < Hello, 4> Output Final output would look like Hello 4 times We will count the words in all the input file flow as below < Hello, 1> The second map output: < Hello, 1> < Hello, 2> The output of the second map: < Hello, 2> < Hello, 4> Output Final output would look like Hello 4 times |
|
| 29. |
What Are The Restriction To The Key And Value Class ? |
|
Answer» he key and value CLASSES have to be serialized by the FRAMEWORK. To make them serializable HADOOP provides a Writable interface. As you KNOW from the java itself that the key of the Map should be COMPARABLE, hence the key has to implement one more interface Writable Comparable. he key and value classes have to be serialized by the framework. To make them serializable Hadoop provides a Writable interface. As you know from the java itself that the key of the Map should be comparable, hence the key has to implement one more interface Writable Comparable. |
|
| 30. |
Explain How Input And Output Data Format Of The Hadoop Framework? |
|
Answer» The MapReduce framework operates exclusively on pairs, that is, the framework views the INPUT to the JOB as a set of pairs and PRODUCES a set of pairs as the OUTPUT of the job, conceivably of different types. See the flow mentioned below (input) -> map -> -> combine/sorting -> -> reduce -> (output) The MapReduce framework operates exclusively on pairs, that is, the framework views the input to the job as a set of pairs and produces a set of pairs as the output of the job, conceivably of different types. See the flow mentioned below (input) -> map -> -> combine/sorting -> -> reduce -> (output) |
|
| 31. |
How Does An Hadoop Application Look Like Or Their Basic Components? |
|
Answer» Minimally an Hadoop application would have following components.
The Hadoop job client then SUBMITS the job (jar/executable etc.) and configuration to the JobTracker which then assumes the responsibility of distributing the software / configuration to the slaves, scheduling tasks and MONITORING them, providing status and DIAGNOSTIC information to the job-client. Minimally an Hadoop application would have following components. The Hadoop job client then submits the job (jar/executable etc.) and configuration to the JobTracker which then assumes the responsibility of distributing the software / configuration to the slaves, scheduling tasks and monitoring them, providing status and diagnostic information to the job-client. |
|
| 32. |
How Does Master Slave Architecture In The Hadoop? |
|
Answer» The MapReduce FRAMEWORK consists of a single master JobTracker and multiple slaves, each cluster-node will have one TaskTracker. The master is responsible for SCHEDULING the jobs' component TASKS on the slaves, monitoring them and re-executing the failed tasks. The slaves execute the tasks as directed by the master. The MapReduce framework consists of a single master JobTracker and multiple slaves, each cluster-node will have one TaskTracker. The master is responsible for scheduling the jobs' component tasks on the slaves, monitoring them and re-executing the failed tasks. The slaves execute the tasks as directed by the master. |
|
| 33. |
What Is Compute And Storage Nodes? |
|
Answer» COMPUTE Node: This is the computer or machine where your ACTUAL BUSINESS logic will be executed. torage Node: This is the computer or machine where your file SYSTEM reside to store the processing data. In most of the cases compute node and storage node would be the same machine. Compute Node: This is the computer or machine where your actual business logic will be executed. torage Node: This is the computer or machine where your file system reside to store the processing data. In most of the cases compute node and storage node would be the same machine. |
|
| 34. |
What Is Mapreduce? |
|
Answer» Map reduce is an algorithm or concept to process Huge amount of data in a faster way. As per its name you can divide it Map and Reduce.
Your business logic would be written in the MappedTask and ReducedTask. TYPICALLY both the input and the output of the job are stored in a file-system (Not database). The framework takes care of scheduling tasks, monitoring them and re-executes the FAILED tasks Map reduce is an algorithm or concept to process Huge amount of data in a faster way. As per its name you can divide it Map and Reduce. Your business logic would be written in the MappedTask and ReducedTask. Typically both the input and the output of the job are stored in a file-system (Not database). The framework takes care of scheduling tasks, monitoring them and re-executes the failed tasks |
|
| 35. |
On What Concept The Hadoop Framework Works? |
|
Answer» It WORKS on MAPREDUCE, and it is DEVISED by the GOOGLE. It works on MapReduce, and it is devised by the Google. |
|