I need to send messages (the actual technology is irrelevant at this stage) while complying with a number of throttling constraints. Basically I have contraints that are related to the sender and to the destination, in terms of messages per second. I don't mind in enforcing the throttling while accepting the messages from the sender, while I do need to throttle them when sending out. I was thinking about priority queues, but maybe there开发者_StackOverflow中文版's a better advice.
Anyway, the application is multithreaded, written in C and running under Linux, if this matters.
Take a look at this question and the answers mentioned there:
Throttling method calls to M requests in N seconds
精彩评论