Skip to content

Conversation

@DiegoTavares
Copy link
Collaborator

@DiegoTavares DiegoTavares commented Dec 15, 2025

Overview

Update modules to properly store PSS (Proportional Set Size) alongside RSS (Resident Set Size) for measuring process memory usage on Linux systems.

Key Differences:

  • RSS: Total physical memory including full count of shared libraries (can be misleading)
  • PSS: Proportional share - shared pages divided by number of processes sharing them (more accurate)
  • Source: /proc/[pid]/smaps_rollup (Linux kernel 4.14+) provides pre-summed PSS values

Current State:

Rqd contains a config property to collect memory as either RSS or PSS. Information is saved on Cuebot and displayed as Rss.

Proposed Solution:

Rqd collects and reports both RSS and PSS. Cuebot stores both in the database. pycue and cuegui display both.

Tasks:

  • Update rqd to collect PSS
  • Update proto and cuebot to store data on the database
  • Update pycue and cuegui to display PSS
  • Fix accidentally refformated python files

@DiegoTavares DiegoTavares marked this pull request as ready for review January 6, 2026 23:48
@ramonfigueiredo ramonfigueiredo changed the title [Cuebot/cuegui/pycue/rqd] Store PSS and MaxPSS [cuebot/cuegui/pycue/rqd] Store PSS and MaxPSS Jan 7, 2026
Copy link
Collaborator

@ramonfigueiredo ramonfigueiredo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor suggestions

Comment on lines +19 to +28
ADD int_max_pss INT DEFAULT 0;

-- Add PSS fields to layer_resource table
ALTER TABLE layer_resource
ADD int_max_pss INT DEFAULT 0;

-- Add PSS fields to proc table
ALTER TABLE proc
ADD int_pss_max_used BIGINT DEFAULT 0,
ADD int_pss_used BIGINT DEFAULT 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data Type Inconsistency

  • job_mem.int_max_pss and layer_mem.int_max_pss use INT (4 bytes, max ~2TB in KB)
  • frame.int_pss_max_used and proc.int_pss_max_used use BIGINT (8 bytes)

For consistency and future-proofing, consider using BIGINT for all PSS fields. While 2TB is unlikely to be reached, using the same type across all tables improves maintainability.

max_used_gpu_memory: (stats.max_used_gpu_memory / KIB) as i64,
used_gpu_memory: (stats.used_gpu_memory / KIB) as i64,
children,
..Default::default()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing used_swap_memory in RunningFrameInfo

The RunningFrameInfo in clone_into_running_frame_info() uses ..Default::default() which means used_swap_memory (field 19) is not being set. This appears to be pre-existing, but worth noting if swap tracking is important.

int64 max_gpu_memory = 11;
int64 used_gpu_memory = 12;
FrameStateDisplayOverride frame_state_display_override = 13;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UpdatedFrame Missing PSS Fields

  • The UpdatedFrame message (used for incremental frame updates) doesn't include PSS fields (max_pss, used_pss). This means the FrameMonitorTree won't show updated PSS values during incremental updates - only on full refreshes.

byte[] children = new byte[100];

procDao.updateProcMemoryUsage(frame, 100, 100, 1000, 1000, 0, 0, 0, children);
procDao.updateProcMemoryUsage(frame, 100, 100, 100, 100, 1000, 1000, 0, 0, 0, children);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test coverage concern:

  • The test change only adds one line for PSS verification. Consider adding more comprehensive tests for:
    • PSS aggregation logic in updateJobMemoryUsage and updateLayerMemoryUsage
    • Edge cases (PSS > RSS, PSS = 0)

Comment on lines 88 to +91
/// Amount of memory used by all processes in this session
memory: u64,
rss: u64,
/// Amount of memory used by all processes in this session
pss: u64,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation comment inconsistency.

/// Amount of memory used by all processes in this session
rss: u64,
/// Amount of memory used by all processes in this session
pss: u64,

The pss comment is identical to rss. Should differentiate (as done in linux.rs:116-118):

/// Amount of memory used by all processes in this session calculated by rss
rss: u64,
/// Amount of memory used by all processes in this session calculated by pss
pss: u64,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants