7.1 Why use bulk peculiar json format?

review:
Bulk syntax requires: Each string can not wrap json, json different strings must wrap
 
Why not use standard json array it? Such as:
[
    {
        "create":{...}
    },
    {
        "update":{...}s
    }
]
 
Because, if this Json array, ES need to do is
  1. Json string converted into an array of objects
  2. Designated by the index Json each, type, id, routed to the corresponding shard
  3. Performing operations on the corresponding shard
You can see, first of all, string Json turn is time-consuming ; secondly, ES need to save a string in memory, a Json object is duplicate data. Thus, when a large bulk content when ES will lead to unnecessary memory footprint, but will affect the search, aggregation request rate, and a lot of junk data, will cause the jvm GC more, take up more time .
 
And, if the bulk of the provisions, each with a row of json way,
ES need to do is:
  1. Segmentation request string
  2. Take the command type (create, update), index, type
  3. Each line string directly (or every two rows), made up to the corresponding shard, get away.
There will be no memory wasted time and unnecessary expenses.
 
So, this syntax, the main consideration is the ES performance issues. Worth learning
 

Guess you like

Origin www.cnblogs.com/cc299/p/11032813.html