repo-analysis-api.asciidoc 19 KB

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