[MDBF-489] hz-bbw1 - more aio-max-nr needed Created: 2022-10-20  Updated: 2023-12-21  Resolved: 2022-11-03

Status: Closed
Project: MariaDB Foundation Development
Component/s: Buildbot
Affects Version/s: N/A
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Daniel Black Assignee: Faustin Lammler
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 1h
Original Estimate: Not Specified


 Description   

https://buildbot.mariadb.org/#/builders/535/builds/530/steps/7/logs/stdio

sys_vars.innodb_read_io_threads_basic 'innodb' w13 [ fail ]
        Test ended at 2022-10-20 22:07:34
CURRENT_TEST: sys_vars.innodb_read_io_threads_basic
Warning: /home/buildbot/amd64-debian-10-debug-embedded/build/libmysqld/examples/mysqltest_embedded: unknown variable 'loose-ssl-ca=/home/buildbot/amd64-debian-10-debug-embedded/build/mysql-test/std_data/cacert.pem'
Warning: /home/buildbot/amd64-debian-10-debug-embedded/build/libmysqld/examples/mysqltest_embedded: unknown variable 'loose-ssl-cert=/home/buildbot/amd64-debian-10-debug-embedded/build/mysql-test/std_data/client-cert.pem'
Warning: /home/buildbot/amd64-debian-10-debug-embedded/build/libmysqld/examples/mysqltest_embedded: unknown variable 'loose-ssl-key=/home/buildbot/amd64-debian-10-debug-embedded/build/mysql-test/std_data/client-key.pem'
Warning: /home/buildbot/amd64-debian-10-debug-embedded/build/libmysqld/examples/mysqltest_embedded: unknown option '--loose-skip-ssl'
io_setup(768) returned -11
io_setup(16896) returned -11
io_setup(1024) returned -11
--- /home/buildbot/amd64-debian-10-debug-embedded/build/mysql-test/suite/sys_vars/r/innodb_read_io_threads_basic.result	2022-10-20 22:02:57.000000000 +0000
+++ /home/buildbot/amd64-debian-10-debug-embedded/build/mysql-test/suite/sys_vars/r/innodb_read_io_threads_basic.reject	2022-10-20 22:07:33.692938562 +0000
@@ -27,3 +27,5 @@
 set session innodb_read_io_threads=1;
 ERROR HY000: Variable 'innodb_read_io_threads' is a GLOBAL variable and should be set with SET GLOBAL
 set global innodb_read_io_threads=@n;
+Warnings:
+Warning	1105	Could not reserve max. number of concurrent ios.Increase the /proc/sys/fs/aio-max-nr to fix.



 Comments   
Comment by Faustin Lammler [ 2022-10-27 ]

danblack should this be deployed to all builder?
What would a good value be?
I found https://blog.pythian.com/importance-oracle-database-related-kernel-parameters-aio-max-nr-bonus-track/ but I am not sure that I understand all the implication of such a change.

FYI:

faust@hz-bbw1 ~ main
❯ docker run -it quay.io/mariadb-foundation/bb-worker:debian10 bash -c "sysctl -n fs.aio-max-nr"
65536

Also, why this default value is not sufficient anymore?

Comment by Daniel Black [ 2022-10-31 ]

Well this number is global for the machine and not per container/exe instance.

> should this be deployed to all builder?

Seems resonable. There's higher requirements depending on how many mtr tests are concurrent.

> What would a good value be?

Double the current would be my starting point. I haven't seen a downside in raising this parameter. If the kernel can handle the number of jobs it can use a bit more kernel memory to keep track of AIO requests.

Monitor fs.aio-nr (https://docs.kernel.org/admin-guide/sysctl/fs.html#aio-nr-aio-max-nr) as the number being used.

Comment by Faustin Lammler [ 2022-11-02 ]

Ok thanks danblack!
vladbogo before I make the change, please can you also take a look?

My understanding is that we are hitting this because our BB load balancing is now working better (more parallel build/test on strong machines).

Comment by Faustin Lammler [ 2022-11-02 ]

MR ready for review: https://gitlab.com/mariadb/sysadmin/-/merge_requests/35

Comment by Faustin Lammler [ 2022-11-03 ]

The change has been deployed on all BB docker workers.

Comment by Faustin Lammler [ 2023-12-21 ]

Summary of discussion with marko, danblack and vladbogo

Marko:
In 10.5+ the code would look like this:

  int max_read_events= int(n_reader_threads * OS_AIO_N_PENDING_IOS_PER_THREAD);
  int max_write_events= int(n_writer_threads * OS_AIO_N_PENDING_IOS_PER_THREAD);
  int events= max_read_events + max_write_events;
 
  /** Do the Linux AIO dance (this will try to create a new
  io context with changed max_events ,etc*/
 
  int ret= srv_thread_pool->reconfigure_aio(srv_use_native_aio, events);

That would be (innodb_read_io_threads+innodb_write_io_threads)×256, or (4+4)×256=2048 per server instance by default.
Each mtr can start at least up to 2×--parallel servers (if we consider replication tests), maybe 3× or 4× if we consider galera_3nodes.
So, if we can have 2 ./mtr --parallel=60 running concurrently on the same kernel, the worst case should be 2×4×60×2048 = 60×16384 = 983040.

Vlad:
Max number of builders for each machine is defined in https://github.com/MariaDB/buildbot/blob/dev/locks.py#L14-L44
but each builder might use a different number for --parallel
but the container still starts, but waits for others to finish before actually doing something

--parallel is usualy 14 (but MSAN or Valgrind have much more).

Faustin:
Value given by n×4×p×2048 where n is the number of concurrent builds and p the value of --parallel.
Suggestion is the following then --parallel 30, n= see https://github.com/MariaDB/buildbot/blob/dev/locks.py.
Keep the actual value for small builders and only modify strong builders (n>=5).

Comment by Faustin Lammler [ 2023-12-21 ]

Deployed with https://gitlab.com/mariadb/sysadmin/-/commit/0fb9deffe.

Generated at Thu Feb 08 03:38:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.