(47) ElasticSearch the bulk syntax parsing

  1, bulk format:

{action:{metadata}}\n
{requestbody}\n

  2, why not use the following format:

[
  {
    "action":{},
    "data":{}
  }
]

  In this way readable, but internal processing is in trouble: consuming more memory, increasing the cost of java virtual machine

  1) to resolve the array JSONArray json object in memory, there is a need json copy text, in addition to a target JSONArray
  2) parsing json json each array, each routing request document
  3) is routed to a plurality of requests on the same shard, a request to create an array of
  4) this request is serialized array
  5) sends a request to the array of the node corresponding to sequences up

  3, using the first benefits:

  1) without converting it to json object directly in accordance with the cutting line breaks json, unnecessary memory copying text json
  2) for each pair of two json, read Meta, for routing document
  3) directly to the corresponding json sent to the node up

Guess you like

Origin www.cnblogs.com/javasl/p/12652425.html