| 1 | # vLLM Mock Engine |
| 2 | |
| 3 | `vllm-mock-engine` is a small engine-side process for frontend stress testing. It |
| 4 | joins a frontend-owned startup handshake, reports a large ready response, treats |
| 5 | prefill as instant, and emits random decode tokens until each request reaches |
| 6 | its `max_tokens`. |
| 7 | |
| 8 | The frontend must own the handshake socket. Start the frontend first, then start |
| 9 | the mock engine with the same handshake address. |
| 10 | |
| 11 | ## Start the mock engine |
| 12 | |
| 13 | ```bash |
| 14 | cargo run -p vllm-mock-engine -- \ |
| 15 | --handshake-address tcp://127.0.0.1:29550 \ |
| 16 | --engine-count 1 \ |
| 17 | --output-token-chunk-size 1 \ |
| 18 | --vocab-size 32000 \ |
| 19 | --seed 0 \ |
| 20 | --log-requests |
| 21 | ``` |
| 22 | |
| 23 | Useful knobs: |
| 24 | |
| 25 | - `--engine-count` must match the frontend's expected data-parallel engine |
| 26 | count. |
| 27 | - `--output-token-chunk-size` controls how many token IDs appear in one |
| 28 | `EngineCoreOutput`; values greater than 1 are useful for MTP/spec-decode |
| 29 | shaped frontend tests. |
| 30 | - `--vocab-size` should stay within the tokenizer vocabulary of the model used |
| 31 | by the frontend. |
| 32 | |
| 33 | Stop it with Ctrl-C. |
| 34 | |
| 35 | ## Rust Frontend |
| 36 | |
| 37 | Terminal 1: |
| 38 | |
| 39 | ```bash |
| 40 | cargo run --bin vllm-rs -- serve Qwen/Qwen3-0.6B \ |
| 41 | --data-parallel-size 1 \ |
| 42 | --data-parallel-size-local 0 \ |
| 43 | --handshake-port 29550 |
| 44 | ``` |
| 45 | |
| 46 | Terminal 2: |
| 47 | |
| 48 | ```bash |
| 49 | cargo run -p vllm-mock-engine -- \ |
| 50 | --handshake-address tcp://127.0.0.1:29550 |
| 51 | ``` |
| 52 | |
| 53 | For multiple mock engines, set both sides to the same count: |
| 54 | |
| 55 | ```bash |
| 56 | cargo run --bin vllm-rs -- serve Qwen/Qwen3-0.6B \ |
| 57 | --data-parallel-size 4 \ |
| 58 | --data-parallel-size-local 0 \ |
| 59 | --handshake-port 29550 |
| 60 | |
| 61 | cargo run -p vllm-mock-engine -- \ |
| 62 | --handshake-address tcp://127.0.0.1:29550 \ |
| 63 | --engine-count 4 |
| 64 | ``` |
| 65 | |
| 66 | ## Python Frontend |
| 67 | |
| 68 | Use `vllm serve` with `--data-parallel-size-local 0` so the Python process runs |
| 69 | as a frontend/API server and waits for external engines on |
| 70 | `--data-parallel-rpc-port`. |
| 71 | |
| 72 | Terminal 1: |
| 73 | |
| 74 | ```bash |
| 75 | vllm serve Qwen/Qwen3-0.6B \ |
| 76 | --data-parallel-address 127.0.0.1 \ |
| 77 | --data-parallel-rpc-port 29550 \ |
| 78 | --data-parallel-size 1 \ |
| 79 | --data-parallel-size-local 0 |
| 80 | ``` |
| 81 | |
| 82 | Terminal 2: |
| 83 | |
| 84 | ```bash |
| 85 | cargo run -p vllm-mock-engine -- \ |
| 86 | --handshake-address tcp://127.0.0.1:29550 |
| 87 | ``` |
| 88 | |
| 89 | ## Smoke Request |
| 90 | |
| 91 | After either frontend is ready: |
| 92 | |
| 93 | ```bash |
| 94 | curl http://127.0.0.1:8000/v1/chat/completions \ |
| 95 | -H "Content-Type: application/json" \ |
| 96 | -d '{ |
| 97 | "model": "Qwen/Qwen3-0.6B", |
| 98 | "messages": [{"role": "user", "content": "hello"}], |
| 99 | "max_tokens": 16, |
| 100 | "stream": true |
| 101 | }' |
| 102 | ``` |
| 103 | |
| 104 | Always pass `max_tokens`; the mock engine stops by length. |