Db2

 View Only

 Db2 LUW commit time

Roberto Stradella's profile image
Roberto Stradella posted Thu August 28, 2025 05:59 AM

Hello,

we are moving DB2 zOS v 12.0 to Db2 Linux v 11.5.9 in AWS EC2 environment. IBM COBOL online/batch applications running in mainframe have been converted to Java language and are running from a separate AWS EC2 server. We are running the stress test and for for a limited number of jobs (about 15) we are experiencing performance problems with a very high execution time in Linux as referred to the mainframe jobs.

Application people went deeper in the Java code and told us that the time where the job spend lot of time is the COMMIT. The job performs about 500.000 UPDATE statements updating a table row by row, the COMMIT is done at every SQL statement: UPDATE statement + COMMIT statement and so on. In mainframe the 500.000 COMMITs take no more than 180 seconds, in Linux take about 20 minutes.

There are a lot of discussion between DBA and Application people: from Db2 side we think to have the right configuration to avoid long COMMIT time, from Java side they have changed the application behaviour to have a COMMIT every 1.000 rows updated but the COMMIT time seems still high.

Does anyone know what is the execution time for a COMMIT to use as reference ? 

Any suggestions are welcome.

Thanks. Ciao. Roberto

Roland Schock's profile image
Roland Schock IBM Champion

Hello Roberto,

there is no "standard commit time" for reference. It all depends on your workload and your setup for transactional logging and the disk with the transaction logs.

What has to be done at commit internally when an application is executing this statement? Well, without HADR Db2 has at least to flush the logbuffer to the transaction logs. This might take some time, depending on the size of the logbuffer and the disks your transaction logs are on. Best practice is to have your fastest disk available for the logs and use them only for the logs. So no data or index containers on the same device. Some customers use NVMe SSD's for the logs.

You can monitor some commit time details via e.g. MON_GET_CONNECTION 

https://www.ibm.com/docs/en/db2/12.1.0?topic=routines-mon-get-connection-get-connection-metrics

Many years ago there was a config value of MIN_COMMIT, but it was removed/hidden because it caused so much troubles at unknowing customers having not a constant flood of many transactions per second. But set your logging time straight first. 

Cheers
Roland

Joachim Klassen's profile image
Joachim Klassen IBM Champion

Hello Roberto,

additionaly to Rolands comment you may want to use Db2 Monitoring Functions  MON_GET_TRANSACTION_LOG , MON_GET_UNIT_OF_WORK and MON_GET_ACTIVITY which give you more details on Log Disk Write time or Log Disk Wait time - see https://www.ibm.com/docs/en/db2/11.5.x?topic=mmr-mon-get-transaction-log-table-function-get-log-information,https://www.ibm.com/docs/en/db2/11.5.x?topic=mmr-mon-get-unit-work-get-unit-work-metrics and https://www.ibm.com/docs/en/db2/11.5.x?topic=routines-mon-get-activity-return-list-activities.


What size has the log buffer (DB CFG LOGBUFSZ)?

Joachim

Roberto Stradella's profile image
Roberto Stradella

Hello, thanks for the answers provided. In this case MIN_COMMIT could be helpful but as Roland write, without a constant flood of many transactions per second it cause a performance problem.

@Joachim, LOGBUFSZ is configured to 4096. I will try to reduce to 2048 and test how many time takes the COMMIT process.

Thanks. Ciao. Roberto.

malek shabou's profile image
malek shabou

Hi Roberto,

where do you store your online transaction logs ? do you use an EBS volumes or are you using local volume ? evry commit sync the io to the disk so often the pain point is io/s.

have you tried to run db2mon ?

Malek,

Samuel Pizarro's profile image
Samuel Pizarro

Roberto

As other said,  most probably, your disk is not handling the commit rate.  it's a common issue if you don't request a fast tier storage for your logs.  

As @Roland Schock said: "There is no standard commit time" ,  but that does not mean you can't compare you values from other systems 

Here are my values, so you can use for comparison. It's a big high IO intense system.  
It makes 580k transactions/minute   in average, constantly.  Small variation on this rate..  

and the Avg LOG_Write_TIME  taken from mon_get_transaction_log() is less then 0.3ms  

select LOG_WRITES, LOG_WRITE_TIME,   (dec(log_write_time, 20,5) / log_writes) avg_write_time  from table(mon_get_transaction_log(-1)) as t

LOG_WRITES  LOG_WRITE_TIME AVG_WRITE_TIME
----------- -------------- --------------
 1613067875      413812979          0.256


Yes,  We had to ask our host Vendor to supply their FASTEST disk, to save our active transaction logs. 
In other word, we have a small but FAST disk , just to hold our active transaction logs area.  Normally, you don't need that expensive disk for your entire db. 

malek shabou's profile image
malek shabou

Hi Roberto,

