mirror of
https://github.com/MariaDB/server.git
synced 2025-12-28 08:10:14 +00:00
MDEV-24270: Collect multiple completed events at a time
tpool::aio::N_PENDING: Replaces OS_AIO_N_PENDING_IOS_PER_THREAD. This limits two similar things: the number of outstanding requests that a thread may io_submit(), and the number of completed requests collected at a time by io_getevents().
This commit is contained in:
parent
7a9405e3dc
commit
6479006e14
@ -1467,7 +1467,7 @@ bool buf_pool_t::create()
|
||||
ut_d(lru_scan_itr.m_mutex= &mutex);
|
||||
|
||||
io_buf.create((srv_n_read_io_threads + srv_n_write_io_threads) *
|
||||
OS_AIO_N_PENDING_IOS_PER_THREAD);
|
||||
tpool::aio::N_PENDING);
|
||||
|
||||
/* FIXME: remove some of these variables */
|
||||
srv_buf_pool_curr_size= curr_pool_size;
|
||||
|
||||
@ -265,9 +265,6 @@ struct os_file_size_t {
|
||||
os_offset_t m_alloc_size;
|
||||
};
|
||||
|
||||
/** Win NT does not allow more than 64 */
|
||||
static const ulint OS_AIO_N_PENDING_IOS_PER_THREAD = 256;
|
||||
|
||||
extern ulint os_n_file_reads;
|
||||
extern ulint os_n_file_writes;
|
||||
extern ulint os_n_fsyncs;
|
||||
|
||||
@ -4027,8 +4027,8 @@ static bool is_linux_native_aio_supported()
|
||||
|
||||
bool os_aio_init(ulint n_reader_threads, ulint n_writer_threads, ulint)
|
||||
{
|
||||
int max_write_events= int(n_writer_threads * OS_AIO_N_PENDING_IOS_PER_THREAD);
|
||||
int max_read_events= int(n_reader_threads * OS_AIO_N_PENDING_IOS_PER_THREAD);
|
||||
int max_write_events= int(n_writer_threads * tpool::aio::N_PENDING);
|
||||
int max_read_events= int(n_reader_threads * tpool::aio::N_PENDING);
|
||||
int max_events = max_read_events + max_write_events;
|
||||
int ret;
|
||||
|
||||
|
||||
@ -60,27 +60,26 @@ class aio_linux final : public aio
|
||||
|
||||
static void getevent_thread_routine(aio_linux *aio)
|
||||
{
|
||||
io_event events[1];
|
||||
io_event events[N_PENDING];
|
||||
for (;;)
|
||||
{
|
||||
switch (int ret= my_getevents(aio->m_io_ctx, 1, 1, events)) {
|
||||
switch (int ret= my_getevents(aio->m_io_ctx, 1, N_PENDING, events)) {
|
||||
case -EINTR:
|
||||
case 0:
|
||||
continue;
|
||||
case -EINVAL:
|
||||
if (shutdown_in_progress)
|
||||
return;
|
||||
/* fall through */
|
||||
default:
|
||||
if (ret != 1)
|
||||
if (ret < 0)
|
||||
{
|
||||
fprintf(stderr, "io_getevents returned %d\n", ret);
|
||||
abort();
|
||||
return;
|
||||
}
|
||||
else
|
||||
for (int i= 0; i < ret; i++)
|
||||
{
|
||||
const io_event &event= events[0];
|
||||
const io_event &event= events[i];
|
||||
aiocb *iocb= static_cast<aiocb*>(event.obj);
|
||||
if (static_cast<int>(event.res) < 0)
|
||||
{
|
||||
|
||||
@ -155,6 +155,8 @@ struct aiocb
|
||||
class aio
|
||||
{
|
||||
public:
|
||||
/** Maximum number of pending requests per thread */
|
||||
static constexpr unsigned N_PENDING= 256;
|
||||
/**
|
||||
Submit asyncronous IO.
|
||||
On completion, cb->m_callback is executed.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user