Performance implications of Synchronous Sockets vs Asynchronous Sockets
- by Akash Kava
We are trying to build an SMTP Server to receive mail notifications from various clients over internet. As each of the communication will be longer and it needs to log everything, doing this Asynchronous way is little challenging as well as by using Socket's Asynchronous methods we are not sure of how flow of control and error handling happens.
Previously we wrote lot of server/client apps but we always used Synchronous sockets, reason being they are longer sessions and each session also has lot of local data to manage and parsing messages etc.
Does anyone have any experience over real performance differences between these two methods? Async calls use ThreadPool which we have experienced many times to just die for no reason. And we fail to restart threadpool etc.
In one way Request-Response protocol of HTTP, Async Sockets makes sense, but SMTP/IMAP etc protocols are longer and they have interleaved messages plus state machine of server. So Async methods are really complicated to program.
However if anyone can share the performance of Sockets, it will be helpful.