Skip to content

Benchmark-Based Job Assignment Workflow

Overview

The job scheduling service now implements a benchmark-first approach for job assignment. Before assigning work to an agent, the system verifies that the agent has a valid benchmark for the specific attack mode and hash type combination.

Workflow

  1. Job Assignment Request
  2. Scheduler identifies an available agent and a pending job
  3. Job execution details are retrieved, including the hashlist

  4. Benchmark Check

  5. System checks if agent has a benchmark for the attack mode and hash type
  6. If benchmark exists, checks if it's still valid (default: 7 days cache)
  7. Cache duration can be configured via benchmark_cache_duration_hours setting

  8. Benchmark Request (if needed)

  9. If no valid benchmark exists, system sends enhanced benchmark request
  10. Request includes actual job configuration:
    • Binary version
    • Wordlists and rules (if applicable)
    • Mask (for brute force attacks)
    • Hash type and attack mode
    • Test duration (30 seconds)
  11. Job assignment is deferred until benchmark completes

  12. Benchmark Execution (Agent side)

  13. Agent receives benchmark request with full job configuration
  14. Runs actual hashcat benchmark with the specific parameters
  15. Reports back real-world performance metrics

  16. Job Assignment (after benchmark)

  17. Once benchmark is received and stored, agent becomes available again
  18. Next scheduling cycle will find the valid benchmark
  19. Chunk calculation uses accurate performance data
  20. Job task is assigned with properly sized chunks

Benefits

  • Accurate Performance Estimation: Benchmarks use actual job configuration
  • Optimal Chunk Sizing: Prevents under/over-utilization of agents
  • Reduced Job Failures: Avoids assigning work that agents can't handle
  • Better Resource Utilization: Chunks are sized based on real performance

Configuration

  • benchmark_cache_duration_hours: How long benchmarks remain valid (default: 168 hours / 7 days)
  • chunk_fluctuation_percentage: Tolerance for final chunk size variations (default: 20%)
  • default_chunk_duration: Target duration for each chunk in seconds (default: 1200 / 20 minutes)

Implementation Details

Modified Components

  1. JobSchedulingService (assignWorkToAgent)
  2. Added benchmark validation before chunk calculation
  3. Defers assignment if benchmark is needed
  4. Retrieves hashlist to get hash type

  5. JobWebSocketIntegration (RequestAgentBenchmark)

  6. New method implementing the interface
  7. Sends enhanced benchmark request with full job configuration
  8. Includes wordlists, rules, mask, and binary information

  9. WebSocket Types

  10. BenchmarkRequestPayload enhanced with job-specific fields
  11. Supports real-world speed testing with actual attack parameters

Error Handling

  • Missing benchmarks trigger requests instead of failures
  • Invalid benchmarks are detected and refreshed
  • WebSocket unavailability is properly handled
  • Graceful degradation if benchmark request fails

Future Enhancements

  1. Benchmark History: Track benchmark trends over time
  2. Performance Prediction: Use ML to predict performance for new combinations
  3. Dynamic Re-benchmarking: Trigger new benchmarks on performance anomalies
  4. Multi-GPU Optimization: Per-device benchmark tracking