Engines and the scheduler
All the CAD work happens in ClassCAD engines: opening and checking files, measuring them, building assemblies, exporting, running generators, and the editor when it runs on the server. An engine is one classcad-cli worker process. It works on one thing at a time, and a big file can keep it busy for a while.
So the PDM doesn't talk to one engine. It talks to the scheduler, classcad-scheduler, which keeps a pool of engines behind one port and decides where each piece of work goes:
- A session stays where it is. A generator run or an editing session lives in one engine; everything it sends goes there.
- New work goes where there's room: the engine with the fewest requests in flight, then the fewest sessions, then the least memory used. Engines that are full, over their memory limit or not ready get nothing new.
- Heavy work is kept apart. Imports, exports and other long jobs can go to engines of their own, so they don't hold up someone who's editing.
- The pool grows and shrinks. When no engine has room, the scheduler starts one, up to a limit. An engine that has been idle for 10 minutes is retired.
- Crashed engines come back. The scheduler checks every engine every 2 seconds. One that misses three checks is taken out and started again. Sessions that were saved to disk move to another engine; the PDM retries jobs that were lost.
You run one scheduler per server. Setting it up is in The scheduler.
note
The scheduler is part of the ClassCAD runtime and in development alongside the PDM. It isn't in a ClassCAD release yet.