Not a silver bullet, but did you look into isolated-vm? https://github.com/laverdet/isolated-vm
But generally, I think best bet is to offload such things to e.g. Lambda per tenant.
But generally, I think best bet is to offload such things to e.g. Lambda per tenant.