How should teachers and high schools ration recommendations?

Have you ever had a situation of having more students ask for recommendations than you could reasonably handle doing a good job on? If so, how did you decide whom to write recommendations for (or how would you if too many students ask next year)?