Optimal queue-size scaling in switched networks