I'm designing a Python SSL server that needs to be able to handle up to a few thousand connections per minute. If a client doesn't send any data in a given period of time, the server should close their connection in order to free up resources.
Since I need to check if each connection has expired, would it be more efficient to make the sockets non-blocking and check all the sockets for data in a loop while simultaneously checking if they've timed out, or would it be better to use select() to get sockets that have data and maintain some kind of priority queue ordered by the time data was received on a socket to handle connection timeout?
Alternatively, is there a better method of doing this I haven't thought of, or are there existing libraries I could use that have the features I need?