how do the developpers  make the update, one by one or they are using Batch Updates (https://jenkov.com/tutorials/jdbc/batchupdate.html). 

if update is done one by one, maybe the probleme is netwrok latency (RTT ), java need to wait for network ACK before sending the next update.

Roberto Stradella's profile image
Roberto Stradella

Hello,

thanks to all for the suggestions provided. About the storage we are using, this is our configuration: EBS gp3 volume 15.000 IOPS 500 Throughput (MiB/s). A single xfs filesystem has been configured over the EBS gp3 volume and some subdirectory have been created where to store all the database objects (dbpath, storagepath, logpath, mirrorlogpath, failarchpath).

Kostas Rakopoulos's profile image
Kostas Rakopoulos
Hi Roberto,
Network attached storage such as EBS can certainly hurt your commit times as a result of the increased latency they have compared to locally attached disks. Latency (time per 4KB write I/O) is really the main metric we care about for log disks. We have observed with AWS EBS storage that as you get close to the IOPS limit, your latency will suffer, so be sure to also track how close you are to the IOPS limit. EBS gp3 is of course slower (but cheaper) than io2. io2 will have lower latency which makes it a better choice for log disks. However before you consider spending more, you should confirm log disk write times are in fact your commit time bottleneck. For some details on how to identify a log disk bottleneck, I suggest you look at https://community.ibm.com/community/user/blogs/kostas-rakopoulos/2025/03/25/db2mon-intro specifically section "Common bottleneck example: Slow log writes".
I will call out a couple things I noticed that go against best practices:
>>> A single xfs filesystem has been configured over the EBS gp3 volume and some subdirectory have been created where to store all the database objects (dbpath, storagepath, logpath, mirrorlogpath, failarchpath).
This is very unlikely to perform well, your IOPS are being shared between db path, log path, mirror log, etc. You should have dedicated IOPS for log disks. If log mirroring is enabled, you will now be paying the log disk latency twice during commit time. For log mirroring you really should use a separate disk and file system not only for performance reasons but also for redundancy (e.g., if fs with logs is corrupted, mirrored logs will be corrupted as well). So you'd probably want 4 EBS volumes, one for data, one for logs, one for mirrored logs and another for your log archives.
>>>  The job performs about 500.000 UPDATE statements updating a table row by row, the COMMIT is done at every SQL statement
>>> ... they have changed the application behaviour to have a COMMIT every 1.000 rows updated but the COMMIT time seems still high.
You're on the right track here that you shouldn't be committing so frequently. Even ever 1000 rows is probably too frequent. Slow log disks combined with too frequently committing will amplify the bottleneck caused by slow log disks.
Thanks,
Kostas
Joachim Klassen's profile image
Joachim Klassen IBM Champion

Hello Roberto,

as you mentioned that you use MIRRORLOGPATH:

Beside Kostas really important recommendation "For log mirroring you really should use a separate disk and file system" you may also want to check Db2 Registry Variable DB2_USE_ASYNC_FOR_MIRRORLOG - see https://www.ibm.com/docs/en/db2/12.1.0?topic=variables-performance#r0005665__P_db2_use_async_for_mirrorlog

By default writes to log files are serialized when using MIRRORLOGPATH - first write to active log then write to mirror log - DB2_USE_ASYNC_FOR_MIRRORLOG changes this behaviour so that both active and mirror log writes happen in parallel.

And you wrote "LOGBUFSZ is configured to 4096. I will try to reduce to 2048 and test how many time takes the COMMIT process.":

Reducing the size of the log buffer could have rather negative effects. AFAIK the log buffer is not always written in its complete size but partially - starting with the first entry of the commiting transaction up to the last entry of the commiting transaction (possibly entries of other transactions may have slipped in between).

Only when the log buffer becomes full its written completely - so you might want to check with MON_GET_TRANSACTION_LOG table function if you see "num_log_buffer_full" monitoring element grow fast https://www.ibm.com/docs/en/db2/12.1.0?topic=reference-n#r0011684 - if it does it might be helpful to increase LOGBUFSZ

Joachim

Roberto Stradella's profile image
Roberto Stradella

Hello,

thanks for the latest updates, we have changed our environment based on the latest suggestions provided: we have moved the database Path to log files, Mirror log path to two different disks. The new disks used for transaction logs are AWS io2 model 50000 IOPS (before we are using a single ESB gp3 disk to store the entire database structure). We have also setted up DB2_USE_ASYNC_FOR_MIRRORLOG=ON to write log and mirrorlog in parallel. The first tests done shows that the batch job save around 60 seconds execution time.

A second test was then performed by setting only DB2_USE_ASYNC_FOR_MIRRORLOG=ON in a clone environment leaving the database physical structure on a single AWS ESB gp3 storage. The results were still good, although not as good as the first. Evidently, changing active and mirror log writes to happen in parallel brings benefits.

The idea si to separate current log and mirrorlog in separate storage and filesystems, AWS io2 storage has a high cost so we have to evaluate carefully which storage model to use.

Thanks. Ciao. Roberto