Skip to content

Create #define for network buffer alignment#267

Merged
9EOR9 merged 1 commit intomariadb-corporation:3.4from
ericherman:eherman-io-size-20241231
Jul 9, 2025
Merged

Create #define for network buffer alignment#267
9EOR9 merged 1 commit intomariadb-corporation:3.4from
ericherman:eherman-io-size-20241231

Conversation

@ericherman
Copy link
Contributor

Was: #265

The server's definition of IO_SIZE is re-used here in the client for network buffer alignment, however IO_SIZE is used in the server for many different things and the client's buffer alignment is not related to many of those uses.

If the server is to make IO_SIZE configurable, we need to avoid either redefining it, or defining it to be different. By creating a specific define for this, we avoid redfine and clarify the code.

See: MariaDB/server#3726

@ericherman
Copy link
Contributor Author

@vuvova , I imagine your comment ( #265 (review) ) still stands, yes?

@vuvova
Copy link
Member

vuvova commented Jan 5, 2025

Yes, it does

@ericherman ericherman force-pushed the eherman-io-size-20241231 branch 2 times, most recently from ec9310e to cd61fb2 Compare January 29, 2025 12:00
@ericherman ericherman force-pushed the eherman-io-size-20241231 branch from cd61fb2 to 7212d19 Compare February 27, 2025 08:08
The server's definition of IO_SIZE is re-used here in the client for
network buffer alignment, however IO_SIZE is used in the server for
many different things and the client's buffer alignment is not related
to many of those uses.

If the server is to make IO_SIZE configurable, we need to avoid either
redefining it, or defining it to be different. By creating a specific
define for this, we avoid redfine and clarify the code.

See: MariaDB/server#3726

Signed-off-by: Eric Herman <[email protected]>
@ericherman ericherman force-pushed the eherman-io-size-20241231 branch from 7212d19 to f5319d9 Compare May 21, 2025 11:30
@9EOR9 9EOR9 merged commit 0eb34a2 into mariadb-corporation:3.4 Jul 9, 2025
1 check failed
ericherman added a commit to ericherman/mariadb-server that referenced this pull request Aug 14, 2025
Making mariadb's IO_SIZE compile-time configurable enables more
straight-forward investigation of the performance implications of having
an IO_SIZE which is different than the memory page size.

The default IO_SIZE of 4096 as defined in include/my_global.h and also
in libmariadb's include/ma_global.h matches to the memory page size of
most systems. Larger page sizes are widely supported, called "huge
pages" in Linux, "superpages" in FreeBSD, and "large pages" in MS
Windows.

On POSIX systems, obtaining the page size can be done via:

	page_size= sysconf(_SC_PAGESIZE);

On Windows:

	SYSTEM_INFO si;
	GetSystemInfo(&si);
	page_size= si.dwPageSize;

In https://jira.mariadb.org/browse/MDEV-35740 Marko highlights that
there are vastly different uses of IO_SIZE. This "one size fits all"
nature of IO_SIZE is not ideal, future work could split this into
separate constants based upon usage.

See also:
mariadb-corporation/mariadb-connector-c#267

Signed-off-by: Eric Herman <[email protected]>
ericherman added a commit to ericherman/mariadb-server that referenced this pull request Feb 4, 2026
Making mariadb's IO_SIZE compile-time configurable enables more
straight-forward investigation of the performance implications of having
an IO_SIZE which is different than the memory page size.

The default IO_SIZE of 4096 as defined in include/my_global.h and also
in libmariadb's include/ma_global.h matches to the memory page size of
most systems. Larger page sizes are widely supported, called "huge
pages" in Linux, "superpages" in FreeBSD, and "large pages" in MS
Windows.

On POSIX systems, obtaining the page size can be done via:

	page_size= sysconf(_SC_PAGESIZE);

On Windows:

	SYSTEM_INFO si;
	GetSystemInfo(&si);
	page_size= si.dwPageSize;

In https://jira.mariadb.org/browse/MDEV-35740 Marko highlights that
there are vastly different uses of IO_SIZE. This "one size fits all"
nature of IO_SIZE is not ideal, future work could split this into
separate constants based upon usage.

See also:
mariadb-corporation/mariadb-connector-c#267

Signed-off-by: Eric Herman <[email protected]>
ericherman added a commit to ericherman/mariadb-server that referenced this pull request Feb 4, 2026
Making mariadb's IO_SIZE compile-time configurable enables more
straight-forward investigation of the performance implications of having
an IO_SIZE which is different than the memory page size.

The default IO_SIZE of 4096 as defined in include/my_global.h and also
in libmariadb's include/ma_global.h matches to the memory page size of
most systems. Larger page sizes are widely supported, called "huge
pages" in Linux, "superpages" in FreeBSD, and "large pages" in MS
Windows.

On POSIX systems, obtaining the page size can be done via:

	page_size= sysconf(_SC_PAGESIZE);

On Windows:

	SYSTEM_INFO si;
	GetSystemInfo(&si);
	page_size= si.dwPageSize;

In https://jira.mariadb.org/browse/MDEV-35740 Marko highlights that
there are vastly different uses of IO_SIZE. This "one size fits all"
nature of IO_SIZE is not ideal, future work could split this into
separate constants based upon usage.

See also:
mariadb-corporation/mariadb-connector-c#267

Signed-off-by: Eric Herman <[email protected]>
ericherman added a commit to ericherman/mariadb-server that referenced this pull request Feb 4, 2026
Making mariadb's IO_SIZE compile-time configurable enables more
straight-forward investigation of the performance implications of having
an IO_SIZE which is different than the memory page size.

The default IO_SIZE of 4096 as defined in include/my_global.h matches
the memory page size of most systems. Larger page sizes are widely
supported, called "huge pages" in Linux, "superpages" in FreeBSD, and
"large pages" in MS Windows.

On POSIX systems, obtaining the page size can be done via:

	page_size= sysconf(_SC_PAGESIZE);

On Windows:

	SYSTEM_INFO si;
	GetSystemInfo(&si);
	page_size= si.dwPageSize;

In https://jira.mariadb.org/browse/MDEV-35740 Marko highlights that
there are vastly different uses of IO_SIZE. This "one size fits all"
nature of IO_SIZE is not ideal, future work could split this into
separate constants based upon usage.

See also:
mariadb-corporation/mariadb-connector-c#267

Signed-off-by: Eric Herman <[email protected]>
ericherman added a commit to ericherman/mariadb-server that referenced this pull request Feb 4, 2026
Making mariadb's IO_SIZE compile-time configurable enables more
straight-forward investigation of the performance implications of having
an IO_SIZE which is different than the memory page size.

The default IO_SIZE of 4096 as defined in include/my_global.h matches
the memory page size of most systems. Larger page sizes are widely
supported, called "huge pages" in Linux, "superpages" in FreeBSD, and
"large pages" in MS Windows.

On POSIX systems, obtaining the page size can be done via:

	page_size= sysconf(_SC_PAGESIZE);

On Windows:

	SYSTEM_INFO si;
	GetSystemInfo(&si);
	page_size= si.dwPageSize;

In https://jira.mariadb.org/browse/MDEV-35740 Marko highlights that
there are vastly different uses of IO_SIZE. This "one size fits all"
nature of IO_SIZE is not ideal, future work could split this into
separate constants based upon usage.

See also:
mariadb-corporation/mariadb-connector-c#267

Signed-off-by: Eric Herman <[email protected]>
ericherman added a commit to ericherman/mariadb-server that referenced this pull request Feb 4, 2026
Making mariadb's IO_SIZE compile-time configurable enables more
straight-forward investigation of the performance implications of having
an IO_SIZE which is different than the memory page size.

The default IO_SIZE of 4096 as defined in include/my_global.h matches
the memory page size of most systems. Larger page sizes are widely
supported, called "huge pages" in Linux, "superpages" in FreeBSD, and
"large pages" in MS Windows.

On POSIX systems, obtaining the page size can be done via:

	page_size= sysconf(_SC_PAGESIZE);

On Windows:

	SYSTEM_INFO si;
	GetSystemInfo(&si);
	page_size= si.dwPageSize;

In https://jira.mariadb.org/browse/MDEV-35740 Marko highlights that
there are vastly different uses of IO_SIZE. This "one size fits all"
nature of IO_SIZE is not ideal, future work could split this into
separate constants based upon usage.

See also:
mariadb-corporation/mariadb-connector-c#267

Signed-off-by: Eric Herman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants