Friday, April 15, 2016

Configuring Multiple Tempdb Data Files


There was an interview question ..
Why multiple tempdb data files needed ?
As we know by default one tempdb data and log files is created initially . To boost the performance Microsoft recommends to have the multipile tempdb data files  based on the workload.
After googling for the answer i found   the below explaination from book :

Professional SQL Server 2012 Internals and Troubleshooting


When you create multiple data files they will all be in the primary filegroup and Sql server uses a proportional fill algorithm to determine which file to use for each request to create an object. If all the files are exactly the same size, then Sql server uses the files in a 'round robin' fashion, spreading  the load equally across the files. This is, of course, exactly what you want .
Microsoft recommends up to a 1:1 mapping between the number of files and logical CPUs because
during testing of massive workloads they’ve seen performance benefits, even with hundreds of
data files.
A more pragmatic approach however, is to have a 1:1 mapping between files and logical CPUs up to
eight, and then add files if you continue to see allocation contention or if you’re looking to push the
I/O subsystem harder. The performance benefit from adding files diminishes each time, and in our
experience, eight is the sweet spot, especially if you’re implementing this as a pro-active measure.
Whether or not you configure multiple data files as a best practice on all your SQL Servers or just
on those for which you’ve detected issues is a choice only you can make. However, you might want
to configure them on all the servers you work with as a proactive measure, as it’s hard to see a
downside.

No comments:

Post a Comment