MEMORYBROKER_FOR_STEAL vs MEMORYBROKER_FOR_CACHE

sakuraime 2,321 Reputation points
2020-08-28T18:26:45.973+00:00

what doesnt these two memory brokers do ??
MEMORYBROKER_FOR_STEAL <<< steal from buffer pool , but steal for what? what's the destination of this steal ?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,985 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. CathyJi-MSFT 21,101 Reputation points Microsoft Vendor
    2020-08-31T07:42:19.66+00:00

    Hi @sakuraime ,

    There are three types of memory brokers.

    MEMORYBROKER_FOR_CACHE – Memory allocations used by cached objects((Not Buffer Pool cache).
    MEMORYBROKER_FOR_STEAL – Memory used for compilations. Stolen from buffer pool.
    MEMORYBROKER_FOR_RESERVE – Memory used for query execution.

    Refer to this blog sys.dm_os_memory_brokers.

    Best regards,
    Cathy

    ===============================================

    If the response helped, do "Accept Answer" and upvote it.


  2. Shashank Singh 6,246 Reputation points
    2020-08-31T08:11:57.227+00:00

    I focus on MEMORYBROKER_FOR_STEAL. This broker tracks memory which is taken from buffer pool for operations/queries which require sorting or hash operations. Old Support article describes stolen memory as

    Stolen memory describes buffers that are in use for sorting or for hashing operations (query workspace memory), or for those buffers that are being used as a generic memory store for allocations to store internal data structures such as locks, transaction context, and connection information. The lazywriter process is not permitted to flush Stolen buffers out of the buffer pool.

    In a simple term if your query uses sort operation or hash operation it may need stolen memory which it takes from buffer pool and later returns it.

    OTOH the MEMORYBROKER_FOR_CACHE is basically tracking various caches

    Please note Brokers are basically memory monitors and based on their analysis memory to various components are allocated via memory manager

    0 comments No comments