Optimize mock controller and invoker.