Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-25513

raise systemd LimitNOFILE limits to match server defaults (~32768)

Details

    Description

      Starting MariaDB with default configuration causes the following problems:

      • "[Warning] Could not increase number of max_open_files to more than 16384 (request: 32186)"
      • silently reduces table_open_cache_instances from 8 (default) to 4

      Default Server System Variables:

      • extra_max_connections = 1
      • max_connections = 151
      • table_open_cache = 2000
      • table_open_cache_instances = 8
      • thread_pool_size = 4

      LimitNOFILE=16834 is in the following files:

      • support-files/mariadb.service.in
      • support-files/mariadb@.service.in

      Looking at sql/mysqld.cc lines 3837-3917:
      wanted_files= (extra_files + max_connections + extra_max_connections +
      tc_size * 2 * tc_instances);
      wanted_files+= threadpool_size;

      Plugging in the default values:
      wanted_files = (30 + 151 + 1 + 2000 * 2 * 8 + 4) = 32186

      However, systemd configuration has LimitNOFILE = 16384, which is far smaller.

      I suggest increasing LimitNOFILE to 32768.

      Thank you!
      Daniel Lewart
      Urbana, Illinois

      Attachments

        Activity

          danblack Daniel Black added a comment -

          Good request Daniel.

          Same applies for 10.2

          4484	    // add epoll or kevent fd for each threadpool group, in case pool of threads is used
          4485	    wanted_files+= (thread_handling > SCHEDULER_NO_THREADS) ? 0 : threadpool_size;
          (gdb) p tc_size
          $1 = 2000
          (gdb) p tc_instances
          $2 = 8
          (gdb) p extra_files
          $3 = 30
          (gdb) p max_connections
          $4 = 151
          (gdb) p extra_max_connections
          $5 = 1
          (gdb) n
          4482	                   tc_size * 2 * tc_instances);
          (gdb) n
          4481	    wanted_files= (extra_files + max_connections + extra_max_connections +
          (gdb) n
          4485	    wanted_files+= (thread_handling > SCHEDULER_NO_THREADS) ? 0 : threadpool_size;
          (gdb) p wanted_files
          $6 = <optimized out>
          (gdb) n
          4488	    min_tc_size= MY_MIN(tc_size, TABLE_OPEN_CACHE_MIN);
          (gdb) p wanted_files
          $7 = 32190
          

          danblack Daniel Black added a comment - Good request Daniel. Same applies for 10.2 4484 // add epoll or kevent fd for each threadpool group, in case pool of threads is used 4485 wanted_files+= (thread_handling > SCHEDULER_NO_THREADS) ? 0 : threadpool_size; (gdb) p tc_size $1 = 2000 (gdb) p tc_instances $2 = 8 (gdb) p extra_files $3 = 30 (gdb) p max_connections $4 = 151 (gdb) p extra_max_connections $5 = 1 (gdb) n 4482 tc_size * 2 * tc_instances); (gdb) n 4481 wanted_files= (extra_files + max_connections + extra_max_connections + (gdb) n 4485 wanted_files+= (thread_handling > SCHEDULER_NO_THREADS) ? 0 : threadpool_size; (gdb) p wanted_files $6 = <optimized out> (gdb) n 4488 min_tc_size= MY_MIN(tc_size, TABLE_OPEN_CACHE_MIN); (gdb) p wanted_files $7 = 32190
          danblack Daniel Black added a comment -

          Done. Thanks for the bug report.

          danblack Daniel Black added a comment - Done. Thanks for the bug report.

          People

            danblack Daniel Black
            lewart Daniel Lewart
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.