DBIO-MySQL-Async

Async MySQL/MariaDB storage for DBIO using EV::MariaDB.

Bypasses DBI entirely - speaks MariaDB's C client library directly for maximum performance with pipeline mode support.

Features

Synopsis

my $schema = MyApp::Schema->connect(
    'DBIO::MySQL::Async',
    {
        host      => 'localhost',
        database  => 'myapp',
        user      => 'myapp',
        password  => 'secret',
        pool_size => 10,
    },
);

use DBIO::AccessBroker::Static;

my $broker = DBIO::AccessBroker::Static->new(
    host     => 'localhost',
    database => 'myapp',
    user     => 'myapp',
    password => 'secret',
);

my $brokered = MyApp::Schema->connect($broker);

# Async
$schema->resultset('Artist')->all_async->then(sub {
    my @artists = @_;
    say $_->name for @artists;
});

# Pipeline
$schema->storage->pipeline(sub {
    Future->needs_all(
        map { $schema->resultset('Artist')->create_async({ name => $_ }) }
        @names
    );
});

Async

The storage class returns Future objects for all query operations, enabling fully non-blocking database access.

Pipeline

Pipeline mode batches multiple queries into a single network round-trip. Up to 64 queries can be in-flight simultaneously.

Event Loop Compatibility

EV::MariaDB uses the EV event loop. This works with:

Testing

# Load tests (skip without EV::MariaDB)
prove -l t/00-load.t t/01-storage-api.t

# Integration tests (need MySQL/MariaDB + EV::MariaDB)
DBIO_TEST_MYSQL_DSN='database=testdb;host=localhost' \
DBIO_TEST_MYSQL_USER=root \
DBIO_TEST_MYSQL_PASS=secret \
  prove -l t/10-integration.t t/11-access-broker-live.t

Requirements

Copyright (C) 2026 DBIO Authors

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.