[ANN] ReactantServer.jl: serve Julia models compiled with Reactant, at any scale

I’m excited to announce the v0.1.0 release of ReactantServer.jl, an inference server for models compiled with Reactant.jl!

From a single desktop GPU to a multi-node GPU cluster, ReactantServer has you covered:

  • Load more models than fit on your GPU: model weights hot swap at PCIe speed, so you can serve far more models than fit in device memory. Gaming and workstation class GPUs can effectively serve as many models as fit in system RAM.
  • KServe V2 Inference Protocol: call ReactantServer from any language with a gRPC client. We also provide ReactantServerClient.jl, tuned for low overhead and memory efficiency, with shared memory support for model inputs and outputs.
  • Pre/post-processing in native Julia: already compiled your model but forgot to add a softmax output alongside your logits? Declare a second output in pure Julia right alongside your model.
  • Scale up to multiple GPUs: ReactantServerGateway.jl sits in front of many ReactantServer workers as a load balancer. It can redistribute models across devices to balance compute and memory, or use standard strategies such as round-robin and least-outstanding (by requests or estimated compute time). Replica counts per model and scheduler behavior are configurable, including encouraging batch coalescing.
  • Compile and export Lux.jl and PyTorch models with ReactantServerExport.jl; Support for Jax and other frameworks is something we are looking into for future releases, but in principle if you can express your model as a pure function of inputs and weights, you can easily export and serve it today if it compiles with Reactant.
  • Simple unified configuration: the same node configuration syntax works whether you run ReactantServer.jl alone or use ReactantServerNode.jl to spin up many workers and a gateway automatically.
  • Regulated profile for deterministic inference: modern inference stacks have many sources of nondeterminism. The regulated profile ensures that on the same hardware and software versions, the same input always returns the same output.

Getting Started

You can use ReactantServer directly from Julia via Pkg in your own environment, or use the container image built for every release; tutorials for the container style deployment here: single gpu & multi gpu

Future Plans

  • We do plan on supporting local LLM serving in the future, but the initial focus of the project was on smaller vision and language models.
  • Make storing weights in RAM optional for workloads that can fit everything across the available GPUs
  • PRs welcome!

Acknowledgements

  • All of the Reactant/Enzyme/Enzyme-JAX contributors for the foundation this project sits on and for putting up with me as I continue to learn more about Reactant’s internals through trial and error.
  • Medical Metrics Inc. for funding the projects development and allowing it to be open sourced.

Very cool stuff! Nice work on this, I’m looking forward to experimenting with it!

Just released v0.2.0, which contains a large number of bug fixes, optimizations, and improvements to default behavior.

Host RAM. Previously the server was built around hot-swapping models, and it kept a copy of every model’s weights in host RAM in case it had to reload one. For workloads that don’t swap, that was extremely wasteful. Host RAM is now a cache with a size you set (runtime.host_weight_budget), shared by the workers on a node. It defaults to zero, so no weights are kept in RAM; set it to unlimited for the old behavior. A model that has to be reloaded and has no copy in RAM is read from disk. That read happens in the background and never holds the GPU, but it adds latency to that model’s requests.

Fragmentation. Before uploading a model, a worker checks against the allocator’s own statistics that the weights will fit, both in total bytes and as a single contiguous block. If they won’t, it evicts only what’s needed. In normal operation you no longer run into failed allocations or need to reset the arena; compaction remains as a fallback.

Unified Cost Model. Every cost is now measured in device time, the seconds a GPU is busy. Compute, weight uploads and memory pressure all become device time, so they trade off against each other directly instead of being tuned separately. Each layer applies its own objective to that common currency:

  • Placement (gateway): minimizes mean latency across workers. A model that doesn’t fit in a worker’s memory is charged the uploads it will cause, so memory pressure and compute load are weighed together.
  • GPU eviction (worker): evicts what is cheapest to reload, weighted by how often each model is used (Greedy-Dual-Size-Frequency).
  • Host RAM eviction: keeps the copies the GPUs reload most often. A disk read costs latency, never GPU time, so its cost is charged here.

This is an extremely breaking release, but it was needed in order to make the project more generally useful. When you load the server up, it should behave like you expect an inference server to behave by default, while still providing cutting edge functionality and scheduling far beyond what you get in other solutions.