Performance characteristics of the IntegreSQL strategy
masterThe IntegreSQL strategy is designed to balance speed and isolation. By using a warm pool of replicas, the overhead of switching databases is minimized.
Key Performance Metrics:
- Cold Start: You only pay the full cost of template creation (truncate + migrate + seed) if your migration or fixture files have changed.
- Replica Selection: Once the pool is warm, selecting a new database for a test is extremely fast (e.g., ~11ms on average in small suites).
- Scaling: Even in larger suites (e.g., 280+ tests), the strategy overhead typically remains low (e.g., ~11% of total execution time), meaning tests spend most of their time executing rather than waiting for database setup.
--- -----------------<storageHelper strategy report>------------------ ---
replicas switched: 280 avg=26ms min=11ms max=447ms
replicas awaited: 1 prebuffer=8 avg=417ms max=417ms
background replicas: 288 avg=423ms min=105ms max=2574ms
- warm up template (cold): 40% 5151ms
* truncate: 8% 980ms
* migrate: 26% 3360ms
* seed: 4% 809ms
- switching: 60% 7461ms
* disconnect: 2% 322ms
* switch replica: 6% 775ms
- resolve next: 2% 358ms
- await next: 3% 417ms
* reinitialize: 50% 6364ms
strategy related time: --- 12612ms
vs total executed time: 11% 111094ms
--- -------------------------------------------------------------------- ---