powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Microsoft SQL Server [игнор отключен] [закрыт для гостей] / MS SQL cъедает больше памяти, чем ему положено.
9 сообщений из 34, страница 2 из 2
MS SQL cъедает больше памяти, чем ему положено.
    #39598798
Фотография Megabyte
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Наконец-то дошло проверить типа страниц, за которые идет конкуренция.

Мониторил через запрос
Код: sql
1.
2.
3.
4.
5.
6.
SELECT *          
    , CHARINDEX(':', resource_description) AS file_index        
    ,REVERSE(SUBSTRING(REVERSE(resource_description), 1, CHARINDEX(':', REVERSE(resource_description))-1)) AS page_index
     , resource_description AS rd
    FROM sys.dm_os_waiting_tasks wt     
    WHERE wait_type LIKE 'PAGELATCH%'        


Потом проверялв этом запросе по их PAGE_INDEX.
Код: sql
1.
2.
3.
4.
5.
6.
7.
SELECT 
  *
FROM sys.dm_os_buffer_descriptors d
where database_id = 2 --and 
  and page_id IN (1, 56616, 40440, 48528, 8088, 32352, 16176)
ORDER BY database_id
  ,page_Id



Все страницы были типа PFS в TempDB.

Из всех источников рекомендации были только увеличить кол-во файлов TempDB, что мне лично при эксперименте не помогло.
Это единственный вариант? Куда и что еще посмотреть?

p.s. В базе активно юзается импорт из xml, данные заливаются постоянно с высокой частотой, но объем данных небольшой.
Использую OPENXML. После выгрузки данных во времянку сразу же делаю sp_xml_removedocument.
Потом эти же данные постоянно запрашиваются в нашем ПО для мониторинга менеджерами(web-страница, открыта постоянно и постоянно обновляется). Вечером, когда нагрузка ниже(меньше менеджеров работает), проблем с блокировками практически не наблюдается.
...
Рейтинг: 0 / 0
MS SQL cъедает больше памяти, чем ему положено.
    #39598877
Фотография Yasha123
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
MegabyteВсе страницы были типа PFS в TempDB.

Из всех источников рекомендации были только увеличить кол-во файлов TempDB, что мне лично при эксперименте не помогло.
Это единственный вариант? Куда и что еще посмотреть?
Troubleshooting: Tempdb Contention

RandalThere are three things you can do to alleviate this kind of contention and increase the throughput of the overall workload:

Stop using temp tables
Enable trace flag 1118 as a start-up trace flag
Create multiple tempdb data files
+
Misconceptions around TF 1118
...
Рейтинг: 0 / 0
MS SQL cъедает больше памяти, чем ему положено.
    #39598892
архивариус
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
MegabyteЕсли вдруг кому будет интересно, напишу, что делал.
1) Добавление файлов tempDb до 4шт на 4 процессора, как по рекомендации Микрософт, ничего не дало.

1 шт. не на процессор, а на физическое ядро, до 8 шт не задумываясь, если больше то нужно смотреть.(даже на одном и том же диске)

авторRecommendations to reduce allocation contention in SQL Server tempdb database
Symptoms
You observe severe blocking when the SQL Server is experiencing heavy load. When you examine the Dynamic Management Views [sys.dm_exec_request or sys.dm_os_waiting_tasks], you observe that these requests or tasks are waiting for tempdb resources. Additionally, you will notice that the wait type is PAGELATCH_UP and wait resource points to pages in tempdb. These pages might be of the format 2:1:1, 2:1:3 and so on (PFS and SGAM pages in tempdb).
Note If a page is evenly-divisible by 8088, then it is a PFS page. For example, page 2:3:905856 is a PFS in file_id=3 in tempdb.
Cause
When the tempdb database is heavily used, SQL Server may experience contention when it tries to allocate pages. Depending on the degree of contention, this may cause queries and requests that involve tempdb to be unresponsive for short periods of time.
Resolution
There are several steps you can take to improve the concurrency of tempdb:

As a general rule, if the number of logical processors is less than or equal to 8, use the same number of data files as logical processors. If the number of logical processors is greater than 8, use 8 data files and then if contention continues, increase the number of data files by multiples of 4 (up to the number of logical processors) until the contention is reduced to acceptable levels or make changes to the workload/code.

