|
| 1 | +--- |
| 2 | +title: Performance best practices for SQL Server Big Data Clusters |
| 3 | +description: This article provides performance best practices and guidelines for running SQL Server Big Data Clusters on Kubernetes |
| 4 | +author: mihaelablendea |
| 5 | +ms.author: mihaelab |
| 6 | +ms.reviewer: mikeray |
| 7 | +ms.date: 06/30/2020 |
| 8 | +ms.topic: conceptual |
| 9 | +ms.prod: sql |
| 10 | +ms.technology: big-data-cluster |
| 11 | +--- |
| 12 | + |
| 13 | +# Performance best practices and configuration guidelines for SQL Server Big Data Clusters |
| 14 | + |
| 15 | +[!INCLUDE [sqlserver2019](../includes/applies-to-version/sqlserver2019.md)] |
| 16 | + |
| 17 | +This article provides best practices and recommendations to maximize performance for applications that target services running within a big data cluster. |
| 18 | + |
| 19 | +The following guidelines focus on recommendations for configuring the Linux operating system hosting the Kubernetes worker nodes where BDC will be deployed on. As a best practice, configure the tuning profile before deploying the big data cluster. The settings included in the proposed tuning profile were validated during the case study conducted by Microsoft and Intel. The results of the study are published for download in this [whitepaper](https://aka.ms/sql-bdc-spark-perf/). |
| 20 | + |
| 21 | +> [!TIP] |
| 22 | +> For tuning configurations specific to SQL Server on Linux, see [Performance best practices and configuration guidelines for SQL Server on Linux](../linux/sql-server-linux-performance-best-practices.md). Also, other best practices like index design for SQL Server databases, still apply. |
| 23 | +
|
| 24 | +## Proposed Linux settings using a tuned `mssql-bdc` profile |
| 25 | + |
| 26 | +Create a **tuned.conf** configuration profile with the content below. |
| 27 | + |
| 28 | +```bash |
| 29 | +[main] |
| 30 | +summary=Optimize for Microsoft SQL Server Big Data Clusters TPC-DS performance |
| 31 | +include=throughput-performance |
| 32 | + |
| 33 | +[sysctl] |
| 34 | +#network tunings |
| 35 | +net.ipv4.conf.default.rp_filter=1 |
| 36 | +net.ipv4.tcp_timestamps=0 |
| 37 | +net.ipv4.tcp_sack = 1 |
| 38 | +net.core.netdev_max_backlog = 25000 |
| 39 | +net.core.rmem_max = 2147483647 |
| 40 | +net.core.wmem_max = 2147483647 |
| 41 | +net.core.rmem_default = 33554431 |
| 42 | +net.core.wmem_default = 33554432 |
| 43 | +net.core.optmem_max = 33554432 |
| 44 | +net.ipv4.tcp_rmem =8192 33554432 2147483647 |
| 45 | +net.ipv4.tcp_wmem =8192 33554432 2147483647 |
| 46 | +net.ipv4.tcp_low_latency=1 |
| 47 | +net.ipv4.tcp_adv_win_scale=1 |
| 48 | +net.ipv6.conf.all.disable_ipv6 = 1 |
| 49 | +net.ipv6.conf.default.disable_ipv6 = 1 |
| 50 | +net.ipv4.conf.all.arp_filter=1 |
| 51 | +net.ipv4.tcp_retries2=5 |
| 52 | +net.ipv6.conf.lo.disable_ipv6 = 1 |
| 53 | +net.core.somaxconn = 65535 |
| 54 | + |
| 55 | +#memory cache settings |
| 56 | +vm.swappiness=1 |
| 57 | +vm.overcommit_memory=0 |
| 58 | +vm.dirty_background_ratio=1 |
| 59 | + |
| 60 | +#kernel NUMA |
| 61 | +kernel.numa_balancing=0 |
| 62 | + |
| 63 | +#filesystem |
| 64 | +fs.aio-max-nr=1048576 |
| 65 | + |
| 66 | +[vm] |
| 67 | +#should be revisited for SQL large pages use in master/data/compute pods |
| 68 | +transparent_hugepages=never |
| 69 | +``` |
| 70 | + |
| 71 | +## Install **tuned** utility on all the Kubernetes worker nodes |
| 72 | + |
| 73 | +To install **tuned**, execute: |
| 74 | + |
| 75 | +```bash |
| 76 | +apt-get -y install tuned |
| 77 | +``` |
| 78 | + |
| 79 | +## Apply tuning settings to all Kubernetes worker nodes |
| 80 | + |
| 81 | +On each of the targeted worker nodes, copy the **tuned.conf** file created above: |
| 82 | + |
| 83 | +```bash |
| 84 | +cd /usr/lib/tuned |
| 85 | +scp -r <sourcePath> ./mssql-bdc |
| 86 | +``` |
| 87 | + |
| 88 | +To enable this **mssql-bdc** tuned profile, save these definitions in a **tuned.conf** file under a `/usr/lib/tuned/mssql-bdc` folder on all the Kubernetes worker nodes and enable the profile using: |
| 89 | + |
| 90 | +```bash |
| 91 | +chmod +x /usr/lib/tuned/mssql-bdc/tuned.conf |
| 92 | +tuned-adm profile mssql-bdc |
| 93 | +``` |
| 94 | + |
| 95 | +Verify it's enabled using this command: |
| 96 | + |
| 97 | +```bash |
| 98 | +tuned-adm active |
| 99 | +``` |
| 100 | + |
| 101 | +or |
| 102 | + |
| 103 | +```bash |
| 104 | +tuned-adm list |
| 105 | +``` |
| 106 | + |
| 107 | +If the profile is changed dynamically, for the new changes to take effect, you must restart **tuned** on all the impacted worker nodes: |
| 108 | + |
| 109 | +```bash |
| 110 | +systemctl restart tuned |
| 111 | +``` |
| 112 | + |
| 113 | +Logs for **tuned** service can be found at */var/log/tuned/tuned.log*. |
| 114 | + |
| 115 | +Optionally, you can configure the tuning profile on one node in the Kubernetes cluster and use the script below to copy it over and configure on the remaining nodes. |
| 116 | + |
| 117 | +```bash |
| 118 | +#!/bin/bash -e |
| 119 | +# This script takes a list of servers (IPs like `cat ~administrator/workerhosts)) as input |
| 120 | +# and update these servers with the local version of mssql-bdc tuned.conf. |
| 121 | + |
| 122 | +is_root() { |
| 123 | + local is_root_set=0 |
| 124 | + if [ "$EUID" -ne 0 ]; then |
| 125 | + echo "Please run as root" |
| 126 | + else |
| 127 | + is_root_set=1 |
| 128 | + fi |
| 129 | + return "${is_root_set}" |
| 130 | +} |
| 131 | + |
| 132 | +# function main |
| 133 | +if is_root -eq 0; then |
| 134 | + exit 0 |
| 135 | +fi |
| 136 | + |
| 137 | +while [ $# -gt 0 ] |
| 138 | +do |
| 139 | + # sometimes, people add non-breaking space characters to their *host* files. |
| 140 | + WORKER_IP=$(echo "$1" | sed -e 's/\xC2\xA0//g') |
| 141 | + echo -e "updating mssql-bdc tuned on \e[42m${WORKER_IP}\e[0m" |
| 142 | + # the following commands assume tuned was not set up and active... |
| 143 | + # TODO: add the tuned install and status checks |
| 144 | + ssh "${WORKER_IP}" mkdir -p /usr/lib/tuned/mssql-bdc |
| 145 | + scp ~administrator/tuned.conf "${WORKER_IP}":/usr/lib/tuned/mssql-bdc/tuned.conf |
| 146 | + ssh "${WORKER_IP}" tuned-adm profile mssql-bdc |
| 147 | + ssh "${WORKER_IP}" systemctl restart tuned |
| 148 | + ssh "${WORKER_IP}" tuned-adm active |
| 149 | + shift |
| 150 | +done |
| 151 | + |
| 152 | +``` |
| 153 | + |
| 154 | +## Next steps |
| 155 | + |
| 156 | +For more resources including reference architectures for SQL Server Big Data Clusters, see: |
| 157 | + |
| 158 | +* [Case Study: SQL Workloads running on Apache Spark in MS SQL Server 2019 Big Data Cluster](https://aka.ms/sql-bdc-spark-perf/) |
| 159 | + |
| 160 | +* [HPE Reference Architecture for delivering insight across all your data with Microsoft SQL Server 2019 Big Data Clusters](https://h20195.www2.hpe.com/V2/GetDocument.aspx?docname=a50001963enw) |
| 161 | + |
| 162 | +* [Dell EMC PowerStore: Microsoft SQL Server 2019 Big Data Clusters](https://www.dellemc.com/resources/en-us/asset/white-papers/products/storage/h18231-dell-emc-powerstore-sql-server-big-data-clusters.pdf) |
| 163 | + |
| 164 | +* [Microsoft SQL Server 2019 Big Data Clusters: A Big Data Solution Using Dell EMC Infrastructure](https://infohub.delltechnologies.com/t/microsoft-sql-server-2019-big-data-clusters-a-big-data-solution-using-dell-emc-infrastructure/) |
| 165 | + |
| 166 | +* [Microsoft SQL Server 2019 Big Data Clusters on Cisco UCS Reference Architecture](https://www.cisco.com/c/en/us/solutions/collateral/data-center-virtualization/unified-computing/sql-server-on-big-data-cluster-on-ucs.html) |
0 commit comments