Scaling Self-Hosted LLMs with GPU Optimization and Load Testing

fuzzy_labs · Tech · 2024 · source Agentic: no · promotional bias: med · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: self-hosted LLM serving for developer support

Fuzzy Labs needed to scale a public-facing RAG assistant backed by self-hosted models so developers could get fast answers while the business controlled GPU cost and safety risk.

Constraints:

Architecture

The initial architecture used a FastAPI model server running Hugging Face inference pipelines with a quantized Mistral 7B model, ChromaDB for retrieval, an orchestration service, and a separate guardrails service. Load testing with Locust exposed latency and concurrency limits, so the team replaced Hugging Face inference with a vLLM-style paged-attention runtime and used Ray Serve for horizontal GPU-backed model serving and autoscaling.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  A["Developer question"] --> B["Orchestration service"]
  B --> C["Guardrails service"]
  B --> D["ChromaDB vector database"]
  B --> E["Model server API"]
  E --> F["Mistral 7B model"]
  G["Locust load tester"] --> B
  E --> H["vLLM inference runtime"]
  H --> F
  I["Ray Serve autoscaler"] --> H
  I --> J["GPU servers"]
  H --> J
  C --> J
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Developer question User request about how to use customer-provided developer libraries or tooling. Orchestration service
Orchestration service Coordinates guardrails, retrieval, and model-server calls to answer a developer question. Developer question, Guardrails service, ChromaDB vector database, Model server API
Guardrails service Runs independent checks for topic fit, toxic language, discriminatory language, and PII. Orchestration service, GPU servers
ChromaDB vector database Stores a few million chunks of text for retrieval-augmented answers. Orchestration service
Model server API FastAPI service that initially wrapped Hugging Face inference pipelines on a GPU instance. Orchestration service, Mistral 7B model, vLLM inference runtime
Mistral 7B model Instruction-tuned quantized model used by the application. Model server API, vLLM inference runtime
Locust load tester Simulates concurrent user scenarios and failure testing to quantify serving behavior. Orchestration service
vLLM inference runtime Paged-attention inference runtime used to improve latency and throughput versus Hugging Face pipelines. Model server API, Mistral 7B model, GPU servers
Ray Serve autoscaler Deploys model serving across many servers and scales GPU-backed replicas with demand. vLLM inference runtime, GPU servers
GPU servers Expensive acceleration layer shared by the LLM, guardrail models, and embedding-related workloads. Guardrails service, vLLM inference runtime, Ray Serve autoscaler

Data flow

A developer question enters the orchestration service, which checks guardrails, retrieves context from ChromaDB, and calls the model server. The initial FastAPI/Hugging Face pipeline serves Mistral 7B on Kubernetes/GPU infrastructure; Locust load tests measure latency and concurrency; vLLM/paged attention improves single-server latency; Ray Serve then scales model serving horizontally and shares GPU capacity with auxiliary guardrail and embedding models.

3 supporting quotes
“the orchestration service's job is simply to coordinate all of these other services in order to answer a user's question”transcript, stated
“that question goes to our orchestration service the orchestration service first checks in with the guard rail service and then it sends the query to our model server”transcript, stated
“course going to be using the beta database to grab some context at some point this should look pretty standard as a retrieval augmented generation kind of architecture”transcript, stated

Why this architecture

The team deliberately benchmarked the simple baseline first, then optimized the single-server inference bottleneck with paged attention and addressed separate concurrency scaling with Ray Serve autoscaling rather than treating all performance problems as one hardware-scaling problem.

3 supporting quotes
“we don't just optimize stuff without first knowing what we're optimizing so that's what we did that was the first step here we used the tool called Locust”transcript, stated
“the simpler case to address is assume a single server assume a single instance of this model how do we improve the latency of that”transcript, stated
“scale is a different thing it's about how much concurrency we can support how many simultaneous users we can support while maintaining that latency”transcript, stated

Models used: Mistral 7B instruction-tuned quantized model · guardrail classification models · embedding model

Scale

Alternatives considered (roads not taken)

Optimize immediately based on architectural intuition

Rejected because: The team chose to benchmark first with Locust so optimization followed measured bottlenecks.

“we don't just optimize stuff without first knowing what we're optimizing so that's what we did that was the first step here we used the tool called Locust”transcript, stated

Keep the plain FastAPI plus Hugging Face pipeline baseline

Rejected because: Even one concurrent user had 11-second latency, and small concurrency increases made the service unusable.

“so we just ran like just fast API just hugging face pipelines nothing else no changes how does it perform”transcript, stated
“even a small amount it becomes essentially unusable very quickly not only is the latency high but it grows quickly”transcript, stated

Add more model servers before improving single-server latency

Rejected because: The simpler first bottleneck was single-server latency; horizontal scaling came after the single-instance runtime improved.

“we could do that and we can imagine that might help but the simpler case to address is assume a single server”transcript, stated

Manually scale GPU hardware

Rejected because: Ray Serve provided demand-based autoscaling and GPU sharing so the system could avoid over-provisioning expensive GPUs.

