optimize the routers and the controllers