So you talk to a database, doing transactions. What happens actually, behind the scenes? Let’s have a look.
There is a test table and we write data into it inside a transaction:
CREATE TABLE t (
id serial,
data varbinary(255)
)
START TRANSACTION READ WRITE
INSERT INTO t ( id, data ) VALUES (NULL, RANDOM_BYTES(255))
COMMIT
The MySQL test instance we are talking to is running on a Linux
machine, and otherwise idle to make observation easier. Also, we
configured it with innodb_use_native_aio = false
because observing actual physical asynchronous I/O and
attributing it to the statement that caused it is really hard.
Setting things up this way, we can use lsof and strace to see things. But before we do this, let’s set some expectations and establish some background knowledge.
The Log/Data Memory/Storage quadrants
Upper half: Log structures, Lower half: Data …
[Read more]