“you don't want to be doing that manually you don't want to be keep having human beings keep an eye on that so that's what autoscaling is”transcript, stated

Patterns

rag-retrieval (retrieval)

The assistant used a vector database to retrieve context for developer questions before answering with the model server.

“we have a vector database of course we have a vect today space we're using chroma DB”transcript, stated
“this should look pretty standard as a retrieval augmented generation kind of architecture”transcript, stated

safety-policy-enforcement (safety)

A separate guardrails service filtered inappropriate questions, toxic language, discriminatory language, off-topic requests, and PII independently of the LLM.

“this needs to be a public facing service and so our customer was very keen to ensure that you know users can't ask inappropriate questions”transcript, stated
“the guard rails component of this which again I'm not going to detail here but just to give you an idea that this is actually quite a complex piece of software”transcript, stated

eval-driven-development (evaluation)

Locust load tests drove the optimization sequence by revealing latency, request-rate, and concurrency bottlenecks before the team changed serving infrastructure.

“here we used the tool called Locust which is entirely python based and its job is to simulate traffic”transcript, stated
“at least it gives us a model and a framework in which we can start to measure the performance and do something about it”transcript, stated

Tradeoffs

Benchmark before changing infrastructure.

Chose Locust-based traffic scenarios and failure tests over prematurely swapping FastAPI, ChromaDB, or Hugging Face components by intuition.

Rationale: The team wanted measured bottlenecks before deciding whether the model server, vector database, or scaling layer actually needed replacement.

“premature optimization is the roots of all evil we don't just optimize stuff without first knowing what we're optimizing”transcript, stated

Fix latency before scaling replicas.

Chose paged-attention/vLLM-style inference for one server over adding more servers as the first response.

Rationale: Single-server latency was the simpler bottleneck and had to improve before horizontal scaling would make economic sense.

“the simpler case to address is assume a single server assume a single instance of this model how do we improve the latency of that”transcript, stated

Use Ray Serve for horizontal scaling.

Chose Ray Serve autoscaling across GPU servers over manual capacity management or a single model server.

Rationale: Ray Serve provided many-server deployment, demand-based scaling, and GPU support for LLM and auxiliary-model workloads.

“allows us to deploy our model to many servers but crucially it also gives us this idea of autoscaling”transcript, stated
“not just the ability to deploy to many servers but the ability to scale up and down on demand”transcript, stated

Gotchas (what bit them)

The simplest self-hosted baseline was too slow before realistic traffic arrived.

Root cause: FastAPI plus Hugging Face pipelines on one GPU server had high single-user latency and degraded quickly with small concurrency increases.

Resolution: Benchmark the baseline, then replace the inference runtime with paged-attention/vLLM-style serving before horizontal scaling.

“one concurrent user one user sending this request we have a latency of 11 seconds”transcript, stated
“it's gone up from 11 to 40 to 65 that growth rate that's a problem the system breaks down really quickly”transcript, stated

GPU cost made naive horizontal scaling risky.

Root cause: Adding enough GPUs to absorb every traffic spike could protect user experience but destroy the business case.

Resolution: Use Ray Serve autoscaling and GPU sharing so capacity grows with demand and can shrink back down.

“gpus are expensive you might say that's not about usual experience that's about business experience the business doesn't want to spend too much on gpus”transcript, stated
“if we throw money at the problem and just say never mind we'll scale up to as many gpus as we need then we run out of money”transcript, stated

Guardrails were not just a small wrapper around the LLM.

Root cause: The guardrails subsystem itself contained multiple independent models that could also need acceleration.

Resolution: Treat guardrails and embedding models as part of the GPU-capacity planning problem, not external afterthoughts.

“has a bunch of different models within it making these decisions independent of the the large language model”transcript, stated
“if we can share the GPU between multiple models then that's really cool because we don't need to provision additional Hardware”transcript, stated

Evaluation

The talk evaluates the architecture through Locust traffic scenarios, baseline latency/request-rate measurements, concurrency ramps, and comparative measurements after changing the inference runtime and scaling layer.

Metrics: latency at one user and under higher concurrency · requests per minute · throughput · concurrent user scenarios · failure-point load testing

3 supporting quotes
“Locust is you can say I have a series of different scenarios these scenarios are differentiated by how many concurrent users”transcript, stated
“one concurrent user one user sending this request we have a latency of 11 seconds”transcript, stated
“similarly request rate that improves quite significantly um and the throughput improves”transcript, stated

Outcomes

The talk frames scale as maintaining latency while supporting hundreds or thousands of concurrent sessions on expensive GPU infrastructure.

3 supporting quotes
“11 seconds 3 seconds 40 seconds 3 seconds that's kind of nice so it's not grown much”transcript, stated
“we were able to combine ultimately VM with Ray serve and have a solution which could do essentially subsec inference for a large language model”transcript, stated
“the combination of Ray serve and VM gave us everything we needed to be able to start getting real users from the public”transcript, stated