Skip to content

Implement MonitoredChannel - #718

Merged
jchmura-sc merged 44 commits into
mainfrom
jchmura/monitored_channel
Jul 30, 2026
Merged

Implement MonitoredChannel#718
jchmura-sc merged 44 commits into
mainfrom
jchmura/monitored_channel

Conversation

@jchmura-sc

@jchmura-sc jchmura-sc commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Purpose
The purpose of this PR is to add telemetry to our ShmChannel.

We want to know how many SampleMessage's are in each of our channels at any given time, since an empty channel implies a blocking recv, which implies a dataloader bottleneck. Conversely, if our channels stay comfortably above some low watermark then any changes upstream of dataloader.__next__ is unlikely to improve throughput.

PR Changes

  1. New class SizedShmChannel(ShmChannel): adds qsize() method to ShmChannel by attaching to the channels memory region and inspecting the C++ struct layout. It calculates queue size as the delta between the circular buffer's write and read sequence numbers.
  2. New class MonitoredShmChannel(SizedShmChannel): a subclass that integrates with the GiGL metrics service, pushing the qsize as a gauge on every recv() call.

Usage (colocated)

  1. Call gigl.src.common.utils.metrics_service_provider.initialize_metrics()
  2. Set GIGL_ENABLE_PERF_MONITORING env var to "True" or "1"

Context (Colocated-Mode)
Each of our N replicas launch N_local training workers. Each training worker initializes one or more data loaders (e.g. DistABLPLoader, DistNeighborLoader). Each dataloader is associated with a ShmChannel. For a given dataloader, multiple sampling workers (e.g. DistNeighborSampler, DistPPRNeighborSampler) push data into the queue.

The channel is roughly used like:

channel = ShmChannel()

# In dataloader process (single consumer)
def __next__(self):
    msg: SampleMessage = channel.recv() # Blocks if empty
    ... # Convert SampleMessage to PyG data

# In each`SamplingRuntime` worker process(multiple producers)
async def _send_adapter(self, ...):
    ... # Sample subgraphs    
    msg: SampleMessage = self._collate_fn(...) # Hydrate features over RPC
    channel.send(msg) # Blocks if channel is at capacity

Challenge
There is no direct way to gauge the queue size since GLT's ShmChannel does not expose the size to python.

Updated Changelog.md? NO

Ready for code review?: YES

@jchmura-sc jchmura-sc self-assigned this Jul 21, 2026
@jchmura-sc

Copy link
Copy Markdown
Collaborator Author

/unit_test

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 21:34:08UTC : 🔄 C++ Unit Test started.

@ 21:35:52UTC : ✅ Workflow completed successfully.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 21:34:10UTC : 🔄 Scala Unit Test started.

@ 21:43:27UTC : ✅ Workflow completed successfully.

@github-actions

Copy link
Copy Markdown
Contributor

GiGL Automation

@ 21:34:10UTC : 🔄 Python Unit Test started.

Comment thread gigl/distributed/utils/channel.py Outdated
Comment thread gigl/src/common/utils/metrics_service_provider.py Outdated
Comment thread gigl/distributed/utils/channel.py Outdated
Comment thread gigl/distributed/utils/channel.py Outdated
Comment thread gigl/distributed/utils/channel.py Outdated
Comment thread gigl/distributed/utils/channel.py Outdated
Comment thread gigl/distributed/utils/channel.py
Comment thread gigl/distributed/dist_ablp_neighborloader.py Outdated
Comment thread gigl/distributed/base_dist_loader.py Outdated

@kmontemayor2-sc kmontemayor2-sc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks Jacob!

@mkolodner-sc mkolodner-sc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks a lot :)

@jchmura-sc
jchmura-sc enabled auto-merge July 29, 2026 18:40
@jchmura-sc
jchmura-sc added this pull request to the merge queue Jul 29, 2026
Comment thread gigl/distributed/base_dist_loader.py
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 29, 2026
@jchmura-sc
jchmura-sc enabled auto-merge July 29, 2026 22:52
@jchmura-sc
jchmura-sc added this pull request to the merge queue Jul 29, 2026
Merged via the queue into main with commit 5d32ff5 Jul 30, 2026
7 checks passed
@jchmura-sc
jchmura-sc deleted the jchmura/monitored_channel branch July 30, 2026 03:03
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.

3 participants