Configure Impala Daemon to spill to HDFS
Impala occasionally needs to use persistent storage for writing intermediate files during large sorts, joins, aggregations, or analytic function operations. If your workload results in large volumes of intermediate data being written, it is recommended to configure the heavy spilling queries to use a remote storage location rather than the local one. The advantage of using remote storage for scratch space is that it is elastic and can handle any amount of spilling.
Before you begin
Identify the HDFS scratch directory where you want your new Impala to write the temporary data.
Identify the port number of the HDFS scratch directory.
Configure the Impala Virtual Warehouse to write temporary data to disk during query processing.
Configuring the Start-up Option in Impala daemon
You can use the Impalad start option “scratch_dirs” to specify the locations of the intermediate files.
Use the following format for this start up option:
‑‑scratch_dirs=”hdfs://ip_address:port_num(:max_bytes)(:priority), /local_buffer_dir” ‑‑remote_tmp_file_size=xM
hdfs://ipaddr:port/path(:max_bytes)(:priority)”is the remote directory
port_numis required for the HDFS scratch directory.
Using the above format:
- You can specify only one remote directory.
- When you configure a remote directory, you must specify a local buffer directory as the buffer. However you can use multiple local directories with the remote directory. If you specify multiple local directories, the first local directory would be used as the local buffer directory.
- If you configure both remote and local directories, the remote directory is only used when the local directories are fully utilized.
- The size of a remote intermediate file could affect the query performance, and the value can be set by “remote_tmp_file_size” in the start-up option. The default size of a remote intermediate file is 16MB while the maximum is 256MB.
- A hdfs scratch dir with one local buffer dir, file size 64MB. The space of hdfs scratch dir is limited to 300G.
‑‑scratch_dirs="hdfs://ipaddr:port/path:300G, /local_buffer_dir" ‑‑remote_tmp_file_size=64M
- A hdfs scratch dir with one local buffer dir, and one local dir. The space of hdfs scratch dir is limited to 300G.
‑‑scratch_dirs="hdfs://ipaddr:port/path:300G, /local_buffer_dir, /local_dir"
- A hdfs scratch dir with one local buffer dir, and multiple local dirs. The space of hdfs scratch dir is unlimited.
‑‑scratch_dirs="hdfs://ipaddr:port/path, /local_buffer_dir, /local_dir_1, /local_dir_2"
max_bytes is optional it is highly recommended to configure for
spilling to HDFS because the HDFS cluster space is limited.