https://github.com/serkan-ozal/samba-aws-lambda-demo
AWS Lambda Demo for Samba (Statefull AWS Lambda)
https://github.com/serkan-ozal/samba-aws-lambda-demo
Last synced: 6 months ago
JSON representation
AWS Lambda Demo for Samba (Statefull AWS Lambda)
- Host: GitHub
- URL: https://github.com/serkan-ozal/samba-aws-lambda-demo
- Owner: serkan-ozal
- License: other
- Created: 2016-09-14T08:23:21.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-09-16T08:16:37.000Z (about 9 years ago)
- Last Synced: 2025-02-12T12:22:19.668Z (8 months ago)
- Language: Java
- Size: 10.7 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
1. What is this demo?
==============
AWS Lambda Demo for [Samba](https://github.com/serkan-ozal/samba) (Statefull AWS Lambda ) contains demo AWS Lambda applications by using **Samba** to access and share state.2. Demos
==============2.1. Database Access Handler
--------------
This handler is an AWS Lamda function that reuses database connections if they are available on the local through **Samba**.Creating database connection each time while accessing to database doesn't make sense because creating connection is not cheap operation and increases latency. By this behaviour, mostly database connections are reused according to background logic of AWS lambda under the hood as mentioned
[here](https://aws.amazon.com/blogs/compute/container-reuse-in-lambda/) and [here](https://www.linkedin.com/pulse/aws-lambda-container-lifetime-config-refresh-frederik-willaert).[See](https://github.com/serkan-ozal/samba-aws-lambda-demo/blob/master/src/main/java/tr/com/serkanozal/samba/demo/aws_lambda/db_connection/DatabaseAccessHandler.java) for the handler code.
2.2. Request Counter Handler
--------------
This handler is an AWS Lamda function that shares and processes a request counter atomically and globally through **Samba**.In this handler, a long typed field (request counter) is shared globally via `TIERED` cache backed **Samba** field. Each lambda function invocation can increase this shared field value atomically and can retrieve its value with **eventual consistency** guarantee (means that every field access might not return fresh value but it will returns fresh value eventually).
[See](https://github.com/serkan-ozal/samba-aws-lambda-demo/blob/master/src/main/java/tr/com/serkanozal/samba/demo/aws_lambda/request_counter/RequestCounterHandler.java) for the handler code.