@nestjsforge/echarts
Performance
Tips for optimizing render performance in production environments.
Browser Pool Tuning
The browser pool size directly impacts throughput and memory usage. Each Puppeteer instance consumes ~100–300 MB of RAM.
| poolSize | Max concurrent renders | Approximate RAM usage |
|---|---|---|
| 1 | 1 | ~200 MB |
| 2 (default) | 2 | ~400 MB |
| 4 | 4 | ~800 MB |
| 8 | 8 | ~1.6 GB |
Concurrency Control
Use maxConcurrentRenders to queue renders instead of failing when all instances are busy:
EChartsModule.forRoot({
poolSize: 4,
maxConcurrentRenders: 20, // Queue up to 20 renders
timeout: 30_000,
})renderMany for bulk operations
For bulk chart generation (reports, exports), use renderMany() instead of sequential renderToBuffer() calls:
// ❌ Sequential — slow
const buffers = [];
for (const opt of options) {
buffers.push(await this.echarts.renderToBuffer(opt));
}
// ✅ Concurrent — uses the full pool
const buffers = await this.echarts.renderMany(options);