maximizing write throughput when calling WT_SESSION::commit_transaction

26 views
Skip to first unread message

Richard From UK

unread,
Jun 17, 2024, 2:53:34 AMJun 17
to wiredtiger-users
Hi suppose we have a rest server offering an api to read data and send transactions to wiredtiger. When two concurrent transaction requests arrive there can be two concurrent calls to commit_transaction in different sessions. This seems to work ok but can you tell me what's the best way to optimise total throughput - should I consider having a dedicated write thread ? so that commit_transaction only happens on the same thread and session ? or does the wiredtiger implementation already take steps to optimize concurrent calls to commit_transaction ? 

Chenhao Qu

unread,
Jun 17, 2024, 7:10:58 PMJun 17
to wiredtig...@googlegroups.com
Hi Richard,

I don’t clearly understand your question. If your goal is to maximise write throughput and you have a multi-core machine, you should get a higher throughput by writing with multiple sessions. Do you observe any contention when calling WT_SESSION::commit_transaction?

On 17 Jun 2024, at 4:53 PM, Richard From UK <ramurp...@gmail.com> wrote:

Hi suppose we have a rest server offering an api to read data and send transactions to wiredtiger. When two concurrent transaction requests arrive there can be two concurrent calls to commit_transaction in different sessions. This seems to work ok but can you tell me what's the best way to optimise total throughput - should I consider having a dedicated write thread ? so that commit_transaction only happens on the same thread and session ? or does the wiredtiger implementation already take steps to optimize concurrent calls to commit_transaction ? 

--
You received this message because you are subscribed to the Google Groups "wiredtiger-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wiredtiger-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wiredtiger-users/19961f73-8dce-4ebb-942e-f952e362b54cn%40googlegroups.com.

Richard From UK

unread,
Jun 18, 2024, 3:37:49 AMJun 18
to wiredtiger-users

Thank you for the response. Yes it's a reasonable machine for testing : 24 core with 200GB ram and a locally attached ssd. I'm testing write throughput but i never get close to what the disk is capable of - including taking into account the small size of my typical writes (2kb-8kb). The default implementation of the rest server that wraps wiredtiger has support for multi threading and my code assigns a thread local session per each of 24 threads. I then test the throughput with approx 150 rest clients all writing say 2kb key-values. I get a total of about 4000 x 2Kb writes per second so that's a total of 8MB/sec. I see the process uses quite a bit of cpu (top reports ~12 cores maxed out) but iostat reports low disk utilisation, i've disabled compression because the key value is already compressed. I'm unclear if wiredtiger transactions are best done in one thread or should i expect best throughput when committing transactions from multiple threads ? If the latter then I will leave the code as it is, if it's uncertain I will trial new code to route transactions to a single thread.

Chenhao Qu

unread,
Jun 18, 2024, 3:49:35 AMJun 18
to wiredtig...@googlegroups.com
Hi Richard,

Thanks for reaching out. All WiredTiger writes happen in memory if you disable logging. Not until WiredTiger has aggregated enough dirty content in memory, it then starts to write out the dirty data to disk. Given that you have a fairly large cache, it would take a while for WireTiger to start to write data to disk. To answer your question, WiredTiger definitely performs better with multiple threads.


Richard From UK

unread,
Jun 18, 2024, 6:27:58 AMJun 18
to wiredtiger-users
thanks for your response. My writes must be durable so I need journaling/write-ahead-log enabled so i would expect commit_transaction to write to disk - is that correct ?  this is my argument to wiredtiger_open : cache_size=100GB,eviction=(threads_min=6,threads_max=12),log=(enabled=true,path=journal,archive=false).  Does enabling transaction logging change how to get best write throughput ? 

Chenhao Qu

unread,
Jun 18, 2024, 6:07:30 PMJun 18
to wiredtig...@googlegroups.com
Hi Richard,

Even with journalling, using multiple threads still should give you better throughput.

Reply all
Reply to author
Forward
0 new messages