I'm interested to know if there's any way to perform a zero downtime upgrade between patch releases, e.g. from 3.1.8 to 3.1.9. When the patch version number is incremented, there shouldn't be any schema changes to the database (but there often are). In any event, the version number is incremented in the database, and the documentation suggests you should put your site into maintenance mode no matter what.
There are several places in the code that call the function
moodle_needs_upgrading() and halt execution when it returns true. These seem to be things like Cron, backup, and the scheduled task system.
I'd be interested in performing a Blue-Green deployment of patch upgrades. With this technique, you prepare a new set of application servers that contain the latest code and switch traffic to those when you're ready.
A more complicated technique is to switch some subset of your traffic to the new servers and see how it goes before releasing the new codebase to all users -- a so-called "canary deployment"
I don't think this is possible with Moodle. Are there any plans to make this possible, or any techniques you can recommend to upgrade without downtime?