New Tool Radar

Local AI

How to Serve Several Users at Once With llama.cpp Parallel Slots

Raise the number of parallel slots on llama.cpp's server with -np so several users can chat at once instead of queueing behind one.

Schematic diagram with four steps: start the server with -np 4, send two chats at once, watch the memory use, then confirm both users get replies.

One llama.cpp server can serve more than one user at a time: it supports parallel decoding with multi-user support, and the -np flag sets how many parallel slots it runs. Without it, a second user waits for the first user’s generation to finish.

Start the server with parallel slots

Start the server with -np 4 to run four parallel slots, for example llama serve -hf bartowski/Meta-Llama-3.1-8B-Instruct-GGUF:Q4_K_M -c 32768 -np 4 -ngl all --port 8080. Each slot holds one conversation’s context, so the context size is shared across the slots you set: four slots at 32k total means each slot gets a share of it, not 32k each.

llama serve -hf bartowski/Meta-Llama-3.1-8B-Instruct-GGUF:Q4_K_M \
  -c 32768 -np 4 -ngl all --port 8080 --alias llama3.1-8b

More slots is not free: every slot holds KV cache, so the memory cost grows with the slot count and the context size. Start with two or four, watch the memory, and raise it only if the machine has room. A slot count of one is the right choice for a single-user machine.

Try it: four checks

Check What you should see If you do not see it
Slots set The server starts with the -np value Check the startup log for the slot count
Two users served Two chats run at the same time Raise -np if the second waits
Memory fits The machine has memory for all slots Lower -np or -c if it does not
No context errors Long chats do not run out of context Context is shared across slots

Expected result. We checked the llama.cpp server README, which lists parallel decoding with multi-user support among the server’s features. We did not run the server on this machine.

Limits

This guide covers the slot count only. The exact memory per slot depends on the model and context size. We did not test any server ourselves.

Sources

See all