← Back to Analysis

Performance Agent

performance.check.js

What This Agent Does

The Performance Agent measures website speed and optimization, including response times, page size, compression, caching, and resource optimization.

Category Information

Property Value
Category Name Performance
Category Icon
Source File src/checks/performance.check.js

Checks Performed

Response Time

Time to First Byte (TTFB) - how quickly the server responds to requests.

Page Size

Total size of HTML response. Large pages slow down loading.

Gzip/Brotli Compression

Checks if content is compressed to reduce transfer size.

Cache Headers

Validates Cache-Control and ETag headers for browser caching.

Keep-Alive

Checks if persistent connections are enabled.

Resource Count

Number of scripts, stylesheets, and images loaded.

Data Sources

Libraries Used

  • axios — HTTP client with timing information

Data Points Collected

const startTime = Date.now();
const response = await axios.get(url, { timeout: 15000 });
const responseTime = Date.now() - startTime;

// From headers
const contentLength = response.headers['content-length'];
const contentEncoding = response.headers['content-encoding'];
const cacheControl = response.headers['cache-control'];

// From response
const htmlSize = response.data.length;

Performance Thresholds

Metric Good Warning Poor
Response Time < 500ms 500ms - 2s > 2s
Page Size < 500KB 500KB - 2MB > 2MB
Compression Enabled - Disabled

Return Value

{
  category: 'Performance',
  icon: 'zap',
  score: 0-100,
  checks: [
    {
      name: 'Response Time',
      status: 'pass',
      description: 'Server responded in 234ms',
      severity: 'high'
    },
    {
      name: 'Gzip Compression',
      status: 'pass' | 'fail',
      description: 'Content is gzip compressed',
      severity: 'medium'
    },
    // ... more checks
  ]
}