Skip to content
This repository was archived by the owner on Aug 1, 2026. It is now read-only.
This repository was archived by the owner on Aug 1, 2026. It is now read-only.

Cross world thread pool scheduling for backend calls #31

Description

@Blovien

Right now the threading model of the project on an high level perspective could be described like this (assuming only one backend):

flowchart TD
    Server["Hytale server"] --> W1["World A / Dimension A"]
    Server --> W2["World B / Dimension B"]
    Server --> W3["World C / Dimension C"]

    W1 --> T1["Impulse physics worker thread A"]
    W2 --> T2["Impulse physics worker thread B"]
    W3 --> T3["Impulse physics worker thread C"]

    T1 --> S1["World A physics spaces"]
    T2 --> S2["World B physics spaces"]
    T3 --> S3["World C physics spaces"]

    S1 --> R["Shared Rapier backend + native library"]
    S2 --> R
    S3 --> R

    R --> RP["Rapier Rayon worker pool"]
Loading

The proposed change, to minimize multi world calculation in a low-core cpu scenario, is as follows:

flowchart TD
    Server["Hytale server"] --> L1["Lane A: World/Dimension A"]
    Server --> L2["Lane B: World/Dimension B"]
    Server --> L3["Lane C: World/Dimension C"]
    Server --> L4["Lane D: Loaded but mostly idle"]

    L1 --> Q1["Lane queue: FIFO mutations + step lane"]
    L2 --> Q2["Lane queue: FIFO mutations + step lane"]
    L3 --> Q3["Lane queue: FIFO mutations + step lane"]
    L4 --> Q4["Lane queue: FIFO mutations + step lane"]

    Q1 --> SCHED["PhysicsOwnerScheduler"]
    Q2 --> SCHED
    Q3 --> SCHED
    Q4 --> SCHED

    SCHED --> P1["Owner pool thread 1"]
    SCHED --> P2["Owner pool thread 2"]

    P1 --> A["Run one lane command at a time"]
    P2 --> B["Run one different lane command at a time"]

    A --> SpacesA["Lane-owned physics spaces"]
    B --> SpacesB["Lane-owned physics spaces"]

    SpacesA --> R["Shared Rapier backend + native library"]
    SpacesB --> R

    R --> RP["Capped or disabled Rapier Rayon pool"]
Loading

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions