dbt-labs/dbt-core

Make Memory Usage Reporting More Reliable

peterallenwebb opened this issue · 0 comments

At present, dbt uses python's resource.getrusage() function to record the max RSS upon termination. This is not reliable in all of our use cases. Unfortunately this value persists across fork and exec calls on linux, which means that the process which kicks off dbt may set a memory floor that dbt never reaches, obscuring its actual memory usage.

To improve the situation, we can use the /proc/self/status file which should be present on Linux systems, extracting the value of the VmHWM line from that file, which reprsents the high water mark (HWM) of the resident set size. When this file is missing we should fall back to the current implementation.