@@ -18,21 +18,33 @@ Following are optimization katas you should be aware of while building a serverl
1818applications
1919
2020* The Lean function
21- * Concise logic
22- * Efficient/single purpose code
23- * ephemeral environment
21+ * Concise logic - Use functions to transform, not transport (utilize some of the
22+ integration available from the provider to transport), and make sure you read only
23+ what you need
24+ * Efficient/single purpose code - avoid conditional/routing logic and break down
25+ into individual functions, avoid "fat"/monolithic functions and control the
26+ dependencies in the function deployment package to reduce the load time for your
27+ function
28+ * ephemeral environment - Utilize container start for expensive initializations
2429* Eventful Invocations
25- * Succinct payloads
26- * resilient routing
27- * concurrent execution
30+ * Succinct payloads - Scrutinize the event as much as possible, and watch for
31+ payload constraints (async - 128K)
32+ * resilient routing - Understand retry policies and leverage dead letter queues
33+ (SQS or SNS for replays) and remember retries count as invocations
34+ * concurrent execution - lambda thinks of it's scale in terms of concurrency and
35+ its not request based/duration based. Lambda will spin up the number of instances
36+ based on the request.
2837* Coordinated calls
29- * Decoupled via APIs
30- * scale-matched downstream
31- * secured
38+ * Decoupled via APIs - best practice to setup your application is to have API's as
39+ contracts that ensures separation of concerns
40+ * scale-matched downstream - make sure when Lambda is calling downstream
41+ components, you are matching scale configuration to it (by specifying max
42+ concurrency based on downstream services)
43+ * secured - Always ask a question, do I need a VPC?
3244* Serviceful operations
33- * Automated operations
34- * monitored applications
35- * Innovation mindset
45+ * Automated - use automated tools to manage and maintain the stack
46+ * monitored applications - use monitoring services to get holistic view of your
47+ serverless applications
3648
3749## Intent
3850
@@ -84,7 +96,8 @@ database service also provided by Amazon.
8496
8597## AWS lambda function implementation
8698
87- AWS lambda SDK provides pre-defined interface `com.amazonaws.services.lambda.runtime
99+ [ https://aws.amazon.com/sdk-for-java/ ] (AWS Lambda SDK) provides pre-defined interface
100+ `com.amazonaws.services.lambda.runtime
88101.RequestHandler` to implement our lambda function.
89102
90103``` java
@@ -123,9 +136,9 @@ dependencies of the function.
123136
124137Based on the configuration in ` serverless.yml ` serverless framework creates following
125138resources
126- * cloud formation stack for S3 (ServerlessDeploymentBucket)
139+ * CloudFormation stack for S3 (ServerlessDeploymentBucket)
127140* IAM Role (IamRoleLambdaExecution)
128- * cloud watch (log groups)
141+ * CloudWatch (log groups)
129142* API Gateway (ApiGatewayRestApi)
130143* Lambda function
131144* DynamoDB collection
0 commit comments