Optimal Design of Queueing Systems