repo-analysis-api.asciidoc 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. [role="xpack"]
  2. [[repo-analysis-api]]
  3. === Repository analysis API
  4. ++++
  5. <titleabbrev>Repository analysis</titleabbrev>
  6. ++++
  7. Analyzes a repository, reporting its performance characteristics and any
  8. incorrect behaviour found.
  9. ////
  10. [source,console]
  11. ----
  12. PUT /_snapshot/my_repository
  13. {
  14. "type": "fs",
  15. "settings": {
  16. "location": "my_backup_location"
  17. }
  18. }
  19. ----
  20. // TESTSETUP
  21. ////
  22. [source,console]
  23. ----
  24. POST /_snapshot/my_repository/_analyze?blob_count=10&max_blob_size=1mb&timeout=120s
  25. ----
  26. [[repo-analysis-api-request]]
  27. ==== {api-request-title}
  28. `POST /_snapshot/<repository>/_analyze`
  29. [[repo-analysis-api-desc]]
  30. ==== {api-description-title}
  31. There are a large number of third-party storage systems available, not all of
  32. which are suitable for use as a snapshot repository by {es}. Some storage
  33. systems behave incorrectly, or perform poorly, especially when accessed
  34. concurrently by multiple clients as the nodes of an {es} cluster do.
  35. The Repository analysis API performs a collection of read and write operations
  36. on your repository which are designed to detect incorrect behaviour and to
  37. measure the performance characteristics of your storage system.
  38. The default values for the parameters to this API are deliberately low to
  39. reduce the impact of running an analysis inadvertently. A realistic experiment
  40. should set `blob_count` to at least `2000`, `max_blob_size` to at least `2gb`,
  41. and `max_total_data_size` to at least `1tb`, and will almost certainly need to
  42. increase the `timeout` to allow time for the process to complete successfully.
  43. You should run the analysis on a multi-node cluster of a similar size to your
  44. production cluster so that it can detect any problems that only arise when the
  45. repository is accessed by many nodes at once.
  46. If the analysis is successful this API returns details of the testing process,
  47. optionally including how long each operation took. You can use this information
  48. to determine the performance of your storage system. If any operation fails or
  49. returns an incorrect result, this API returns an error. If the API returns an
  50. error then it may not have removed all the data it wrote to the repository. The
  51. error will indicate the location of any leftover data, and this path is also
  52. recorded in the {es} logs. You should verify yourself that this location has
  53. been cleaned up correctly. If there is still leftover data at the specified
  54. location then you should manually remove it.
  55. If the connection from your client to {es} is closed while the client is
  56. waiting for the result of the analysis then the test is cancelled. Some clients
  57. are configured to close their connection if no response is received within a
  58. certain timeout. An analysis takes a long time to complete so you may need to
  59. relax any such client-side timeouts. On cancellation the analysis attempts to
  60. clean up the data it was writing, but it may not be able to remove it all. The
  61. path to the leftover data is recorded in the {es} logs. You should verify
  62. yourself that this location has been cleaned up correctly. If there is still
  63. leftover data at the specified location then you should manually remove it.
  64. If the analysis is successful then it detected no incorrect behaviour, but this
  65. does not mean that correct behaviour is guaranteed. The analysis attempts to
  66. detect common bugs but it certainly does not offer 100% coverage. Additionally,
  67. it does not test the following:
  68. - Your repository must perform durable writes. Once a blob has been written it
  69. must remain in place until it is deleted, even after a power loss or similar
  70. disaster.
  71. - Your repository must not suffer from silent data corruption. Once a blob has
  72. been written its contents must remain unchanged until it is deliberately
  73. modified or deleted.
  74. - Your repository must behave correctly even if connectivity from the cluster
  75. is disrupted. Reads and writes may fail in this case, but they must not return
  76. incorrect results.
  77. IMPORTANT: An analysis writes a substantial amount of data to your repository
  78. and then reads it back again. This consumes bandwidth on the network between
  79. the cluster and the repository, and storage space and IO bandwidth on the
  80. repository itself. You must ensure this load does not affect other users of
  81. these systems. Analyses respect the repository settings
  82. `max_snapshot_bytes_per_sec` and `max_restore_bytes_per_sec` if available, and
  83. the cluster setting `indices.recovery.max_bytes_per_sec` which you can use to
  84. limit the bandwidth they consume.
  85. NOTE: This API is intended for exploratory use by humans. You should expect the
  86. request parameters and the response format to vary in future versions.
  87. NOTE: This API may not work correctly in a mixed-version cluster.
  88. ==== Implementation details
  89. NOTE: This section of documentation describes how the Repository analysis API
  90. works in this version of {es}, but you should expect the implementation to vary
  91. between versions. The request parameters and response format depend on details
  92. of the implementation so may also be different in newer versions.
  93. The analysis comprises a number of blob-level tasks, as set by the `blob_count`
  94. parameter. The blob-level tasks are distributed over the data and
  95. master-eligible nodes in the cluster for execution.
  96. For most blob-level tasks, the executing node first writes a blob to the
  97. repository, and then instructs some of the other nodes in the cluster to
  98. attempt to read the data it just wrote. The size of the blob is chosen
  99. randomly, according to the `max_blob_size` and `max_total_data_size`
  100. parameters. If any of these reads fails then the repository does not implement
  101. the necessary read-after-write semantics that {es} requires.
  102. For some blob-level tasks, the executing node will instruct some of its peers
  103. to attempt to read the data before the writing process completes. These reads
  104. are permitted to fail, but must not return partial data. If any read returns
  105. partial data then the repository does not implement the necessary atomicity
  106. semantics that {es} requires.
  107. For some blob-level tasks, the executing node will overwrite the blob while its
  108. peers are reading it. In this case the data read may come from either the
  109. original or the overwritten blob, but the read operation must not return
  110. partial data or a mix of data from the two blobs. If any of these reads returns
  111. partial data or a mix of the two blobs then the repository does not implement
  112. the necessary atomicity semantics that {es} requires for overwrites.
  113. The executing node will use a variety of different methods to write the blob.
  114. For instance, where applicable, it will use both single-part and multi-part
  115. uploads. Similarly, the reading nodes will use a variety of different methods
  116. to read the data back again. For instance they may read the entire blob from
  117. start to end, or may read only a subset of the data.
  118. [[repo-analysis-api-path-params]]
  119. ==== {api-path-parms-title}
  120. `<repository>`::
  121. (Required, string)
  122. Name of the snapshot repository to test.
  123. [[repo-analysis-api-query-params]]
  124. ==== {api-query-parms-title}
  125. `blob_count`::
  126. (Optional, integer) The total number of blobs to write to the repository during
  127. the test. Defaults to `100`. For realistic experiments you should set this to
  128. at least `2000`.
  129. `max_blob_size`::
  130. (Optional, <<size-units, size units>>) The maximum size of a blob to be written
  131. during the test. Defaults to `10mb`. For realistic experiments you should set
  132. this to at least `2gb`.
  133. `max_total_data_size`::
  134. (Optional, <<size-units, size units>>) An upper limit on the total size of all
  135. the blobs written during the test. Defaults to `1gb`. For realistic experiments
  136. you should set this to at least `1tb`.
  137. `timeout`::
  138. (Optional, <<time-units, time units>>) Specifies the period of time to wait for
  139. the test to complete. If no response is received before the timeout expires,
  140. the test is cancelled and returns an error. Defaults to `30s`.
  141. ===== Advanced query parameters
  142. The following parameters allow additional control over the analysis, but you
  143. will usually not need to adjust them.
  144. `concurrency`::
  145. (Optional, integer) The number of write operations to perform concurrently.
  146. Defaults to `10`.
  147. `read_node_count`::
  148. (Optional, integer) The number of nodes on which to perform a read operation
  149. after writing each blob. Defaults to `10`.
  150. `early_read_node_count`::
  151. (Optional, integer) The number of nodes on which to perform an early read
  152. operation while writing each blob. Defaults to `2`. Early read operations are
  153. only rarely performed.
  154. `rare_action_probability`::
  155. (Optional, double) The probability of performing a rare action (an early read
  156. or an overwrite) on each blob. Defaults to `0.02`.
  157. `seed`::
  158. (Optional, integer) The seed for the pseudo-random number generator used to
  159. generate the list of operations performed during the test. To repeat the same
  160. set of operations in multiple experiments, use the same seed in each
  161. experiment. Note that the operations are performed concurrently so may not
  162. always happen in the same order on each run.
  163. `detailed`::
  164. (Optional, boolean) Whether to return detailed results, including timing
  165. information for every operation performed during the analysis. Defaults to
  166. `false`, meaning to return only a summary of the analysis.
  167. [role="child_attributes"]
  168. [[repo-analysis-api-response-body]]
  169. ==== {api-response-body-title}
  170. The response exposes implementation details of the analysis which may change
  171. from version to version. The response body format is therefore not considered
  172. stable and may be different in newer versions.
  173. `coordinating_node`::
  174. (object)
  175. Identifies the node which coordinated the analysis and performed the final cleanup.
  176. +
  177. .Properties of `coordinating_node`
  178. [%collapsible%open]
  179. ====
  180. `id`::
  181. (string)
  182. The id of the coordinating node.
  183. `name`::
  184. (string)
  185. The name of the coordinating node
  186. ====
  187. `repository`::
  188. (string)
  189. The name of the repository that was the subject of the analysis.
  190. `blob_count`::
  191. (integer)
  192. The number of blobs written to the repository during the test, equal to the
  193. `?blob_count` request parameter.
  194. `concurrency`::
  195. (integer)
  196. The number of write operations performed concurrently during the test, equal to
  197. the `?concurrency` request parameter.
  198. `read_node_count`::
  199. (integer)
  200. The limit on the number of nodes on which read operations were performed after
  201. writing each blob, equal to the `?read_node_count` request parameter.
  202. `early_read_node_count`::
  203. (integer)
  204. The limit on the number of nodes on which early read operations were performed
  205. after writing each blob, equal to the `?early_read_node_count` request
  206. parameter.
  207. `max_blob_size`::
  208. (string)
  209. The limit on the size of a blob written during the test, equal to the
  210. `?max_blob_size` parameter.
  211. `max_blob_size_bytes`::
  212. (long)
  213. The limit, in bytes, on the size of a blob written during the test, equal to
  214. the `?max_blob_size` parameter.
  215. `max_total_data_size`::
  216. (string)
  217. The limit on the total size of all blob written during the test, equal to the
  218. `?max_total_data_size` parameter.
  219. `max_total_data_size_bytes`::
  220. (long)
  221. The limit, in bytes, on the total size of all blob written during the test,
  222. equal to the `?max_total_data_size` parameter.
  223. `seed`::
  224. (long)
  225. The seed for the pseudo-random number generator used to generate the operations
  226. used during the test. Equal to the `?seed` request parameter if set.
  227. `rare_action_probability`::
  228. (double)
  229. The probability of performing rare actions during the test. Equal to the
  230. `?rare_action_probability` request parameter.
  231. `blob_path`::
  232. (string)
  233. The path in the repository under which all the blobs were written during the
  234. test.
  235. `issues_detected`::
  236. (list)
  237. A list of correctness issues detected, which will be empty if the API
  238. succeeded. Included to emphasize that a successful response does not guarantee
  239. correct behaviour in future.
  240. `summary`::
  241. (object)
  242. A collection of statistics that summarise the results of the test.
  243. +
  244. .Properties of `summary`
  245. [%collapsible%open]
  246. ====
  247. `write`::
  248. (object)
  249. A collection of statistics that summarise the results of the write operations
  250. in the test.
  251. +
  252. .Properties of `write`
  253. [%collapsible%open]
  254. =====
  255. `count`::
  256. (integer)
  257. The number of write operations performed in the test.
  258. `total_size`::
  259. (string)
  260. The total size of all the blobs written in the test.
  261. `total_size_bytes`::
  262. (long)
  263. The total size of all the blobs written in the test, in bytes.
  264. `total_throttled`::
  265. (string)
  266. The total time spent waiting due to the `max_snapshot_bytes_per_sec` throttle.
  267. `total_throttled_nanos`::
  268. (long)
  269. The total time spent waiting due to the `max_snapshot_bytes_per_sec` throttle,
  270. in nanoseconds.
  271. `total_elapsed`::
  272. (string)
  273. The total elapsed time spent on writing blobs in the test.
  274. `total_elapsed_nanos`::
  275. (long)
  276. The total elapsed time spent on writing blobs in the test, in nanoseconds.
  277. =====
  278. `read`::
  279. (object)
  280. A collection of statistics that summarise the results of the read operations in
  281. the test.
  282. +
  283. .Properties of `read`
  284. [%collapsible%open]
  285. =====
  286. `count`::
  287. (integer)
  288. The number of read operations performed in the test.
  289. `total_size`::
  290. (string)
  291. The total size of all the blobs or partial blobs read in the test.
  292. `total_size_bytes`::
  293. (long)
  294. The total size of all the blobs or partial blobs read in the test, in bytes.
  295. `total_wait`::
  296. (string)
  297. The total time spent waiting for the first byte of each read request to be
  298. received.
  299. `total_wait_nanos`::
  300. (long)
  301. The total time spent waiting for the first byte of each read request to be
  302. received, in nanoseconds.
  303. `max_wait`::
  304. (string)
  305. The maximum time spent waiting for the first byte of any read request to be
  306. received.
  307. `max_wait_nanos`::
  308. (long)
  309. The maximum time spent waiting for the first byte of any read request to be
  310. received, in nanoseconds.
  311. `total_throttled`::
  312. (string)
  313. The total time spent waiting due to the `max_restore_bytes_per_sec` or
  314. `indices.recovery.max_bytes_per_sec` throttles.
  315. `total_throttled_nanos`::
  316. (long)
  317. The total time spent waiting due to the `max_restore_bytes_per_sec` or
  318. `indices.recovery.max_bytes_per_sec` throttles, in nanoseconds.
  319. `total_elapsed`::
  320. (string)
  321. The total elapsed time spent on reading blobs in the test.
  322. `total_elapsed_nanos`::
  323. (long)
  324. The total elapsed time spent on reading blobs in the test, in nanoseconds.
  325. =====
  326. ====
  327. `details`::
  328. (array)
  329. A description of every read and write operation performed during the test. This
  330. is only returned if the `?detailed` request parameter is set to `true`.
  331. +
  332. .Properties of items within `details`
  333. [%collapsible]
  334. ====
  335. `blob`::
  336. (object)
  337. A description of the blob that was written and read.
  338. +
  339. .Properties of `blob`
  340. [%collapsible%open]
  341. =====
  342. `name`::
  343. (string)
  344. The name of the blob.
  345. `size`::
  346. (string)
  347. The size of the blob.
  348. `size_bytes`::
  349. (long)
  350. The size of the blob in bytes.
  351. `read_start`::
  352. (long)
  353. The position, in bytes, at which read operations started.
  354. `read_end`::
  355. (long)
  356. The position, in bytes, at which read operations completed.
  357. `read_early`::
  358. (boolean)
  359. Whether any read operations were started before the write operation completed.
  360. `overwritten`::
  361. (boolean)
  362. Whether the blob was overwritten while the read operations were ongoing.
  363. =====
  364. `writer_node`::
  365. (object)
  366. Identifies the node which wrote this blob and coordinated the read operations.
  367. +
  368. .Properties of `writer_node`
  369. [%collapsible%open]
  370. =====
  371. `id`::
  372. (string)
  373. The id of the writer node.
  374. `name`::
  375. (string)
  376. The name of the writer node
  377. =====
  378. `write_elapsed`::
  379. (string)
  380. The elapsed time spent writing this blob.
  381. `write_elapsed_nanos`::
  382. (long)
  383. The elapsed time spent writing this blob, in nanoseconds.
  384. `overwrite_elapsed`::
  385. (string)
  386. The elapsed time spent overwriting this blob. Omitted if the blob was not
  387. overwritten.
  388. `overwrite_elapsed_nanos`::
  389. (long)
  390. The elapsed time spent overwriting this blob, in nanoseconds. Omitted if the
  391. blob was not overwritten.
  392. `write_throttled`::
  393. (string)
  394. The length of time spent waiting for the `max_snapshot_bytes_per_sec` throttle
  395. while writing this blob.
  396. `write_throttled_nanos`::
  397. (long)
  398. The length of time spent waiting for the `max_snapshot_bytes_per_sec` throttle
  399. while writing this blob, in nanoseconds.
  400. `reads`::
  401. (array)
  402. A description of every read operation performed on this blob.
  403. +
  404. .Properties of items within `reads`
  405. [%collapsible%open]
  406. =====
  407. `node`::
  408. (object)
  409. Identifies the node which performed the read operation.
  410. +
  411. .Properties of `node`
  412. [%collapsible%open]
  413. ======
  414. `id`::
  415. (string)
  416. The id of the reader node.
  417. `name`::
  418. (string)
  419. The name of the reader node
  420. ======
  421. `before_write_complete`::
  422. (boolean)
  423. Whether the read operation may have started before the write operation was
  424. complete. Omitted if `false`.
  425. `found`::
  426. (boolean)
  427. Whether the blob was found by this read operation or not. May be `false` if the
  428. read was started before the write completed.
  429. `first_byte_time`::
  430. (string)
  431. The length of time waiting for the first byte of the read operation to be
  432. received. Omitted if the blob was not found.
  433. `first_byte_time_nanos`::
  434. (long)
  435. The length of time waiting for the first byte of the read operation to be
  436. received, in nanoseconds. Omitted if the blob was not found.
  437. `elapsed`::
  438. (string)
  439. The length of time spent reading this blob. Omitted if the blob was not found.
  440. `elapsed_nanos`::
  441. (long)
  442. The length of time spent reading this blob, in nanoseconds. Omitted if the blob
  443. was not found.
  444. `throttled`::
  445. (string)
  446. The length of time spent waiting due to the `max_restore_bytes_per_sec` or
  447. `indices.recovery.max_bytes_per_sec` throttles during the read of this blob.
  448. Omitted if the blob was not found.
  449. `throttled_nanos`::
  450. (long)
  451. The length of time spent waiting due to the `max_restore_bytes_per_sec` or
  452. `indices.recovery.max_bytes_per_sec` throttles during the read of this blob, in
  453. nanoseconds. Omitted if the blob was not found.
  454. =====
  455. ====
  456. `listing_elapsed`::
  457. (string)
  458. The time it took to retrieve a list of all the blobs in the container.
  459. `listing_elapsed_nanos`::
  460. (long)
  461. The time it took to retrieve a list of all the blobs in the container, in
  462. nanoseconds.
  463. `delete_elapsed`::
  464. (string)
  465. The time it took to delete all the blobs in the container.
  466. `delete_elapsed_nanos`::
  467. (long)
  468. The time it took to delete all the blobs in the container, in nanoseconds.