Consider implementing the best practice recommendations in the Technet article titled Working with tempdb in SQL Server 2005.

If the previous steps do not significantly reduce the allocation contention and the contention is on SGAM pages, implement trace flag -T1118. Under this trace flag, SQL Server allocates full extents to each database object, thereby eliminating the contention on SGAM pages. Note that this trace flag affects every database on the instance of SQL Server. For information about how to determine whether the allocation contention is on SGAM pages, see Monitoring contention caused by DML operations subtopic under Working with tempdb in SQL Server 2005 page on Technet.
Starting with SQL Server 2016, some of these configuration changes are automatic and do not need user intervention. For more information
инсталятор SQL сам создает теперь несколько файлов tempdb .
...
Рейтинг: 0 / 0
MS SQL cъедает больше памяти, чем ему положено.
    #39599115
Фотография Megabyte
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
архивариусMegabyteЕсли вдруг кому будет интересно, напишу, что делал.
1) Добавление файлов tempDb до 4шт на 4 процессора, как по рекомендации Микрософт, ничего не дало.

1 шт. не на процессор, а на физическое ядро, до 8 шт не задумываясь, если больше то нужно смотреть.(даже на одном и том же диске)

авторRecommendations to reduce allocation contention in SQL Server tempdb database
Symptoms
You observe severe blocking when the SQL Server is experiencing heavy load. When you examine the Dynamic Management Views [sys.dm_exec_request or sys.dm_os_waiting_tasks], you observe that these requests or tasks are waiting for tempdb resources. Additionally, you will notice that the wait type is PAGELATCH_UP and wait resource points to pages in tempdb. These pages might be of the format 2:1:1, 2:1:3 and so on (PFS and SGAM pages in tempdb).
Note If a page is evenly-divisible by 8088, then it is a PFS page. For example, page 2:3:905856 is a PFS in file_id=3 in tempdb.
Cause
When the tempdb database is heavily used, SQL Server may experience contention when it tries to allocate pages. Depending on the degree of contention, this may cause queries and requests that involve tempdb to be unresponsive for short periods of time.
Resolution
There are several steps you can take to improve the concurrency of tempdb:

As a general rule, if the number of logical processors is less than or equal to 8, use the same number of data files as logical processors. If the number of logical processors is greater than 8, use 8 data files and then if contention continues, increase the number of data files by multiples of 4 (up to the number of logical processors) until the contention is reduced to acceptable levels or make changes to the workload/code.

Consider implementing the best practice recommendations in the Technet article titled Working with tempdb in SQL Server 2005.

If the previous steps do not significantly reduce the allocation contention and the contention is on SGAM pages, implement trace flag -T1118. Under this trace flag, SQL Server allocates full extents to each database object, thereby eliminating the contention on SGAM pages. Note that this trace flag affects every database on the instance of SQL Server. For information about how to determine whether the allocation contention is on SGAM pages, see Monitoring contention caused by DML operations subtopic under Working with tempdb in SQL Server 2005 page on Technet.
Starting with SQL Server 2016, some of these configuration changes are automatic and do not need user intervention. For more information
инсталятор SQL сам создает теперь несколько файлов tempdb .
Мы пока на 2008м, правда скоро планируем апгрейд.
...
Рейтинг: 0 / 0
MS SQL cъедает больше памяти, чем ему положено.
    #39599148
Фотография Megabyte
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
архивариусMegabyteЕсли вдруг кому будет интересно, напишу, что делал.
1) Добавление файлов tempDb до 4шт на 4 процессора, как по рекомендации Микрософт, ничего не дало.

1 шт. не на процессор, а на физическое ядро, до 8 шт не задумываясь, если больше то нужно смотреть.(даже на одном и том же диске)

У нас сервера на виртуалках. Под проблемный сервер выделено 4 ядра.
Т.е. таки 4 файла, минимум, делать?
...
Рейтинг: 0 / 0
MS SQL cъедает больше памяти, чем ему положено.
    #39599173
Фотография Yasha123
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Megabyteархивариуспропущено...

