# Commit log lead to very high iops while using LWT

**URL:** <https://forum.scylladb.com/t/commit-log-lead-to-very-high-iops-while-using-lwt/659>\
**Category:** ScyllaDB\
**Tags:** lwt, performance\
**Created:** [June 29, 2023, 9:55am UTC](https://forum.scylladb.com/t/commit-log-lead-to-very-high-iops-while-using-lwt/659 "2023-06-29T09:55:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jia\_song](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/jia_song/32/368_2.png) [@jia\_song](https://forum.scylladb.com/u/jia_song)\
**Post date:** [June 29, 2023, 9:55am UTC](https://forum.scylladb.com/t/commit-log-lead-to-very-high-iops-while-using-lwt/659/1 "2023-06-29T09:55:47Z")

</div>

My team is testing scylla in id mapping situation recently. And in our situation, we want to keep the first id value, so we used LWT(IF NOT EXISTS) to do insert.  
However, the throughput of our test is very low, just 3000 row/s in 2-replica keyspace, and we found that the iops have reached 10k/s in each node. I know that LWT will force to sync commit log, but it’s using too much IO.  
Is that normal? How could I make it better?  
The test cluster: 3 nodes(16c/32G)

---

<div class="post-metadata">

**Author:** ![Botond\_Denes](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/botond_denes/32/163_2.png) [@Botond\_Denes](https://forum.scylladb.com/u/Botond_Denes)\
**Post date:** [July 26, 2023, 5:26am UTC](https://forum.scylladb.com/t/commit-log-lead-to-very-high-iops-while-using-lwt/659/2 "2023-07-26T05:26:03Z")

</div>

Indeed ScyllaDB needs to do a disk write for each LWT operation. Normally, ScyllaDB uses periodic sync for commitlog, meaning that at the end of each sync period, all accumulated writes are flushed to disk. This is not good enought for LWT as it need stronger guarantees on the persistence of writes, therefore writes done on behalf of LWT are immediately flushed to disk. The elevated IOPS count is therefore unavoidable with LWT.

---

<div class="post-metadata">

**Author:** ![Konstantin\_Osipov](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/konstantin_osipov/32/301_2.png) [@Konstantin\_Osipov](https://forum.scylladb.com/u/Konstantin_Osipov)\
**Post date:** [July 27, 2023, 12:56pm UTC](https://forum.scylladb.com/t/commit-log-lead-to-very-high-iops-while-using-lwt/659/4 "2023-07-27T12:56:54Z")

</div>

LWT performs multiple cluster write rounds - prepare, promise, accept, learn, prune - and each writes to disk. Prepare, promise and accept write in sync mode.

---

<div class="post-metadata">

**Author:** ![jia\_song](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/jia_song/32/368_2.png) [@jia\_song](https://forum.scylladb.com/u/jia_song)\
**Post date:** [July 28, 2023, 6:36am UTC](https://forum.scylladb.com/t/commit-log-lead-to-very-high-iops-while-using-lwt/659/6 "2023-07-28T06:36:06Z")

</div>

Thank you for your reply!  
Is there any solution to decrease the IOPS caused by LWT? What if using condition batch? Could it be better if I decrease the paxos rounds?
