I have implemented some simple messaging system IMS
for my own use inside the application, that allows sending and recieving message for objects.
I have a singleton object IMSContext
that has a method transfer
which is used to pass messages by every object
IMSContext.instance.transfer(message)
Also that IMSContext
stores all IMS
objects.
As I use sole method to transfer message, I want to imitate some kind of load balancing
- assuming that this sole method is a bottleneck - when there are too much messages are being transferred I want to use some kind of mechanism that would move the flow of messages to another method...or maybe even object.
But I have no idea how to do it. Could recommend something or help with the approach?