On this page

Concurrent Job Scheduling internals

The Enterprise admin schedules maintenance jobs in the default worker lane using a fixed policy. For an example of what changes during a recovery, see Concurrent Job Scheduling.

Try it on a test cluster

Use an Enterprise test cluster with a master, filer and at least two volume servers. This example uses vacuum and volume balance so you can observe concurrent maintenance on healthy hardware. Both jobs need eligible work on different volumes. For installation and evaluation terms, see the deployment guide.

  1. Connect the Enterprise admin and worker. If the test cluster already has an Enterprise admin, use its address. Otherwise, start one with weed admin -master=localhost:9333. In another terminal on the same host, start a worker with two execution slots. Substitute your admin’s HTTP address if it runs elsewhere.

    weed worker -admin=localhost:12535 -jobType=vacuum,volume_balance -maxExecute=2
    
  2. Give each job something to do. Use disposable test data. For vacuum, delete enough data on one volume to exceed its garbage threshold (30% by default) and allow any configured retention window to pass. For balance, add an empty volume server to a cluster with several movable volumes on another server. In the Admin UI, check that both job types are enabled. For a short evaluation, set both detection intervals to one minute.

  3. Observe an overlap. While the batches run, open /api/plugin/scheduling/layout on the admin in your signed-in browser and refresh it. In the types array, look for vacuum and volume_balance each showing a positive running count in the same response. The jobs array identifies the volumes each job is working on. If the jobs finish between observations, try a larger batch. If one type has no work, check its detection activity and eligibility settings.

Volume ownership and worker slots

A queued job that will modify a volume reserves it before execution. Other jobs that would change the same volume must wait. Detectors plan against queued and running work. When the scheduler defers a job because another type owns the volume, it can reserve the next turn for the waiting type. After a job finishes, a quiet period gives volume servers time to report the change. The next start also depends on detection, eligibility and worker capacity.

A job type with waiting work and nothing running gets priority for available slots. When short and long jobs share a lane with multiple slots, the scheduler keeps one slot available for short jobs such as vacuum or volume balance. Jobs that declare transfers also reserve disk space and transfer capacity. Byte reservations are approximate, and some jobs, including EC repair, declare no transfers.

Cluster locks

Vacuum, volume balance, erasure coding, EC balance and EC vacuum can take the cluster lock around individual topology changes. EC repair, volume maintenance, volume tiering and admin scripts hold it for their whole run. During a rolling upgrade, the Enterprise admin can schedule different types together while older workers continue to use whole-job locks. Per-call locking requires both an admin and a worker that support it.

Whole-job lock lock held for the whole move — copy, tail, switch over An operator's shell lock waits for the longest running job. Lock per call — SeaweedFS Enterprise copy runs without the lock mark read-only mount copy delete source Each blue call is checked: did anyone else change this volume since the job started?
During a volume move, the worker can copy data while a shell operator holds the cluster lock. It needs the lock again to change which copies the master sees.

On a six-server test cluster running vacuum, balance and erasure coding, the admin held the lock for 6% of busy time with per-call locking, down from 100% with whole-job locking. The median wait for an operator’s shell lock fell from 6.4 seconds to 0.32 seconds. The longest observed wait fell from 2 minutes 35 seconds to 7 seconds. EC repair uses a whole-job lock and was outside this measurement.

If an operator changes a volume mid-job

Before a worker changes the topology, the admin checks the volume against its starting state and the changes the job has already made. When the master’s view disagrees, the admin checks with the volume server. A delete, including one during rollback, requires confirmation that the data still exists elsewhere.

For example, if an operator removes the destination copy during a move, the worker must keep the source. If the operator removes the source, rollback must keep the destination. After the admin refuses a change, the job can undo its own work. An interrupted move may leave a read-only volume or an extra replica. Inspect the layout before using volume.mark -writable or volume.fix.replication to reconcile it.

Property tests exercise moves, encodes and decodes against concurrent operator actions and delayed master updates. Cluster tests cover an operator moving a volume during a job, deleting a source during a copy, and losing a volume server during maintenance.

Inspect the scheduler

Use these HTTP endpoints on the Enterprise admin with your usual admin authentication.

Endpoint What to look for
GET /api/plugin/scheduling/layout types gives queued and running counts and deferrals by job type. jobs identifies each job’s worker and volumes. volumes shows ownership, and disks and nodes show reservations.
GET /api/plugin/scheduling/policy The policy’s short-job slot reserve, quiet period in heartbeats, and disk and transfer limits.

A queued job’s waiting_detail, when present, explains its most recent start deferral. The activity log also reports why jobs were deferred and summarizes repeated deferrals.