public class MailSystem implements SelfTunable { private static final Integer MAX_NUM_OF_WORKERS = 1000; private static final Integer INITIAL_NUM_OF_WORKERS = 10; private Integer NUM_OF_WORKERS = INITIAL_NUM_OF_WORKERS; public Boolean send(String message){ // as you have more than 1k messages to sends add 2 more workers // if you have less than 1k messages reduce 2 workers // initial number of workers is 10; If you keep adding workers stop when you have 1k workers // this system is similar to AutoScaling group concepts. Most of times you dont need do this inernaly thats to ASGs :D } }