A concurrent Go-based auction simulator that models multiple bidders participating in simultaneous auctions with resource constraints.
auction-simulator/
├── cmd/
│ └── simulator/ # Main application entrypoint
│ └── main.go
├── internal/
│ ├── auction/ # Auction execution logic
│ │ └── auction.go
│ ├── bidder/ # Bidder behavior & types
│ │ └── bidder.go
│ ├── model/ # Shared data types
│ │ └── types.go
│ ├── resources/ # Resource management
│ │ └── limiter.go
│ └── util/ # Helper functions
│ └── attributes.go
└── tests/ # Test files
└── auction_test.go
- Clone the repository
git clone https://github.com/hemantkumar-dev/auction-simulator- Initialize and update dependencies
go mod tidy- Run the simulator
go run ./cmd/simulatorThe simulator accepts various command-line flags:
-bidders int: Number of bidders (default: 100)-auctions int: Number of concurrent auctions (default: 40)-timeout-ms int: Auction timeout in milliseconds (default: 800)-vcpu int: vCPU count for resource standardization (default: system CPU count)-ram-mb int: RAM in MB for resource standardization (default: 2048)-out string: Output directory for auction results (default: "sample-outputs")-seed int64: Random seed (default: current time)
Example with custom settings:
go run ./cmd/simulator -bidders 50 -auctions 20 -timeout-ms 500 -vcpu 4 -ram-mb 1024The simulator generates:
- Individual JSON files for each auction in the output directory (
auction_NNN.json) - A summary file (
summary.json) with overall statistics