I'm playing on a SMP server and would like to begin a villager trading industry. I've looked at lots of designs for villager breeders that can be started easily (no nearby villages, so I'll have to cure zombies) but have been unable to find one that shuts off after a certain threshold of villagers is reached. If possible, I would like it to be fully automatic, but minimal interaction is ok. Basically, the goal is to have a "pool" of villagers that I can draw from at any time, ensuring that when I go through many in short succession I don't have to wait for breeding. To prevent excessive lag, this "pool" should be kept fairly small (20-40) at all times.
My planned solution to this problem, when I get back to working on my villager trading system, is to have a core breeding area, that infinitely breeds.
Then, have a system that allows villagers to "escape" once the population is large.
Then, collect the "escaped" villagers, and once enough have escaped, kill the rest.
So villagers will always breed, but also, will always be killed if you AFK for long enough.
I'm having trouble finding a video that explains what I'm going to do, but in looking for one, I found DOCM's villager trading video, and in it, he explains how to set up your trading system such that you don't need infinite villagers, which may be a viable alternative to what you're wanting to do.
To do this, you need to "fill" all the villager's trading slots. You want to get the "good" trades to be the last slot for a filled villager trading slots. (paper -> emeralds (librarian), raw chickens -> emeralds (farmer), iron -> emeralds (blacksmith)) are all "easy" to get unlimited quantities of. Then, once these trades are in the last slot of the villager, you can keep trading the villager for those trades, and get unlimited emeralds, without having to generate unlimited villagers.