Delay Analysis and Buffer Optimization