Repository: carbondata
Updated Branches:
  refs/heads/master c58ef59e7 -> 682cac85a


[CARBONDATA-3033][Doc]Fix bugs in documents

1. add support for s3 as carbon.storelocation
2. optimize the description for unsafe memory
3. fix errors in description for 'carbon.sort.file.write.buffer.size'
4. fix the incorrect default value for 'carbon.csv.read.buffersize.byte' in code
5. reorder and group the parameters for data loading by its function scope

This closes #2840


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/682cac85
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/682cac85
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/682cac85

Branch: refs/heads/master
Commit: 682cac85a6de85334dc378e48e3f56ce6530c116
Parents: c58ef59
Author: xuchuanyin <[email protected]>
Authored: Mon Oct 22 10:10:59 2018 +0800
Committer: QiangCai <[email protected]>
Committed: Tue Oct 23 16:15:09 2018 +0800

----------------------------------------------------------------------
 conf/carbon.properties.template                 |  2 +-
 .../core/constants/CarbonCommonConstants.java   |  2 +-
 docs/configuration-parameters.md                | 56 ++++++++++----------
 docs/performance-tuning.md                      |  2 +-
 4 files changed, 31 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/682cac85/conf/carbon.properties.template
----------------------------------------------------------------------
diff --git a/conf/carbon.properties.template b/conf/carbon.properties.template
index 2e6ed92..9dd037f 100644
--- a/conf/carbon.properties.template
+++ b/conf/carbon.properties.template
@@ -58,7 +58,7 @@ carbon.inmemory.record.size=120000
 #carbon.timestamp.format=yyyy-MM-dd HH:mm:ss
 ######## Dataload Configuration ########
 ##File write buffer size used during sorting.
-#carbon.sort.file.write.buffer.size=10485760
+#carbon.sort.file.write.buffer.size=16384
 ##Locking mechanism for data loading on a table
 #carbon.lock.type=LOCALLOCK
 ##Minimum no of intermediate files after which sort merged to be started.

http://git-wip-us.apache.org/repos/asf/carbondata/blob/682cac85/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
 
