Этот баннер — требование Роскомнадзора для исполнения 152 ФЗ.
«На сайте осуществляется обработка файлов cookie, необходимых для работы сайта, а также для анализа использования сайта и улучшения предоставляемых сервисов с использованием метрической программы Яндекс.Метрика. Продолжая использовать сайт, вы даёте согласие с использованием данных технологий».
Политика конфиденциальности

Новые сообщения [новые:0]
Дайджест
Горячие темы
Избранное [новые:0]
Форумы
Пользователи
Статистика
Статистика нагрузки
Мод. лог
Поиск
|
|
24.05.2018, 12:16
|
|||
|---|---|---|---|
Вопрос про процедурный кэш. |
|||
|
#18+
Сейчас обучаю человека на замену, и он задал вопрос прочитав одну статью и книгу, и я если честно немного тожн в ступоре. Вопрс про victim policy у SQL в случае memory pressure. В книге короткевича написано (2016 интерналс): SQL Server starts to remove plans from the cache in cases of memory pressure. There are two kinds of memory pressure: local and global . Local memory pressure happens when one of the cache stores grows too big and starts using too much SQL Server process memory. Global memory pressure happens when Windows forces SQL Server to reduce its physical memory usage, or when the size of all cache stores combined reaches 80 percent of the plan cache pressure limit. Local memory pressure is triggered when a cache store grows to 62.5 percent of the plan cache pressure limit. Local memory pressure can also be triggered based on the number of plans in the SQL and Object Plan cache stores. That number is about four times the hash table size Both local and global memory pressure remove plans from the cache using an algorithm called eviction policy , which is based on plan cost. For ad-hoc plans, the cost starts with zero and increments by one with every plan reuse. Other types of plans measure the cost of resources required to produce them. When not under memory pressure, costs are not decreased until the total size of all cached plans reaches 50 percent of the buffer pool size. At that point, the Lazy Writer process starts periodically scanning plan caches, decrementing the cost of each plan by one on each scan, removing plans with zero cost. Alternatively, each plan reuse increments its cost by one for ad-hoc queries, or by the original plan generation cost for other types of plans В книге 2012 интерналс (и тоже примерно тут ): As mentioned, when SQL Server detects memory pressure, all zero-cost plans are removed from cache, and the cost of all other plans is reduced by half. Any particular cycle updates the cost of at most 16 entries for every cache store. When an updated entry has a zero-cost value, it can be removed. SQL Server can’t free entries that are currently in use, If adding a particular plan to cache causes the cache store to exceed the limit, the removal of other plans from cache happens on the same thread as the one adding the new plan, which can cause the response time of the new query to be increased Дальше говориться что также уменьшается на один при каждом обращении. Так вот, я тут подумал и че та тоже не могу вьехать, как может кэш занимать 50% от buffer pool, если от так расрастется тогда будет Global Memory Pressure, которое когда сумма всех кешей больше 80% от cache memory pressure limit, если разростется один кэш, тогда будет Local (или 62.5 или по кол-ву бакетов). Также непонятно, это делает все таки тот же thread или отдельный. В 2012 написано этот же что и вставляет новый план (это как я понял при Local), а при глобал будет отдельным потоком. Также в томже BOL (как и 2012) написано что стоимость ВСЕХ планов уменьшается на (насколько тоже непонятно, толи на 1, то ли в два раза), и тамже сказано что за раз он смотрит только 16, если pressure сохранится то 32 и т.д. до 1024. Вопрос, где правда? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|

start [/forum/topic.php?fid=46&tablet=1&tid=1689673]: |
0ms |
get settings: |
6ms |
get forum list: |
11ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
44ms |
get topic data: |
7ms |
get forum data: |
2ms |
get page messages: |
21ms |
get tp. blocked users: |
1ms |
| others: | 208ms |
| total: | 304ms |

| 0 / 0 |
