if indeed your bottleneck is the table holding the messages (i.e. get/delete queue gets long) then you could split up the table so that each client has it's own table. this also avoids having to store client id and check for it in every message. This will definitely relieve contention issues + improves security of data. also, check on your message lengths that they don't exceed max mysql packet length and modify accordingly, and even zip the data en-route if cpu load is low.