Subj : threaded application scalability question To : comp.programming.threads From : Luke Ehresman Date : Wed Feb 16 2005 08:05 am This is related to a question I posted earlier today regarding a threaded application I am writing, but thought this would be best suited for a different thread. I am writing an application that accepts socket connections and also maintains a session for a user across multiple connections. I would like to be able to do processing on that session when the user is not connected. Currently I have a pool of threads to handle connections, and they attach to global sessions. The locking required to maintain the sessions is quite complex (because I also have other threads manipulating the session data). My question: Would it be reasonable to create a thread when a new session is created (i.e. a new user logs in), and have that thread stay active as long as the user is logged in. This thread would have a session in its local context, and would do processing on that session when the user isn't connected. There would be no global session structures. When the user reconnects, he would get attached to the existing thread for that session, and that thread would handle his connection again. Would this be a scalable solution? In my application, I could potentially have hundreds of users logged into the system at one time. What are the implications of having hundreds of threads active? I would probably still have a pool of threads already created, but rather than handling individual connections, they would handle sessions (i.e. they would be occupied and not in the pool for as long as the user is logged into the system, not just when they're connected to the server). Thanks, Luke .