@@ -18,21 +18,33 @@ Following are optimization katas you should be aware of while building a serverl
18
18
applications
19
19
20
20
* 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
24
29
* 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.
28
37
* 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?
32
44
* 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
36
48
37
49
## Intent
38
50
@@ -84,7 +96,8 @@ database service also provided by Amazon.
84
96
85
97
## AWS lambda function implementation
86
98
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
88
101
.RequestHandler` to implement our lambda function.
89
102
90
103
``` java
@@ -123,9 +136,9 @@ dependencies of the function.
123
136
124
137
Based on the configuration in ` serverless.yml ` serverless framework creates following
125
138
resources
126
- * cloud formation stack for S3 (ServerlessDeploymentBucket)
139
+ * CloudFormation stack for S3 (ServerlessDeploymentBucket)
127
140
* IAM Role (IamRoleLambdaExecution)
128
- * cloud watch (log groups)
141
+ * CloudWatch (log groups)
129
142
* API Gateway (ApiGatewayRestApi)
130
143
* Lambda function
131
144
* DynamoDB collection
0 commit comments