The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
vLLM and SGLang, side by side. Learn how LLM serving works, measure both engines fairly, tune them with evidence, and take a model from an empty GPU to a deployment with a cost per million tokens you can defend.
Minimum price
$10.99
$29.00
About the Book
vLLM and SGLang are two of the most widely used open-source engines for serving open-weight language models. Both are fast. Both have dozens of settings. And much of the advice online is old, copied from version to version, or based on tests that are not fair.
This book gives you a better way: measure first, then tune, using your own numbers.
You start with what happens to one request inside the server. Then you build up, chapter by chapter, to a complete project: a written target, a fair benchmark of both engines on the same GPU, tuning, a container, a Kubernetes file, monitoring, and a cost per million tokens you can defend in a meeting.
* Explain prefill, decode, and the KV cache, and do the memory math before you rent a GPU
* Understand how PagedAttention (vLLM) and RadixAttention (SGLang) work, and when each one helps
* Serve a model with either engine: streaming, structured JSON output, tool calls and LoRA adapters
* Benchmark fairly with TTFT, TPOT, p99, throughput and goodput, and spot the mistakes that make a result look better than it is
* Tune one setting at a time and keep a log that proves what helped
* Use FP8 and 4-bit formats, multi-GPU and mixture-of-experts serving, and speculative decoding
* Package, deploy and monitor the server, and turn tokens per second into a price
Chapter 13 includes a complete benchmark of both engines on the same GPU, with exact versions, settings, tables and a chart. It also shows the traps met on the way, such as a default setting that quietly limited one engine's throughput. You get the method and a repeatable script, so you can run the same test on your own hardware.
The book is written in plain English. Key terms are explained when they first appear, with simple diagrams and a kitchen analogy for beginners. "Going deeper" boxes give engineers the internals and the trade-offs. Every chapter has a summary, 5 exercises and a 5-question quiz, with answers at the back. You also get a one-page cheat sheet, a glossary and a code index.
All the code is open source (MIT) at github.com/salmansajidsattar/vllm-sglang-book: simulators that run on a laptop with no GPU, a benchmark harness for both engines, deploy files, and a one-file runner for a free Colab or Kaggle GPU.
* AI and ML engineers moving a model from a notebook to production
* Data and platform engineers who must run LLMs on GPUs and keep the cost under control
* Students and self-taught developers who want to understand how LLM serving really works
You need basic Python and the command line. The first four chapters and the simulators need no GPU.
An independent guide, not affiliated with the vLLM or SGLang projects. Benchmarks use vLLM 0.32.0 and SGLang 0.5.22 on a Tesla T4 (October 2026).
About the Author
Salman Sajid is an AI engineer who works across AI systems and data engineering. He builds production-ready systems with large language models: RAG pipelines, AI agents, document search, and the data pipelines and backends that support them. He turns research ideas into systems that run in the real world.
Click the buttons to get the free sample in PDF or EPUB, or read the sample online here
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.