i have some back end service that is in charge of sending notifications to my end users via mapping between some identifier to their real web sockets.
currently the service works in a sync way, meaning every loop iteration it checks if i got some new messages in my queue and if so i am polling the message from the queue and sending it to the relevant users based on their identifiers in a sync way(until the message is not sent the loop wont continue).
i came up with an idea to send these messages in async way. meaning that after polling a message from the queue i will delegate it to some thread pool to deal with it and send it when possible.
i have some concerns about this solution.
first, is there any scenario that messages will be received by the user out of order?.
second, will i see an improvement in the time the user will receive his messages? the sending involves I/O operations so i thought it will be a good idea to make it asyc.
are there any other concerns you think i should consider?