b/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
index 46139c9..1b1046a 100644
--- 
a/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
+++ 
b/core/src/main/java/org/apache/carbondata/core/constants/CarbonCommonConstants.java
@@ -361,7 +361,7 @@ public final class CarbonCommonConstants {
   /**
    * CSV_READ_BUFFER_SIZE
    */
-  public static final String CSV_READ_BUFFER_SIZE_DEFAULT = "50000";
+  public static final String CSV_READ_BUFFER_SIZE_DEFAULT = "1048576"; // 1mb
   /**
    * min value for csv read buffer size
    */

http://git-wip-us.apache.org/repos/asf/carbondata/blob/682cac85/docs/configuration-parameters.md
----------------------------------------------------------------------
diff --git a/docs/configuration-parameters.md b/docs/configuration-parameters.md
index 0a4565a..ac204b1 100644
--- a/docs/configuration-parameters.md
+++ b/docs/configuration-parameters.md
@@ -31,7 +31,7 @@ This section provides the details of all the configurations 
required for the Car
 
 | Property | Default Value | Description |
 
|----------------------------|-------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| carbon.storelocation | spark.sql.warehouse.dir property value | Location 
where CarbonData will create the store, and write the data in its custom 
format. If not specified,the path defaults to spark.sql.warehouse.dir property. 
**NOTE:** Store location should be in HDFS. |
+| carbon.storelocation | spark.sql.warehouse.dir property value | Location 
where CarbonData will create the store, and write the data in its custom 
format. If not specified,the path defaults to spark.sql.warehouse.dir property. 
**NOTE:** Store location should be in HDFS or S3. |
 | carbon.ddl.base.hdfs.url | (none) | To simplify and shorten the path to be 
specified in DDL/DML commands, this property is supported. This property is 
used to configure the HDFS relative path, the path configured in 
carbon.ddl.base.hdfs.url will be appended to the HDFS path configured in 
fs.defaultFS of core-site.xml. If this path is configured, then user need not 
pass the complete path while dataload. For example: If absolute path of the csv 
file is hdfs://10.18.101.155:54310/data/cnbc/2016/xyz.csv, the path 
"hdfs://10.18.101.155:54310" will come from property fs.defaultFS and user can 
configure the /data/cnbc/ as carbon.ddl.base.hdfs.url. Now while dataload user 
can specify the csv path as /2016/xyz.csv. |
 | carbon.badRecords.location | (none) | CarbonData can detect the records not 
conforming to defined table schema and isolate them as bad records. This 
property is used to specify where to store such bad records. |
 | carbon.streaming.auto.handoff.enabled | true | CarbonData supports storing 
of streaming data. To have high throughput for streaming, the data is written 
in Row format which is highly optimized for write, but performs poorly for 
query. When this property is true and when the streaming data size reaches 
***carbon.streaming.segment.max.size***, CabonData will automatically convert 
the data to columnar format and optimize it for faster querying.**NOTE:** It is 
not recommended to keep the default value which is true. |
@@ -41,8 +41,9 @@ This section provides the details of all the configurations 
required for the Car
 | carbon.timestamp.format | yyyy-MM-dd HH:mm:ss | CarbonData can understand 
data of timestamp type and process it in special manner.It can be so that the 
format of Timestamp data is different from that understood by CarbonData by 
default. This configuration allows users to specify the format of Timestamp in 
their data. |
 | carbon.lock.type | LOCALLOCK | This configuration specifies the type of lock 
to be acquired during concurrent operations on table. There are following types 
of lock implementation: - LOCALLOCK: Lock is created on local file system as 
file. This lock is useful when only one spark driver (thrift server) runs on a 
machine and no other CarbonData spark application is launched concurrently. - 
HDFSLOCK: Lock is created on HDFS file system as file. This lock is useful when 
multiple CarbonData spark applications are launched and no ZooKeeper is running 
on cluster and HDFS supports file based locking. |
 | carbon.lock.path | TABLEPATH | This configuration specifies the path where 
lock files have to be created. Recommended to configure zookeeper lock type or 
configure HDFS lock path(to this property) in case of S3 file system as locking 
is not feasible on S3. |
-| carbon.unsafe.working.memory.in.mb | 512 | CarbonData supports storing data 
in off-heap memory for certain operations during data loading and query. This 
helps to avoid the Java GC and thereby improve the overall performance. The 
Minimum value recommeded is 512MB. Any value below this is reset to default 
value of 512MB. **NOTE:** The below formulas explain how to arrive at the 
off-heap size required.<u>Memory Required For Data 
Loading:</u>(*carbon.number.of.cores.while.loading*) * (Number of tables to 
load in parallel) * (*offheap.sort.chunk.size.inmb* + 
*carbon.blockletgroup.size.in.mb* + *carbon.blockletgroup.size.in.mb*/3.5 ). 
<u>Memory required for Query:</u>SPARK_EXECUTOR_INSTANCES * 
(*carbon.blockletgroup.size.in.mb* + *carbon.blockletgroup.size.in.mb* * 3.5) * 
spark.executor.cores |
-| carbon.unsafe.driver.working.memory.in.mb | 60% of JVM Heap Memory | 
CarbonData supports storing data in unsafe on-heap memory in driver for certain 
operations like insert into, query for loading datamap cache. The Minimum value 
recommended is 512MB. |
+| enable.offheap.sort | true | Whether carbondata will use offheap or onheap 
memory. By default, the value is true and carbondata will use the property 
value from *carbon.unsafe.working.memory.in.mb* or 
*carbon.unsafe.driver.working.memory.in.mb* as the amount of memory; if it is 
false, carbondata will use the minimum value between the configured amount of 
unsafe memory and the 60% of JVM Heap Memory as the amount of memory. |
+| carbon.unsafe.working.memory.in.mb | 512 | CarbonData supports storing data 
in off-heap memory for certain operations during data loading and query. This 
helps to avoid the Java GC and thereby improve the overall performance. The 
Minimum value recommeded is 512MB. Any value below this is reset to default 
value of 512MB. **NOTE:** The below formulas explain how to arrive at the 
off-heap size required.<u>Memory Required For Data Loading per executor: 
</u>(*carbon.number.of.cores.while.loading*) * (Number of tables to load in 
parallel) * (*offheap.sort.chunk.size.inmb* + *carbon.blockletgroup.size.in.mb* 
+ *carbon.blockletgroup.size.in.mb*/3.5 ). <u>Memory required for Query per 
executor:</u> (*carbon.blockletgroup.size.in.mb* + 
*carbon.blockletgroup.size.in.mb* * 3.5) * spark.executor.cores |
+| carbon.unsafe.driver.working.memory.in.mb | (none) | CarbonData supports 
storing data in unsafe on-heap memory in driver for certain operations like 
insert into, query for loading datamap cache. The Minimum value recommended is 
512MB. If this configuration is not set, carbondata will use the value of 
`carbon.unsafe.working.memory.in.mb`. |
 | carbon.update.sync.folder | /tmp/carbondata | CarbonData maintains last 
modification time entries in modifiedTime.mdt to determine the schema changes 
and reload only when necessary. This configuration specifies the path where the 
file needs to be written. |
 | carbon.invisible.segments.preserve.count | 200 | CarbonData maintains each 
data load entry in tablestatus file. The entries from this file are not deleted 
for those segments that are compacted or dropped, but are made invisible. If 
the number of data loads are very high, the size and number of entries in 
tablestatus file can become too many causing unnecessary reading of all data. 
This configuration specifies the number of segment entries to be maintained 
afte they are compacted or dropped.Beyond this, the entries are moved to a 
separate history tablestatus file. **NOTE:** The entries in tablestatus file 
help to identify the operations performed on CarbonData table and is also used 
for checkpointing during various data manupulation operations. This is similar 
to AUDIT file maintaining all the operations and its status.Hence the entries 
are never deleted but moved to a separate history file. |
 | carbon.lock.retries | 3 | CarbonData ensures consistency of operations by 
blocking certain operations from running in parallel. In order to block the 
operations from running in parallel, lock is obtained on the table. This 
configuration specifies the maximum number of retries to obtain the lock for 
any operations other than load. **NOTE:** Data manupulation operations like 
Compaction,UPDATE,DELETE  or LOADING,UPDATE,DELETE are not allowed to run in 
parallel.How ever data loading can happen in parallel to compaction. |
@@ -52,47 +53,46 @@ This section provides the details of all the configurations 
required for the Car
 
 | Parameter | Default Value | Description |
 
|--------------------------------------|---------------|----------------------------------------------------------------------------------------------------------------------|
+| carbon.concurrent.lock.retries | 100 | CarbonData supports concurrent data 
loading onto same table. To ensure the loading status is correctly updated into 
the system,locks are used to sequence the status updation step. This 
configuration specifies the maximum number of retries to obtain the lock for 
updating the load status. **NOTE:** This value is high as more number of 
concurrent loading happens,more the chances of not able to obtain the lock when 
tried. Adjust this value according to the number of concurrent loading to be 
supported by the system. |
+| carbon.concurrent.lock.retry.timeout.sec | 1 | Specifies the interval 
between the retries to obtain the lock for concurrent operations. **NOTE:** 
Refer to ***carbon.concurrent.lock.retries*** for understanding why CarbonData 
uses locks during data loading operations. |
+| carbon.csv.read.buffersize.byte | 1048576 | CarbonData uses Hadoop 
InputFormat to read the csv files. This configuration value is used to pass 
buffer size as input for the Hadoop MR job when reading the csv files. This 
value is configured in bytes. **NOTE:** Refer to 
***org.apache.hadoop.mapreduce.InputFormat*** documentation for additional 
information. |
+| carbon.loading.prefetch | false | CarbonData uses univocity parser to read 
csv files. This configuration is used to inform the parser whether it can 
prefetch the data from csv files to speed up the reading.**NOTE:** Enabling 
prefetch improves the data loading performance, but needs higher memory to keep 
more records which are read ahead from disk. |
+| carbon.skip.empty.line | false | The csv files givent to CarbonData for 
loading can contain empty lines. Based on the business scenario, this empty 
line might have to be ignored or needs to be treated as NULL value for all 
columns.In order to define this business behavior, this configuration is 
provided.**NOTE:** In order to consider NULL values for non string columns and 
continue with data load, ***carbon.bad.records.action*** need to be set to 
**FORCE**;else data load will be failed as bad records encountered. |
 | carbon.number.of.cores.while.loading | 2 | Number of cores to be used while 
loading data. This also determines the number of threads to be used to read the 
input files (csv) in parallel.**NOTE:** This configured value is used in every 
data loading step to parallelize the operations. Configuring a higher value can 
lead to increased early thread pre-emption by OS and there by reduce the 
overall performance. |
-| carbon.sort.size | 100000 | Number of records to hold in memory to sort and 
write intermediate temp files.**NOTE:** Memory required for data loading 
increases with increase in configured value as each thread would cache 
configured number of records. |
+| enable.unsafe.sort | true | CarbonData supports unsafe operations of Java to 
avoid GC overhead for certain operations. This configuration enables to use 
unsafe functions in CarbonData. **NOTE:** For operations like data loading, 
which generates more short lived Java objects, Java GC can be a bottle neck. 
Using unsafe can overcome the GC overhead and improve the overall performance. |
+| enable.offheap.sort | true | CarbonData supports storing data in off-heap 
memory for certain operations during data loading and query. This helps to 
avoid the Java GC and thereby improve the overall performance. This 
configuration enables using off-heap memory for sorting of data during data 
loading.**NOTE:**  ***enable.unsafe.sort*** configuration needs to be 
configured to true for using off-heap |
+| carbon.load.sort.scope | LOCAL_SORT | CarbonData can support various sorting 
options to match the balance between load and query performance. LOCAL_SORT:All 
the data given to an executor in the single load is fully sorted and written to 
carbondata files. Data loading performance is reduced a little as the entire 
data needs to be sorted in the executor. BATCH_SORT:Sorts the data in batches 
of configured size and writes to carbondata files. Data loading performance 
increases as the entire data need not be sorted.But query performance will get 
reduced due to false positives in block pruning and also due to more number of 
carbondata files written.Due to more number of carbondata files, if identified 
blocks > cluster parallelism, query performance and concurrency will get 
reduced.GLOBAL SORT:Entire data in the data load is fully sorted and written to 
carbondata files. Data loading performance would get reduced as the entire data 
needs to be sorted.But the query performance increases si
 gnificantly due to very less false positives and concurrency is also improved. 
**NOTE:** when BATCH_SORT is configured, it is recommended to keep 
***carbon.load.batch.sort.size.inmb*** > ***carbon.blockletgroup.size.in.mb*** |
+| carbon.load.batch.sort.size.inmb | 0 | When  ***carbon.load.sort.scope*** is 
configured as ***BATCH_SORT***, this configuration needs to be added to specify 
the batch size for sorting and writing to carbondata files. **NOTE:** It is 
recommended to keep the value around 45% of 
***carbon.sort.storage.inmemory.size.inmb*** to avoid spill to disk. Also it is 
recommended to keep the value higher than 
***carbon.blockletgroup.size.in.mb***. Refer to *carbon.load.sort.scope* for 
more information on sort options and the advantages/disadvantages of each 
option. |
 | carbon.global.sort.rdd.storage.level | MEMORY_ONLY | Storage level to 
persist dataset of RDD/dataframe when loading data with 
'sort_scope'='global_sort', if user's executor has less memory, set this 
parameter to 'MEMORY_AND_DISK_SER' or other storage level to correspond to 
different environment. [See 
detail](http://spark.apache.org/docs/latest/rdd-programming-guide.html#rdd-persistence).
 |
-| carbon.load.global.sort.partitions | 0 | The Number of partitions to use 
when shuffling data for sort. Default value 0 means to use same number of map 
tasks as reduce tasks.**NOTE:** In general, it is recommended to have 2-3 tasks 
per CPU core in your cluster. |
-| carbon.options.bad.records.logger.enable | false | CarbonData can identify 
the records that are not conformant to schema and isolate them as bad records. 
Enabling this configuration will make CarbonData to log such bad 
records.**NOTE:** If the input data contains many bad records, logging them 
will slow down the over all data loading throughput. The data load operation 
status would depend on the configuration in ***carbon.bad.records.action***. |
+| carbon.load.global.sort.partitions | 0 | The number of partitions to use 
when shuffling data for global sort. Default value 0 means to use same number 
of map tasks as reduce tasks. **NOTE:** In general, it is recommended to have 
2-3 tasks per CPU core in your cluster. |
+| carbon.sort.size | 100000 | Number of records to hold in memory to sort and 
write intermediate sort temp files. **NOTE:** Memory required for data loading 
will increase if you turn this value bigger. Besides each thread will cache 
this amout of records. The number of threads is configured by 
*carbon.number.of.cores.while.loading*. |
+| carbon.options.bad.records.logger.enable | false | CarbonData can identify 
the records that are not conformant to schema and isolate them as bad records. 
Enabling this configuration will make CarbonData to log such bad records. 
**NOTE:** If the input data contains many bad records, logging them will slow 
down the over all data loading throughput. The data load operation status would 
depend on the configuration in ***carbon.bad.records.action***. |
 | carbon.bad.records.action | FAIL | CarbonData in addition to identifying the 
bad records, can take certain actions on such data. This configuration can have 
four types of actions for bad records namely FORCE, REDIRECT, IGNORE and FAIL. 
If set to FORCE then it auto-corrects the data by storing the bad records as 
NULL. If set to REDIRECT then bad records are written to the raw CSV instead of 
being loaded. If set to IGNORE then bad records are neither loaded nor written 
to the raw CSV. If set to FAIL then data loading fails if any bad records are 
found. |
 | carbon.options.is.empty.data.bad.record | false | Based on the business 
scenarios, empty("" or '' or ,,) data can be valid or invalid. This 
configuration controls how empty data should be treated by CarbonData. If 
false, then empty ("" or '' or ,,) data will not be considered as bad record 
and vice versa. |
 | carbon.options.bad.record.path | (none) | Specifies the HDFS path where bad 
records are to be stored. By default the value is Null. This path must to be 
configured by the user if ***carbon.options.bad.records.logger.enable*** is 
**true** or ***carbon.bad.records.action*** is **REDIRECT**. |
-| carbon.blockletgroup.size.in.mb | 64 | Please refer to 
[file-structure-of-carbondata](./file-structure-of-carbondata.md#carbondata-file-format)
 to understand the storage format of CarbonData. The data are read as a group 
of blocklets which are called blocklet groups. This parameter specifies the 
size of each blocklet group. Higher value results in better sequential IO 
access. The minimum value is 16MB, any value lesser than 16MB will reset to the 
default value (64MB).**NOTE:** Configuring a higher value might lead to poor 
performance as an entire blocklet group will have to read into memory before 
processing.For filter queries with limit, it is **not advisable** to have a 
bigger blocklet size. For Aggregation queries which need to return more number 
of rows,bigger blocklet size is advisable. |
-| carbon.sort.file.write.buffer.size | 16384 | CarbonData sorts and writes 
data to intermediate files to limit the memory usage. This configuration 
determines the buffer size to be used for reading and writing such files. 
**NOTE:** This configuration is useful to tune IO and derive optimal 
performance.Based on the OS and underlying harddisk type, these values can 
significantly affect the overall performance.It is ideal to tune the buffersize 
equivalent to the IO buffer size of the OS.Recommended range is between 10240 
to 10485760 bytes. |
-| carbon.sort.intermediate.files.limit | 20 | CarbonData sorts and writes data 
to intermediate files to limit the memory usage. Before writing the target 
carbondat file, the data in these intermediate files needs to be sorted again 
so as to ensure the entire data in the data load is sorted. This configuration 
determines the minimum number of intermediate files after which merged sort is 
applied on them sort the data.**NOTE:** Intermediate merging happens on a 
separate thread in the background.Number of threads used is determined by 
***carbon.merge.sort.reader.thread***.Configuring a low value will cause more 
time to be spent in merging these intermediate merged files which can cause 
more IO.Configuring a high value would cause not to use the idle threads to do 
intermediate sort merges.Range of recommended values are between 2 and 50 |
-| carbon.csv.read.buffersize.byte | 1048576 | CarbonData uses Hadoop 
InputFormat to read the csv files. This configuration value is used to pass 
buffer size as input for the Hadoop MR job when reading the csv files. This 
value is configured in bytes.**NOTE:** Refer to 
***org.apache.hadoop.mapreduce.InputFormat*** documentation for additional 
information. |
-| carbon.merge.sort.reader.thread | 3 | CarbonData sorts and writes data to 
intermediate files to limit the memory usage. When the intermediate files 
reaches ***carbon.sort.intermediate.files.limit*** the files will be merged,the 
number of threads specified in this configuration will be used to read the 
intermediate files for performing merge sort.**NOTE:** Refer to 
***carbon.sort.intermediate.files.limit*** for operation 
description.Configuring less  number of threads can cause merging to slow down 
over loading process where as configuring more number of threads can cause 
thread contention with threads in other data loading steps.Hence configure a 
fraction of ***carbon.number.of.cores.while.loading***. |
-| carbon.concurrent.lock.retries | 100 | CarbonData supports concurrent data 
loading onto same table. To ensure the loading status is correctly updated into 
the system,locks are used to sequence the status updation step. This 
configuration specifies the maximum number of retries to obtain the lock for 
updating the load status. **NOTE:** This value is high as more number of 
concurrent loading happens,more the chances of not able to obtain the lock when 
tried. Adjust this value according to the number of concurrent loading to be 
supported by the system. |
-| carbon.concurrent.lock.retry.timeout.sec | 1 | Specifies the interval 
between the retries to obtain the lock for concurrent operations. **NOTE:** 
Refer to ***carbon.concurrent.lock.retries*** for understanding why CarbonData 
uses locks during data loading operations. |
-| carbon.skip.empty.line | false | The csv files givent to CarbonData for 
loading can contain empty lines. Based on the business scenario, this empty 
line might have to be ignored or needs to be treated as NULL value for all 
columns.In order to define this business behavior, this configuration is 
provided.**NOTE:** In order to consider NULL values for non string columns and 
continue with data load, ***carbon.bad.records.action*** need to be set to 
**FORCE**;else data load will be failed as bad records encountered. |
-| carbon.enable.calculate.size | true | **For Load Operation**: Setting this 
property calculates the size of the carbon data file (.carbondata) and carbon 
index file (.carbonindex) for every load and updates the table status file. 
**For Describe Formatted**: Setting this property calculates the total size of 
the carbon data files and carbon index files for the respective table and 
displays in describe formatted command. **NOTE:** This is useful to determine 
the overall size of the carbondata table and also get an idea of how the table 
is growing in order to take up other backup strategy decisions. |
+| carbon.blockletgroup.size.in.mb | 64 | Please refer to 
[file-structure-of-carbondata](./file-structure-of-carbondata.md#carbondata-file-format)
 to understand the storage format of CarbonData. The data are read as a group 
of blocklets which are called blocklet groups. This parameter specifies the 
size of each blocklet group. Higher value results in better sequential IO 
access. The minimum value is 16MB, any value lesser than 16MB will reset to the 
default value (64MB). **NOTE:** Configuring a higher value might lead to poor 
performance as an entire blocklet group will have to read into memory before 
processing.For filter queries with limit, it is **not advisable** to have a 
bigger blocklet size. For aggregation queries which need to return more number 
of rows, bigger blocklet size is advisable. |
+| carbon.sort.file.write.buffer.size | 16384 | CarbonData sorts and writes 
data to intermediate files to limit the memory usage. This configuration 
determines the buffer size to be used for reading and writing such files. 
**NOTE:** This configuration is useful to tune IO and derive optimal 
performance. Based on the OS and underlying harddisk type, these values can 
significantly affect the overall performance. It is ideal to tune the 
buffersize equivalent to the IO buffer size of the OS. Recommended range is 
between 10240 and 10485760 bytes. |
+| carbon.sort.intermediate.files.limit | 20 | CarbonData sorts and writes data 
to intermediate files to limit the memory usage. Before writing the target 
carbondata file, the records in these intermediate files needs to be merged to 
reduce the number of intermediate files. This configuration determines the 
minimum number of intermediate files after which merged sort is applied on them 
sort the data. **NOTE:** Intermediate merging happens on a separate thread in 
the background. Number of threads used is determined by 
***carbon.merge.sort.reader.thread***. Configuring a low value will cause more 
time to be spent in merging these intermediate merged files which can cause 
more IO. Configuring a high value would cause not to use the idle threads to do 
intermediate sort merges. Recommended range is between 2 and 50. |
+| carbon.merge.sort.reader.thread | 3 | CarbonData sorts and writes data to 
intermediate files to limit the memory usage. When the intermediate files 
reaches ***carbon.sort.intermediate.files.limit***, the files will be merged in 
another thread pool. This value will control the size of the pool. Each thread 
will read the intermediate files and do merge sort and finally write the 
records to another file. **NOTE:** Refer to 
***carbon.sort.intermediate.files.limit*** for operation description. 
Configuring smaller number of threads can cause merging slow down over loading 
process whereas configuring larger number of threads can cause thread 
contention with threads in other data loading steps. Hence configure a fraction 
of ***carbon.number.of.cores.while.loading***. |
+| carbon.merge.sort.prefetch | true | CarbonData writes every 
***carbon.sort.size*** number of records to intermediate temp files during data 
loading to ensure memory footprint is within limits. These intermediate temp 
files will have to be sorted using merge sort before writing into CarbonData 
format. This configuration enables pre fetching of data from these temp files 
in order to optimize IO and speed up data loading process. |
+| carbon.prefetch.buffersize | 1000 | When the configuration 
***carbon.merge.sort.prefetch*** is configured to true, we need to set the 
number of records that can be prefetched. This configuration is used specify 
the number of records to be prefetched.**NOTE: **Configuring more number of 
records to be prefetched increases memory footprint as more records will have 
to be kept in memory. |
+| enable.inmemory.merge.sort | false | CarbonData sorts and writes data to 
intermediate files to limit the memory usage. These intermediate files needs to 
be sorted again using merge sort before writing to the final carbondata 
file.Performing merge sort in memory would increase the sorting performance at 
the cost of increased memory footprint. This Configuration specifies to do 
in-memory merge sort or to do file based merge sort. |
+| carbon.sort.storage.inmemory.size.inmb | 512 | CarbonData writes every 
***carbon.sort.size*** number of records to intermediate temp files during data 
loading to ensure memory footprint is within limits. When 
***enable.unsafe.sort*** configuration is enabled, instead of using 
***carbon.sort.size*** which is based on rows count, size occupied in memory is 
used to determine when to flush data pages to intermediate temp files. This 
configuration determines the memory to be used for storing data pages in 
memory. **NOTE:** Configuring a higher value ensures more data is maintained in 
memory and hence increases data loading performance due to reduced or no 
IO.Based on the memory availability in the nodes of the cluster, configure the 
values accordingly. |
+| carbon.load.sortmemory.spill.percentage | 0 | During data loading, some data 
pages are kept in memory upto memory configured in 
***carbon.sort.storage.inmemory.size.inmb*** beyond which they are spilled to 
disk as intermediate temporary sort files. This configuration determines after 
what percentage data needs to be spilled to disk. **NOTE:** Without this 
configuration, when the data pages occupy upto configured memory, new data 
pages would be dumped to disk and old pages are still maintained in disk. |
+| carbon.sort.temp.compressor | (none) | CarbonData writes every 
***carbon.sort.size*** number of records to intermediate temp files during data 
loading to ensure memory footprint is within limits. These temporary files can 
be compressed and written in order to save the storage space. This 
configuration specifies the name of compressor to be used to compress the 
intermediate sort temp files during sort procedure in data loading. The valid 
values are 'SNAPPY','GZIP','BZIP2','LZ4','ZSTD' and empty. By default, empty 
means that Carbondata will not compress the sort temp files. **NOTE:** 
Compressor will be useful if you encounter disk bottleneck.Since the data needs 
to be compressed and decompressed,it involves additional CPU cycles,but is 
compensated by the high IO throughput due to less data to be written or read 
from the disks. |
+| carbon.enable.calculate.size | true | **For Load Operation**: Enabling this 
property will let carbondata calculate the size of the carbon data file 
(.carbondata) and the carbon index file (.carbonindex) for each load and update 
the table status file. **For Describe Formatted**: Enabling this property will 
let carbondata calculate the total size of the carbon data files and the carbon 
index files for the each table and display it in describe formatted command. 
**NOTE:** This is useful to determine the overall size of the carbondata table 
and also get an idea of how the table is growing in order to take up other 
backup strategy decisions. |
 | carbon.cutOffTimestamp | (none) | CarbonData has capability to generate the 
Dictionary values for the timestamp columns from the data itself without the 
need to store the computed dictionary values. This configuration sets the start 
date for calculating the timestamp. Java counts the number of milliseconds from 
start of "1970-01-01 00:00:00". This property is used to customize the start of 
position. For example "2000-01-01 00:00:00". **NOTE:** The date must be in the 
form ***carbon.timestamp.format***. CarbonData supports storing data for upto 
68 years.For example, if the cut-off time is 1970-01-01 05:30:00, then data 
upto 2038-01-01 05:30:00 will be supported by CarbonData. |
 | carbon.timegranularity | SECOND | The configuration is used to specify the 
data granularity level such as DAY, HOUR, MINUTE, or SECOND. This helps to 
store more than 68 years of data into CarbonData. |
 | carbon.use.local.dir | false | CarbonData,during data loading, writes files 
to local temp directories before copying the files to HDFS. This configuration 
is used to specify whether CarbonData can write locally to tmp directory of the 
container or to the YARN application directory. |
 | carbon.use.multiple.temp.dir | false | When multiple disks are present in 
the system, YARN is generally configured with multiple disks to be used as temp 
directories for managing the containers. This configuration specifies whether 
to use multiple YARN local directories during data loading for disk IO load 
balancing.Enable ***carbon.use.local.dir*** for this configuration to take 
effect. **NOTE:** Data Loading is an IO intensive operation whose performance 
can be limited by the disk IO threshold, particularly during multi table 
concurrent data load.Configuring this parameter, balances the disk IO across 
multiple disks there by improving the over all load performance. |
-| carbon.sort.temp.compressor | (none) | CarbonData writes every 
***carbon.sort.size*** number of records to intermediate temp files during data 
loading to ensure memory footprint is within limits. These temporary files can 
be compressed and written in order to save the storage space. This 
configuration specifies the name of compressor to be used to compress the 
intermediate sort temp files during sort procedure in data loading. The valid 
values are 'SNAPPY','GZIP','BZIP2','LZ4','ZSTD' and empty. By default, empty 
means that Carbondata will not compress the sort temp files. **NOTE:** 
Compressor will be useful if you encounter disk bottleneck.Since the data needs 
to be compressed and decompressed,it involves additional CPU cycles,but is 
compensated by the high IO throughput due to less data to be written or read 
from the disks. |
 | carbon.load.skewedDataOptimization.enabled | false | During data 
loading,CarbonData would divide the number of blocks equally so as to ensure 
all executors process same number of blocks. This mechanism satisfies most of 
the scenarios and ensures maximum parallel processing for optimal data loading 
performance.In some business scenarios, there might be scenarios where the size 
of blocks vary significantly and hence some executors would have to do more 
work if they get blocks containing more data. This configuration enables size 
based block allocation strategy for data loading. When loading, carbondata will 
use file size based block allocation strategy for task distribution. It will 
make sure that all the executors process the same size of data.**NOTE:** This 
configuration is useful if the size of your input data files varies widely, say 
1MB to 1GB.For this configuration to work effectively,knowing the data pattern 
and size is important and necessary. |
-| carbon.load.min.size.enabled | false | During Data Loading, CarbonData would 
divide the number of files among the available executors to parallelize the 
loading operation. When the input data files are very small, this action causes 
to generate many small carbondata files. This configuration determines whether 
to enable node minumun input data size allocation strategy for data loading.It 
will make sure that the node load the minimum amount of data there by reducing 
number of carbondata files.**NOTE:** This configuration is useful if the size 
of the input data files are very small, like 1MB to 256MB.Refer to 
***load_min_size_inmb*** to configure the minimum size to be considered for 
splitting files among executors. |
+| carbon.load.min.size.enabled | false | During Data Loading, CarbonData would 
divide the number of files among the available executors to parallelize the 
loading operation. When the input data files are very small, this action causes 
to generate many small carbondata files. This configuration determines whether 
to enable node minumun input data size allocation strategy for data loading.It 
will make sure that the node load the minimum amount of data there by reducing 
number of carbondata files.**NOTE:** This configuration is useful if the size 
of the input data files are very small, like 1MB to 256MB. Refer to the load 
option ***load_min_size_inmb*** to configure the minimum size to be considered 
for splitting files among executors. |
 | enable.data.loading.statistics | false | CarbonData has extensive logging 
which would be useful for debugging issues related to performance or hard to 
locate issues. This configuration when made ***true*** would log additional 
data loading statistics information to more accurately locate the issues being 
debugged. **NOTE:** Enabling this would log more debug information to log 
files, there by increasing the log files size significantly in short span of 
time.It is advised to configure the log files size, retention of log files 
parameters in log4j properties appropriately. Also extensive logging is an 
increased IO operation and hence over all data loading performance might get 
reduced. Therefore it is recommended to enable this configuration only for the 
duration of debugging. |
 | carbon.dictionary.chunk.size | 10000 | CarbonData generates dictionary keys 
and writes them to separate dictionary file during data loading. To optimize 
the IO, this configuration determines the number of dictionary keys to be 
persisted to dictionary file at a time. **NOTE:** Writing to file also serves 
as a commit point to the dictionary generated.Increasing more values in memory 
causes more data loss during system or application failure.It is advised to 
alter this configuration judiciously. |
 | dictionary.worker.threads | 1 | CarbonData supports Optimized data loading 
by relying on a dictionary server. Dictionary server helps to maintain 
dictionary values independent of the data loading and there by avoids reading 
the same input data multiples times. This configuration determines the number 
of concurrent dictionary generation or request that needs to be served by the 
dictionary server. **NOTE:** This configuration takes effect when 
***carbon.options.single.pass*** is configured as true.Please refer to 
*carbon.options.single.pass*to understand how dictionary server optimizes data 
loading. |
-| enable.unsafe.sort | true | CarbonData supports unsafe operations of Java to 
avoid GC overhead for certain operations. This configuration enables to use 
unsafe functions in CarbonData. **NOTE:** For operations like data loading, 
which generates more short lived Java objects, Java GC can be a bottle neck. 
Using unsafe can overcome the GC overhead and improve the overall performance. |
-| enable.offheap.sort | true | CarbonData supports storing data in off-heap 
memory for certain operations during data loading and query. This helps to 
avoid the Java GC and thereby improve the overall performance. This 
configuration enables using off-heap memory for sorting of data during data 
loading.**NOTE:**  ***enable.unsafe.sort*** configuration needs to be 
configured to true for using off-heap |
-| enable.inmemory.merge.sort | false | CarbonData sorts and writes data to 
intermediate files to limit the memory usage. These intermediate files needs to 
be sorted again using merge sort before writing to the final carbondata 
file.Performing merge sort in memory would increase the sorting performance at 
the cost of increased memory footprint. This Configuration specifies to do 
in-memory merge sort or to do file based merge sort. |
-| carbon.load.sort.scope | LOCAL_SORT | CarbonData can support various sorting 
options to match the balance between load and query performance. LOCAL_SORT:All 
the data given to an executor in the single load is fully sorted and written to 
carbondata files. Data loading performance is reduced a little as the entire 
data needs to be sorted in the executor. BATCH_SORT:Sorts the data in batches 
of configured size and writes to carbondata files. Data loading performance 
increases as the entire data need not be sorted.But query performance will get 
reduced due to false positives in block pruning and also due to more number of 
carbondata files written.Due to more number of carbondata files, if identified 
blocks > cluster parallelism, query performance and concurrency will get 
reduced.GLOBAL SORT:Entire data in the data load is fully sorted and written to 
carbondata files. Data loading performance would get reduced as the entire data 
needs to be sorted.But the query performance increases si
 gnificantly due to very less false positives and concurrency is also improved. 
**NOTE:** when BATCH_SORT is configured, it is recommended to keep 
***carbon.load.batch.sort.size.inmb*** > ***carbon.blockletgroup.size.in.mb*** |
-| carbon.load.batch.sort.size.inmb | 0 | When  ***carbon.load.sort.scope*** is 
configured as ***BATCH_SORT***, this configuration needs to be added to specify 
the batch size for sorting and writing to carbondata files. **NOTE:** It is 
recommended to keep the value around 45% of 
***carbon.sort.storage.inmemory.size.inmb*** to avoid spill to disk. Also it is 
recommended to keep the value higher than 
***carbon.blockletgroup.size.in.mb***. Refer to *carbon.load.sort.scope* for 
more information on sort options and the advantages/disadvantages of each 
option. |
 | carbon.dictionary.server.port | 2030 | Single Pass Loading enables single 
job to finish data loading with dictionary generation on the fly. It enhances 
performance in the scenarios where the subsequent data loading after initial 
load involves fewer incremental updates on the dictionary.Single pass loading 
can be enabled using the option ***carbon.options.single.pass***. When this 
option is specified, a dictionary server will be internally started to handle 
the dictionary generation and query requests. This configuration specifies the 
port on which the server need to listen for incoming requests.Port value ranges 
between 0-65535 |
-| carbon.merge.sort.prefetch | true | CarbonData writes every 
***carbon.sort.size*** number of records to intermediate temp files during data 
loading to ensure memory footprint is within limits. These intermediate temp 
files will have to be sorted using merge sort before writing into CarbonData 
format. This configuration enables pre fetching of data from these temp files 
in order to optimize IO and speed up data loading process. |
-| carbon.loading.prefetch | false | CarbonData uses univocity parser to read 
csv files. This configuration is used to inform the parser whether it can 
prefetch the data from csv files to speed up the reading.**NOTE:** Enabling 
prefetch improves the data loading performance, but needs higher memory to keep 
more records which are read ahead from disk. |
-| carbon.prefetch.buffersize | 1000 | When the configuration 
***carbon.merge.sort.prefetch*** is configured to true, we need to set the 
number of records that can be prefetched. This configuration is used specify 
the number of records to be prefetched.**NOTE: **Configuring more number of 
records to be prefetched increases memory footprint as more records will have 
to be kept in memory. |
-| load_min_size_inmb | 256 | This configuration is used along with 
***carbon.load.min.size.enabled***. This determines the minimum size of input 
files to be considered for distribution among executors while data 
loading.**NOTE:** Refer to ***carbon.load.min.size.enabled*** for understanding 
when this configuration needs to be used and its advantages and disadvantages. |
-| carbon.load.sortmemory.spill.percentage | 0 | During data loading, some data 
pages are kept in memory upto memory configured in 
***carbon.sort.storage.inmemory.size.inmb*** beyond which they are spilled to 
disk as intermediate temporary sort files. This configuration determines after 
what percentage data needs to be spilled to disk. **NOTE:** Without this 
configuration, when the data pages occupy upto configured memory, new data 
pages would be dumped to disk and old pages are still maintained in disk. |
 | carbon.load.directWriteToStorePath.enabled | false | During data load, all 
the carbondata files are written to local disk and finally copied to the target 
store location in HDFS/S3. Enabling this parameter will make carbondata files 
to be written directly onto target HDFS/S3 location bypassing the local 
disk.**NOTE:** Writing directly to HDFS/S3 saves local disk IO(once for writing 
the files and again for copying to HDFS/S3) there by improving the performance. 
But the drawback is when data loading fails or the application crashes, 
unwanted carbondata files will remain in the target HDFS/S3 location until it 
is cleared during next data load or by running *CLEAN FILES* DDL command |
 | carbon.options.serialization.null.format | \N | Based on the business 
scenarios, some columns might need to be loaded with null values. As null value 
cannot be written in csv files, some special characters might be adopted to 
specify null values. This configuration can be used to specify the null values 
format in the data being loaded. |
-| carbon.sort.storage.inmemory.size.inmb | 512 | CarbonData writes every 
***carbon.sort.size*** number of records to intermediate temp files during data 
loading to ensure memory footprint is within limits. When 
***enable.unsafe.sort*** configuration is enabled, instead of using 
***carbon.sort.size*** which is based on rows count, size occupied in memory is 
used to determine when to flush data pages to intermediate temp files. This 
configuration determines the memory to be used for storing data pages in 
memory. **NOTE:** Configuring a higher value ensures more data is maintained in 
memory and hence increases data loading performance due to reduced or no 
IO.Based on the memory availability in the nodes of the cluster, configure the 
values accordingly. |
 | carbon.column.compressor | snappy | CarbonData will compress the column 
values using the compressor specified by this configuration. Currently 
CarbonData supports 'snappy' and 'zstd' compressors. |
 | carbon.minmax.allowed.byte.count | 200 | CarbonData will write the min max 
values for string/varchar types column using the byte count specified by this 
configuration. Max value is 1000 bytes(500 characters) and Min value is 10 
bytes(5 characters). **NOTE:** This property is useful for reducing the store 
size thereby improving the query performance but can lead to query degradation 
if value is not configured properly. | |
 

http://git-wip-us.apache.org/repos/asf/carbondata/blob/682cac85/docs/performance-tuning.md
----------------------------------------------------------------------
diff --git a/docs/performance-tuning.md b/docs/performance-tuning.md
index f43385a..2b005af 100644
--- a/docs/performance-tuning.md
+++ b/docs/performance-tuning.md
@@ -142,7 +142,7 @@
 |-----------|-------------|--------|
 |carbon.number.of.cores.while.loading|Default: 2. This value should be >= 
2|Specifies the number of cores used for data processing during data loading in 
CarbonData. |
 |carbon.sort.size|Default: 100000. The value should be >= 100.|Threshold to 
write local file in sort step when loading data|
-|carbon.sort.file.write.buffer.size|Default:  50000.|DataOutputStream buffer. |
+|carbon.sort.file.write.buffer.size|Default:  16384.|CarbonData sorts and 
writes data to intermediate files to limit the memory usage. This configuration 
determines the buffer size to be used for reading and writing such files. |
 |carbon.merge.sort.reader.thread|Default: 3 |Specifies the number of cores 
used for temp file merging during data loading in CarbonData.|
 |carbon.merge.sort.prefetch|Default: true | You may want set this value to 
false if you have not enough memory|
 

Reply via email to