Profile Loading Performance Testing Guide
Overview
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.Background
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
Test Setup
Prerequisites
- 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
Running the Test
Test Workflow
The 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
Manual Steps During Test
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
Metrics Collected
Profile Analysis
- 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
Timing Measurements
- 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
Origin Filtering Analysis
- 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
Interpreting Results
Profile Size
- < 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
Browser Startup Time
- < 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
Origin Filtering Potential
- > 50% reduction: Strong candidate for origin filtering
- 25-50% reduction: Moderate benefit from filtering
- < 25% reduction: Limited benefit
Origin Filtering Implementation
If testing confirms filtering would help, the recommended approach:1. API Parameter
Add optionalorigins parameter to browser creation:
2. Backend Implementation
Inkernel/packages/api/lib/profiles/service_cdp.go, modify LoadProfileIntoSession:
3. Domain Matching
Support flexible domain matching:google.commatches.google.com,accounts.google.com, etc.notion.somatches.notion.so,www.notion.so, etc.
Troubleshooting
Profile Not Saving
- Ensure
save_changes: trueis set - Wait at least 5 seconds after deleting browser
- Verify you created session state during login
Browser Startup Timeout
- Profile may be too large
- Check network connection
- Increase timeout if necessary
Download Fails
- Profile may not have saved data
- Browser must be deleted (not just closed)
- Wait longer for profile persistence
Test Results
Test Run: [Date]
Profile Details:- Size: X KB
- Cookies: X
- Origins: X
- Average startup: X ms
- Median startup: X ms
- Range: X ms
- Potential size reduction: X%
- Google origins: X
- Notion origins: X