Scaling a Declarative Cluster Manager Architecture with Query Optimization Techniques (Technical Report)