COMMIT on top of the pt-query-digest output
Forensics...


Median time for your COMMITs: 16ms.
Typical time for spinning disk write: 10ms.
Default setting of innodb_flush_log_at_trx_commit: 1, meaning flush to disk on every commit.


Conclusion:  The killer used the candlestick in the library. Or.. Most of what you are doing is very rapidly committing transactions.

Possible ways to speed up:


innodb_flush_log_at_trx_commit = 2 -- This flushes once per second instead of once per transaction.  That is less 'safe', but for some users, the tradeoff is worth it.
Batch you actions.  Instead of one INSERT per COMMIT, do lots of INSERTs.  The main cost in COMMIT is flushing one write to the rollback log, regardless of how much went on in the transaction.
Hardware -- SSD - drops the 10ms to 1ms (or something like that); RAID with battery backed write cache - makes writes take virtually 0 ms, even without loss of safety.
Since a few COMMITs are taking over 1 second, you could look for them and see if their transactions can be improved.