diff --git a/doc_source/best-practices.md b/doc_source/best-practices.md index 0f4166ef..43b9d96f 100644 --- a/doc_source/best-practices.md +++ b/doc_source/best-practices.md @@ -17,13 +17,13 @@ The following are recommended best practices for using AWS Lambda: exports.myHandler = function(event, context, callback) { var foo = event.foo; var bar = event.bar; - var result = MyLambdaFunction (foo, bar); + var result = myCoreLogic(foo, bar); callback(null, result); } - function MyLambdaFunction (foo, bar) { - // MyLambdaFunction logic here + function myCoreLogic(foo, bar) { + // core logic here } ``` + **Take advantage of Execution Context reuse to improve the performance of your function\. ** Make sure any externalized configuration or dependencies that your code retrieves are stored and referenced locally after initial execution\. Limit the re\-initialization of variables/objects on every invocation\. Instead use static initialization/constructor, global/static variables and singletons\. Keep alive and reuse connections \(HTTP, database, etc\.\) that were established during a previous invocation\. @@ -71,4 +71,4 @@ When there are not enough records to process, instead of waiting, the stream pro + **Lambda creates elastic network interfaces [\(ENIs\)](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_ElasticNetworkInterfaces.html)** in your VPC to access your internal resources\. Before requesting a concurrency increase, ensure you have enough ENI capacity \(the formula for this can be found here: [Configuring a Lambda Function to Access Resources in an Amazon VPC](vpc.md)\) and IP address space\. If you do not have enough ENI capacity, you will need to request an increase\. If you do not have enough IP address space, you may need to create a larger subnet\. + **Create dedicated Lambda subnets in your VPC: ** + This will make it easier to apply a custom route table for NAT Gateway traffic without changing your other private/public subnets\. For more information, see [Configuring a Lambda Function to Access Resources in an Amazon VPC](vpc.md) - + This also allows you to dedicate an address space to Lambda without sharing it with other resources\. \ No newline at end of file + + This also allows you to dedicate an address space to Lambda without sharing it with other resources\.