Bug #79996 Suggest to add a "--numanode" option to mysqld_safe scripts
Submitted: 15 Jan 2016 1:16 Modified: 15 Jan 2016 6:03
Reporter: Fangxin Flou (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Packaging Severity:S3 (Non-critical)
Version:All OS:Any
Assigned to: CPU Architecture:Any

[15 Jan 2016 1:16] Fangxin Flou
Description:
We are deploying MySQL on multiple CPU sockets host, numa bound will make it run twice faster, so we make some changes to the mysqld_safe scripts for numa bounding.

Such as

/usr/local/mysql5.6/bin/mysqld_safe --numanode=0 &
/usr/local/mysql5.6/bin/mysqld_safe --numanode=1 &

How to repeat:
N/A

Suggested fix:
diff -rc --exclude='*.orig' --exclude=sql_yacc.h --exclude=sql_yacc.cc mysql-5.6.28/scripts/mysqld_safe.sh mysql-5.6.28-patched/scripts/mysqld_safe.sh
*** mysql-5.6.28/scripts/mysqld_safe.sh 2015-11-16 17:38:05.000000000 +0800
--- mysql-5.6.28-patched/scripts/mysqld_safe.sh 2016-01-15 09:10:15.000000000 +0800
***************
*** 14,19 ****
--- 14,20 ----
  # Initialize script globals
  KILL_MYSQLD=1;
  MYSQLD=
+ NUMANODE=
  niceness=0
  mysqld_ld_preload=
  mysqld_ld_library_path=
***************
*** 210,215 ****
--- 211,217 ----
        --ledir=*) ledir="$val" ;;
        --malloc-lib=*) set_malloc_lib "$val" ;;
        --mysqld=*) MYSQLD="$val" ;;
+       --numanode=*) NUMANODE="$val" ;;
        --mysqld-version=*)
          if test -n "$val"
          then
***************
*** 759,769 ****
--- 761,780 ----

  cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS"

+ if test -z "$NUMANODE"
+ then
  for i in  "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
    "--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION"
  do
    cmd="$cmd "`shell_quote_string "$i"`
  done
+ else
+ for i in  "`which numactl`" "--cpunodebind=$NUMANODE" "--localalloc" "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
+   "--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION"
+ do
+   cmd="$cmd "`shell_quote_string "$i"`
+ done
+ fi
  cmd="$cmd $args"
  # Avoid 'nohup: ignoring input' warning
  test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null"
[15 Jan 2016 6:03] MySQL Verification Team
Hello Fangxin Flou,

Thank you for the report and contribution.

Thanks,
Umesh