Skip to content

Commit

Permalink
adding numa_nodebind=${node} option to mysqld_safe
Browse files Browse the repository at this point in the history
Summary:
Automation will pass in the right value to this option if
it needs to bind mysqld to a particular socket. That will happen
via systemd scripts.

This is only adding the capability on the mysqld_safe side to be able to
pass in numactl to the server. The turning on of this feature will need more
testing and slow roll, and that will happen in different diffs on the ops repo.

Test Plan:
RPM Is properly built and systemd scripts can be manually
altered to start mysqld with proper cpunodebind.

   tested on devserver - passed in nodebind=1

   taskset -c -p 3793853
   pid 3793853's current affinity list: 14-27,42-55

Reviewers: tec, bagrawal, abhinavsharma, mama

Reviewed By: mama

Subscribers: webscalesql-eng@fb.com, #mysql_infra

Differential Revision: https://phabricator.intern.facebook.com/D6067155

Signature: 6067155:1508261855:338b45bc0672355574f1ffdfaa36ddd74cba38e7
  • Loading branch information
anirbanr-fb committed Oct 17, 2017
1 parent c378441 commit a4242d2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions scripts/mysqld_safe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mysqld_ld_preload=
mysqld_ld_library_path=
flush_caches=0
numa_interleave=0
numa_nodebind=

# Initial logging status: error log is not open, and not using syslog
logging=init
Expand Down Expand Up @@ -87,6 +88,7 @@ Usage: $0 [OPTIONS]
--flush-caches Flush and purge buffers/caches
--numa-interleave Run mysqld with its memory interleaved
on all CPUs
--numa-nodebind Run mysqld with numa binding to one socket
All other options are passed to the mysqld program.
Expand Down Expand Up @@ -261,6 +263,7 @@ parse_arguments() {
--timezone=*) TZ="$val"; export TZ; ;;
--flush-caches) flush_caches=1 ;;
--numa-interleave) numa_interleave=1 ;;
--numa-nodebind=*) numa_nodebind="$val" ;;

--help) usage ;;

Expand Down Expand Up @@ -888,6 +891,30 @@ then
exit 1
fi

if @TARGET_LINUX@ && test ! -z "$numa_nodebind"
then
# Locate numactl, ensure it exists.
if ! my_which numactl > /dev/null 2>&1
then
log_error "numactl command not found, required for --numa-nodebind"
exit 1
fi

# Attempt to run a command, ensure it works.
if ! numactl --cpunodebind=$numa_nodebind --preferred=$numa_nodebind true
then
log_error "numactl failed, check if numa-nodebind value is correct"
exit 1
fi

# Launch mysqld with numactl.
cmd="$cmd numactl --cpunodebind=$numa_nodebind --preferred=$numa_nodebind"
elif test ! -z "$numa_nodebind"
then
log_error "--numa-nodebind is not supported on this platform"
exit 1
fi

for i in "$ledir/$MYSQLD" "$defaults" "--basedir=$MY_BASEDIR_VERSION" \
"--datadir=$DATADIR" "--plugin-dir=$plugin_dir" "$USER_OPTION"
do
Expand Down

0 comments on commit a4242d2

Please sign in to comment.