title: How AWS Lambda container reuse works?
body: <p>I have already gone through <a href="https://aws.amazon.com/blogs/compute/container-reuse-in-lambda/" rel="noreferrer">this</a> link , (It was published in Dec-2014),Also referred <a href="https://forums.aws.amazon.com/thread.jspa?messageID=682909" rel="noreferrer">this</a> and <a href="https://forums.aws.amazon.com/thread.jspa?messageID=693390&amp;tstart=0" rel="noreferrer">this</a></p>
  
  <p>How the AWS Lambda container reuse works as on May-2016, May you please share any specific link which tells in details ? Below I have few questions all around this AWS Lambda container reuse.</p>
  
  <p><strong>Consider a use case</strong> :</p>
  
  <p>A Lambda function name "processMessageLambda" receives request when it has to process a message, and that message it receives from the POST REST API( from AWS API Gateway, as this lambda function connected with).</p>
  
  <p>Now this 'processMessageLambda' process the message and store it to database. </p>
  
  <p>So logically  it does the following : 
    connect to database, store the message and shutdown the connection. (It works fine in normal case.).</p>
  
  <p>If requests arrive say - 10 per second , and each lambda function takes 30 seconds to execute then it actually opens many database connections.</p>
  
  <p><strong>Q1:</strong> May we use 'connection pooling' on this case(e.g. boneCP) ? as numbers of calls to "processMessageLambda" would be like hundred per second or Ten per second ?</p>
  
  <p>(refer :<a href="https://stackoverflow.com/questions/37415469/how-we-can-use-jdbc-connection-pooling-with-aws-lambda">simple example of container reuse</a> - It works as it says, but what will happen many request would arrive say - 10 request per seconds )</p>
  
  <p><strong>Q-2:</strong> If its possible to use the connection pooling, then how this aws lambda container would be reUsed ?</p>
  
  <p>If consider a case : </p>
  
  <p>Lets consider that requests received by this Lambda function are Ten per second, on this case - 10 different container of this lambda function would be created or single container of lambda function would be created and that would be used with all these 10 requests ?</p>
  
  <p><strong>Q-3:</strong> If 10 different container of lambda function would be created then that means 10 database connections would be used , so those 10 container would be reUsed on further requests ?</p>
  
  <p><strong>Q-4:</strong> May you please explain from a developer point of view, that how it actually aws lambda container reuse works or how a developer think about it while reusing the aws lambda container ?</p>
  
  <p><strong>Q-5:</strong> If container reuse already in place,How a developer need to maintain the state of variables so a developer know which variable would be reused ?</p>