Skip to content

Commit 3f9a5a2

Browse files
code review comments
1 parent 05a9c03 commit 3f9a5a2

File tree

6 files changed

+33
-18
lines changed

6 files changed

+33
-18
lines changed

serverless/README.md

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,33 @@ Following are optimization katas you should be aware of while building a serverl
1818
applications
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

124137
Based on the configuration in `serverless.yml` serverless framework creates following
125138
resources
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

serverless/src/main/java/com/iluwatar/serverless/baas/model/Address.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import java.io.Serializable;
77

88
/**
9-
* Address Object
9+
* Address class
1010
* Created by dheeraj.mummarareddy on 3/4/18.
1111
*/
1212
@DynamoDBDocument

serverless/src/main/java/com/iluwatar/serverless/baas/model/Person.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import java.io.Serializable;
1010

1111
/**
12-
* Person Request
12+
* Person class
1313
* Created by dheeraj.mummarareddy on 3/4/18.
1414
*/
1515
@DynamoDBTable(tableName = "persons")

serverless/src/test/java/com/illuwatar/serverless/baas/api/FindPersonApiHandlerTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static org.mockito.Mockito.verify;
2020

2121
/**
22+
* Unit tests for FindPersonApiHandler
2223
* Created by dheeraj.mummar on 3/5/18.
2324
*/
2425
@RunWith(MockitoJUnitRunner.class)

serverless/src/test/java/com/illuwatar/serverless/baas/api/SavePersonApiHandlerTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static org.mockito.Mockito.*;
2020

2121
/**
22+
* Unit tests for SavePersonApiHandler
2223
* Created by dheeraj.mummar on 3/4/18.
2324
*/
2425
@RunWith(MockitoJUnitRunner.class)

serverless/src/test/java/com/iluwatar/serverless/faas/api/LambdaInfoApiHandlerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
import static org.mockito.Mockito.when;
3434

3535
/**
36-
* LambdaInfoApiHandlerTest
36+
* Unit tests for LambdaInfoApiHandler
3737
*/
3838
@RunWith(MockitoJUnitRunner.class)
3939
public class LambdaInfoApiHandlerTest {

0 commit comments

Comments
 (0)