We consider a controlled double-ended queue consisting of two classes of customers, labeled sellers and buyers. The sellers and buyers arrive in a trading market according to two independent renewal processes. Whenever there is a seller and buyer pair, they are matched and leave the system instantaneously. The matching follows firstcome-first-match service discipline. Those customers who cannot be matched immediately need to wait in the designated queue, and they are assumed to be impatient with generally distributed patience times. The control problem is concerned with the tradeoff between blocking and abandonment, and its objective is to choose optimal queue-capacities (buffer lengths) for sellers and buyers to minimize an infinite horizon discounted linear cost functional which consists of holding costs, and penalty costs for blocking and abandonment.When the arrival intensities of both customer classes tend to infinity in concert, we use a heavy traffic approximation to formulate an approximate diffusion control problem (DCP), and derive an optimal threshold policy for the DCP. Finally, we employ the DCP solution to establish an easy-to-implement, simple asymptotically optimal threshold policy for the original queueing control problem.