1 шт. не на процессор, а на физическое ядро, до 8 шт не задумываясь, если больше то нужно смотреть.(даже на одном и том же диске)

У нас сервера на виртуалках. Под проблемный сервер выделено 4 ядра.
Т.е. таки 4 файла, минимум, делать?
слушайте, а вообще есть ли смысл вам отвечать?
выше приведена ссылка на Рэндала, про кол-во файлов там четко написано,
но наверное, лучше всем миром проголосовать?

автор#3 ( Create multiple tempdb data files) will help to remove the PFS page contention, by spreading the allocation workload over multiple files, thus reducing contention on the individual, per-file PFS pages. But how many data files should you create?

The best guidance I’ve seen is from a great friend of mine, Bob Ward, who’s the top Escalation Engineer in Microsoft SQL Product Support. Figure out the number of logical processor cores you have (e.g. two CPUS, with 4 physical cores each, plus hyperthreading enabled = 2 (cpus) x 4 (cores) x 2 (hyperthreading) = 16 logical cores. Then if you have less than 8 logical cores, create the same number of data files as logical cores. If you have more than 8 logical cores, create 8 data files and then add more in chunks of 4 if you still see PFS contention. Make sure all the tempdb data files are the same size too. (This advice is now official Microsoft guidance in KB article 2154845.)
...
Рейтинг: 0 / 0
MS SQL cъедает больше памяти, чем ему положено.
    #39599510
Фотография Megabyte
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Yasha123Megabyteпропущено...

У нас сервера на виртуалках. Под проблемный сервер выделено 4 ядра.
Т.е. таки 4 файла, минимум, делать?
слушайте, а вообще есть ли смысл вам отвечать?
выше приведена ссылка на Рэндала, про кол-во файлов там четко написано,
но наверное, лучше всем миром проголосовать?

автор#3 ( Create multiple tempdb data files) will help to remove the PFS page contention, by spreading the allocation workload over multiple files, thus reducing contention on the individual, per-file PFS pages. But how many data files should you create?

The best guidance I’ve seen is from a great friend of mine, Bob Ward, who’s the top Escalation Engineer in Microsoft SQL Product Support. Figure out the number of logical processor cores you have (e.g. two CPUS, with 4 physical cores each, plus hyperthreading enabled = 2 (cpus) x 4 (cores) x 2 (hyperthreading) = 16 logical cores. Then if you have less than 8 logical cores, create the same number of data files as logical cores. If you have more than 8 logical cores, create 8 data files and then add more in chunks of 4 if you still see PFS contention. Make sure all the tempdb data files are the same size too. (This advice is now official Microsoft guidance in KB article 2154845.)

Я к чему спрашивал, может есть какие-то различия для виртуалок... Статью Рэндала читал и даже делал уже 4 файла: на кол-во блокировок это не особо повлияло.
...
Рейтинг: 0 / 0
MS SQL cъедает больше памяти, чем ему положено.
    #39604107
Фотография Megabyte
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Хочу включить флаг трассировки при запуске. Добавляю в параметры запуска:
"-dC:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\master.mdf;-eC:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG;-lC:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\mastlog.ldf; -T1118"

Перегружаю службу. Проверяю:
Код: sql
1.
DBCC TRACESTATUS(1118)


Результат:
TraceFlag Status Global Session
1118 0 0 0

Подскажите, почему флаг не активируется? Что не так делаю?

При активации скриптом:
Код: sql
1.
DBCC TRACEON (1118, -1);


Результат виден:
TraceFlag Status Global Session
1118 1 1 0
...
Рейтинг: 0 / 0
MS SQL cъедает больше памяти, чем ему положено.
    #39604223
Фотография Megabyte
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Народ, ну подскажите, что не так делаю?

Настройку делаю по статьям:
https://technet.microsoft.com/ru-ru/library/ms190699(v=sql.105).aspx
https://toster.ru/q/264853
...
Рейтинг: 0 / 0
9 сообщений из 34, страница 2 из 2
Форумы / Microsoft SQL Server [игнор отключен] [закрыт для гостей] / MS SQL cъедает больше памяти, чем ему положено.
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]