This guide documents the process for testing profile loading performance with Google login across SaaS sites. The goal is to understand if large profiles cause slow browser startup times and whether origin filtering could improve performance.
Some customers use Kernel to manage multiple SaaS accounts by:
- Creating a synthetic Google account
- Logging into Google once in a browser
- Using "Login with Google" across many SaaS products
- Saving all state in a single mega-profile
- Reusing this profile across sessions
This can result in large profiles with many origins and cookies. This test measures the performance impact.
- Kernel API Key: Set
KERNEL_API_KEYenvironment variable - Google Account: A test Google account for logging in
- Node.js/Bun: To run the test script
cd kernel/packages/synthetic-tests
export KERNEL_API_KEY="your-api-key"
npx tsx src/profile-load-test.tsThe test performs these steps:
- Create Test Profile - Creates a new profile with unique name
- Create Browser - Launches browser with
save_changes: true - Manual Login - User logs into Google and Notion via live view
- Save Profile - Deletes browser to persist profile data
- Download Profile - Downloads profile via API
- Analyze Profile - Measures size, cookies, origins
- Measure Startup - Creates browsers with profile, measures timing
- Origin Analysis - Calculates filtering potential
When the test pauses, you need to:
- Open the Live View URL displayed in the terminal
- Navigate to
https://accounts.google.com - Log in to your test Google account
- Navigate to
https://www.notion.so - Click "Continue with Google" or "Login with Google"
- Complete the login flow
- Wait for Notion to load completely
- Press Enter in the terminal to continue
- Total Size: Profile JSON size in KB and bytes
- Cookie Count: Total cookies across all domains
- Origin Count: Unique origins with stored data
- Top Origins: Origins with most cookies/localStorage
- Domain Breakdown: Cookies, localStorage, IndexedDB per domain
- Browser Creation Time: Time from API call to browser ready
- Navigation Time: Time to navigate to Notion
- Total Time: Combined time for full browser startup
- Statistics: Average, median, min, max across 3 iterations
- Google-related origins/cookies: Count and percentage
- Notion-related origins/cookies: Count and percentage
- Minimal profile size: Size if only Google + Notion origins were loaded
- Size reduction: Percentage reduction from filtering
- < 100 KB: Small profile, unlikely performance issues
- 100 KB - 1 MB: Medium profile, minor impact possible
- 1 MB - 10 MB: Large profile, likely performance impact
- > 10 MB: Mega-profile, significant impact expected
- < 5 seconds: Fast startup, no optimization needed
- 5-10 seconds: Moderate startup, optimization may help
- 10-30 seconds: Slow startup, optimization recommended
- > 30 seconds: Very slow, optimization critical
- > 50% reduction: Strong candidate for origin filtering
- 25-50% reduction: Moderate benefit from filtering
- < 25% reduction: Limited benefit
If testing confirms filtering would help, the recommended approach:
Add optional origins parameter to browser creation:
await kernel.browsers.create({
profile: {
name: 'my-profile',
origins: ['google.com', 'notion.so'],
},
});In kernel/packages/api/lib/profiles/service_cdp.go, modify LoadProfileIntoSession:
// Filter cookies by allowed origins
if len(allowedOrigins) > 0 {
filteredCookies := filterCookiesByOrigins(state.Cookies, allowedOrigins)
filteredOrigins := filterOriginsByList(state.Origins, allowedOrigins)
}Support flexible domain matching:
google.commatches.google.com,accounts.google.com, etc.notion.somatches.notion.so,www.notion.so, etc.
- Ensure
save_changes: trueis set - Wait at least 5 seconds after deleting browser
- Verify you created session state during login
- Profile may be too large
- Check network connection
- Increase timeout if necessary
- Profile may not have saved data
- Browser must be deleted (not just closed)
- Wait longer for profile persistence
Profile Details:
- Size: X KB
- Cookies: X
- Origins: X
Timing Results:
- Average startup: X ms
- Median startup: X ms
- Range: X ms
Origin Filtering Analysis:
- Potential size reduction: X%
- Google origins: X
- Notion origins: X
Recommendation: [Based on results]