[SERVER-6950] TCMalloc builds should report malloc stats as a ServerStatusSection Created: 05/Sep/12  Updated: 28/Oct/15  Resolved: 13/Nov/13

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 2.5.4

Type: Improvement Priority: Major - P3
Reporter: Mathias Stearn Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

In particular, heap_usage_bytes should use the generic.current_allocated_bytes numeric property rather than mallinfo() which will allow us to get a 64-bit value.



 Comments   
Comment by Ben McCann [ 13/Aug/15 ]

Can I ask why the tcmalloc option is disabled by default? We're being told to turn it on in https://jira.mongodb.org/browse/SERVER-17456 and I want to understand how to best patch our monitoring solution, DataDog, to include support for this option. Is it an expensive call or is it not enabled by default because it may be removed in the future or something?

Comment by Mathias Stearn [ 13/Nov/13 ]

While complete, this is disabled by default. To use it, you will need to opt-in:

> db.serverStatus({tcmalloc:true}).tcmalloc
{
        "generic" : {
                "current_allocated_bytes" : 66433383,
                "heap_size" : 69263360
        },
        "tcmalloc" : {
                "pageheap_free_bytes" : 253952,
                "pageheap_unmapped_bytes" : 0,
                "max_total_thread_cache_bytes" : 33554432,
                "current_total_thread_cache_bytes" : 758320
        },
        "formattedString" : "------------------------------------------------\nMALLOC:       66955328 (   63.9 MiB) Bytes in use by application\nMALLOC: +       253952 (    0.2 MiB) Bytes in page heap freelist\nMALLOC: +       555920 (    0.5 MiB) Bytes in central cache freelist\nMALLOC: +       739840 (    0.7 MiB) Bytes in transfer cache freelist\nMALLOC: +       758320 (    0.7 MiB) Bytes in thread cache freelists\nMALLOC: +      1306776 (    1.2 MiB) Bytes in malloc metadata\nMALLOC:   ------------\nMALLOC: =     70570136 (   67.3 MiB) Actual memory used (physical + swap)\nMALLOC: +            0 (    0.0 MiB) Bytes released to OS (aka unmapped)\nMALLOC:   ------------\nMALLOC: =     70570136 (   67.3 MiB) Virtual address space used\nMALLOC:\nMALLOC:            428              Spans in use\nMALLOC:             12              Thread heaps in use\nMALLOC:           8192              Tcmalloc page size\n------------------------------------------------\nCall ReleaseFreeMemory() to release freelist memory to the OS (via madvise()).\nBytes released to the OS take up virtual address space but no physical memory.\n"
}
> print(db.serverStatus({tcmalloc:true}).tcmalloc.formattedString)
------------------------------------------------
MALLOC:       67034960 (   63.9 MiB) Bytes in use by application
MALLOC: +        81920 (    0.1 MiB) Bytes in page heap freelist
MALLOC: +       518672 (    0.5 MiB) Bytes in central cache freelist
MALLOC: +       809984 (    0.8 MiB) Bytes in transfer cache freelist
MALLOC: +       817824 (    0.8 MiB) Bytes in thread cache freelists
MALLOC: +      1306776 (    1.2 MiB) Bytes in malloc metadata
MALLOC:   ------------
MALLOC: =     70570136 (   67.3 MiB) Actual memory used (physical + swap)
MALLOC: +            0 (    0.0 MiB) Bytes released to OS (aka unmapped)
MALLOC:   ------------
MALLOC: =     70570136 (   67.3 MiB) Virtual address space used
MALLOC:
MALLOC:            432              Spans in use
MALLOC:             12              Thread heaps in use
MALLOC:           8192              Tcmalloc page size
------------------------------------------------
Call ReleaseFreeMemory() to release freelist memory to the OS (via madvise()).
Bytes released to the OS take up virtual address space but no physical memory.

Comment by auto [ 13/Nov/13 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-6950 Add a TCMalloc ServerStatusSection
Branch: master
https://github.com/mongodb/mongo/commit/e4a1f917ad7a808e70018079ba1dac6d75831833

Generated at Thu Feb 08 03:13:12 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.