Skip to content

Memory duplication when scaling ML models – any plan to support shared memory / copy‑on‑write? #83

Open

Description

@AngelFelizR

First, thank you for plumber2 – it's a fantastic tool.

When scaling an API that serves a large ML model, each worker process loads its own full copy of the model. On Linux, a forking model (like RestRserve + Rserve) would allow copy‑on‑write sharing, drastically reducing memory usage and cloud costs.

I understand plumber2 is built on httpuv/libuv, which isn't fork‑safe. But is there any interest in:

  • an optional fork‑based backend (even experimental)?
  • helpers to load models into shared memory (e.g., via mmap)?
  • official guidance to delegate prediction to a separate forking service?

If not, I'll continue using workarounds. Just wanted to raise this as a real pain point for production ML in R.

Thanks again.

Activity

  1. jrosell commented on Apr 19, 2026

    @jrosell

    Recently I learned about {morai} by @shikokuchuo but I didn't try yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions