i have a design requirement where data from various sources need to be processed by multiple threads, but constraint being - the thread that processes the data from a given source should always continue to process the data from that source.
I used a SingleThreadExecutor that takes a Q and used a consistent hash type approach where the source's hash % 10 is mapped to a thread that processes the data.
Only concern here is hashing may not be uniform and some threads may be more loaded than others. Is there any better ways or achieving this? Has anyone tried a similar design problem? What are some of the suggestions that could be tried to get uniform spread of load of data across given set of Queues or threads?
Thanks in advance.