title: Erlang: Session management and timeout
body: <p>I'm writing http session manager (gen_server based). That server creates and removes session from in-memory storage. I need to remove expired session on timeout. I have two solutions:</p>
  
  <ol>
  <li>Create one timer to remove expired sessions from manager</li>
  <li>Create timer for each session</li>
  </ol>
  
  <p>First solution locks server while all sessions are not processed (lock issue). Second solution takes process for each session (memory issue).</p>
  
  <p>Question is which solution is right?</p>
  
  <p>Thank you!</p>