# Random spike in write performance

**URL:** <https://discuss.elastic.co/t/random-spike-in-write-performance/336635>\
**Category:** Elasticsearch\
**Created:** [June 22, 2023, 2:33am UTC](https://discuss.elastic.co/t/random-spike-in-write-performance/336635 "2023-06-22T02:33:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dna01](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dna01/32/120361_2.png) [@dna01](https://discuss.elastic.co/u/dna01)\
**Post date:** [June 22, 2023, 2:33am UTC](https://discuss.elastic.co/t/random-spike-in-write-performance/336635/1 "2023-06-22T02:33:13Z")

</div>

I'm noticing random "slowness" when writing. e.g., while most of the time the write operation completed under 20ms, there are occasional write operation that took \>1s.  
my setup:

- 6 data nodes, 24G JVM heap. (there are 3 additional master nodes)
- there are 2 index with heavy write only, 1 index with heavy read+write, 1 index with heavy write+moderate read.
- index shard are spread out evenly across all nodes. 2 index have 12 primaries and 2 have 6 primaries. all have 1 replica.

this random "slowness" happen randomly on all write heavy index. each index roughly receive 5 write operation / second.

after enabling tracing on 'logger.org.elasticsearch.index" I found that when a node is refreshing a shard it "suspend" all write, even when writing on different index. e.g., suppose the node is currently refreshing shards of index\_A, and write request coming in for index\_B, the write request to index\_B doesnt complete/return until that node finishes refreshing index\_A.  
this behaviour compounded by additional replica shard. since the write request cannot complete until it finishes writing the replica as well. thus if any of the nodes (1 primary and n replica), where the write operation is processed, is currently refreshing, the write request experience the "slowness".

is this the correct behaviour?

any suggestion on how to reduce the the duration or the frequency of this "slowness" issue is greatly appreciated.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 20, 2023, 2:33am UTC](https://discuss.elastic.co/t/random-spike-in-write-performance/336635/2 "2023-07-20T02:33:59Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
