Skip to content

Instantly share code, notes, and snippets.

@joshgord
joshgord / dataloader-chaining.md
Created February 14, 2026 21:49
DataLoader Chaining: The loadAndDispatch Bottleneck — Analysis and Migration Plan

DataLoader Chaining: The loadAndDispatch Bottleneck

Problem Summary

Gusto's GraphQL resolvers extensively use a pattern called loadAndDispatch() that defeats DataLoader batching, causing every chained DataLoader call to dispatch with a batch size of 1. This was identified as the primary driver of DataLoaderHelper being the #1 allocation source in production (48,910 samples / 11.6% of all allocations).


How the Bottleneck Was Identified

@joshgord
joshgord / BootstrapAgent.java
Last active November 14, 2020 17:01 — forked from raphw/BootstrapAgent.java
An example agent that intercepts a method of the bootstrap class loader.
package net.bytebuddy;
import net.bytebuddy.agent.ByteBuddyAgent;
import net.bytebuddy.agent.builder.AgentBuilder;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.ClassFileLocator;
import net.bytebuddy.dynamic.DynamicType;
import net.bytebuddy.dynamic.loading.ClassInjector;
import net.bytebuddy.implementation.MethodDelegation;
import net.bytebuddy.implementation.bind.annotation.SuperCall;
whatamidoing
whatamidoing