Resource Blocking
Block unnecessary resources to speed up page loads:Disable Resources
Block fonts, images, media, and other non-essential resources:font- Web fontsimage- Images and iconsmedia- Videos and audiobeacon- Analytics beaconsobject- Embedded objectsimageset- Responsive imagestexttrack- Video subtitleswebsocket- WebSocket connectionscsp_report- CSP reportsstylesheet- CSS files
scrapling/engines/constants.py:2-13
Block Specific Domains
Block analytics and tracking domains:Subdomains are automatically matched: blocking
example.com also blocks sub.example.com.scrapling/engines/_browsers/_stealth.py:199
Concurrency Settings
Concurrent Requests
Control how many requests run simultaneously:scrapling/spiders/spider.py:76
Per-Domain Concurrency
Limit concurrent requests per domain to avoid overwhelming servers:scrapling/spiders/spider.py:77
Download Delay
Add delay between requests to the same domain:scrapling/spiders/spider.py:78
Page Pooling
Reuse browser pages instead of creating new ones:Session Page Pooling
scrapling/engines/_browsers/_validators.py:62
Pool Statistics
Monitor page pool usage:scrapling/engines/_browsers/_base.py:125-131
Network Optimization
Skip Network Idle
Don’t wait for network to be completely idle:network_idle=True when you need to ensure all async requests complete.
Source: scrapling/engines/_browsers/_stealth.py:52
Skip DOM Loading
For static content, skip waiting for JavaScript:scrapling/engines/_browsers/_stealth.py:67
Reduce Wait Time
Minimize or remove post-load wait:scrapling/engines/_browsers/_stealth.py:54
Timeout Optimization
Set appropriate timeouts:scrapling/engines/_browsers/_stealth.py:53
Headless Mode
Always use headless mode in production:scrapling/engines/_browsers/_stealth.py:46
Browser Flags
Scrapling uses optimized browser flags by default:scrapling/engines/constants.py:24-37
Add custom flags for additional optimization:
Complete Optimization Example
Maximum Speed Configuration
Balanced Configuration
For sites that need more stability:Async Best Practices
Use uvloop
Use uvloop for faster async performance:scrapling/spiders/spider.py:264-281
Batch Processing
Process items in batches:Memory Optimization
Parser Storage
For huge HTML documents, use disk-based storage:scrapling/engines/toolbelt/custom.py:140-154
Adaptive Parsing
Adaptive mode reduces memory for simple selections:scrapling/engines/toolbelt/custom.py:141
Benchmarking
Track performance metrics:Performance Comparison
Best Practices
Profile Before Optimizing
Profile Before Optimizing
Measure performance before making changes:
Use Resource Blocking
Use Resource Blocking
Always block unnecessary resources:
Tune Concurrency
Tune Concurrency
Start conservative, increase gradually:Monitor error rates as you increase concurrency.
Use Sessions for Multiple Requests
Use Sessions for Multiple Requests
Sessions reuse connections and browser instances:
Related Documentation
Anti-Bot Bypass
Balance speed with stealth
Error Handling
Handle errors efficiently
Handling Blocked Requests
Retry strategies
Cloudflare Turnstile
Solve challenges faster