Developing On AWS Memo II
這篇紀錄Developing On AWS Memo II。
Day2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
| Schema on write(SQL) & scheme on read
NOSQL是為了解決SQL的問題 single node的天花板瓶頸
雲端的好處是水平擴展
Cloud-Native Design / Thinking
AWS Managed Service - Serverless solution
最終一致性 : 隨著時間過去 最終資料會有一致性
C (consistently) A(availability) P (Partition)三點無法同時取得
DynamoDB Strongly consistently versus eventually consistently
Low-latency queries - single digit ms response time. 1 record max limit 400K. Max limit 100MB.
Column - Row versus Item - Attributes
Partition key(only 1) and sort key ( 0 ~ 1 ) are primary key.
10 session / sec -> 1 read / sec -> 8KB / item
10 * 1 * 2 = 20 RCU to achieve strongly consistently
10 session / sec -> 1 read / sec -> 14KB / item
10 * 1 * 2 = 40 RCU to achieve strongly consistently
Eventually consistently is half strongly consistently. (20 RCU - 40 RCU)
GSI : Global secondary index Partition key 與 Sort key 可以不同 與 data不同Partition 有不同的RCU/WCU
LSI : Local secondary index 跟data放在相同的Partition 需在 create table前做
Burst capacity is 5 mins
適合當作Partition key 是識別唯一值 uuid , sequenceid
NoSQL Workbench : DynamoDB Amazon Keyspaces
Recommend : Object Persistence Interface
HASH is Partition Key
RANGE is Sort Key
DynamoDB’s based on item store on different partition.
Control plane - DDL
Data plane - DML
High cardinality - 變化性高
LSI : duplicate data for another table
Batch-write-item can prepare .json file max items is 25.
Get-item : if has sort key please add sort key to request.
Over 1 MB will pagination.
Parallel scan do mapreduce.
DAX 10的負6次方 ms , only support DML
Lambda max limits is 1000 runtime.
Event source -> invoke permission -> Function ->
Create layer
Max layers is 5.
Lambda max time limit is 15 mins.
How to avoid cold start to stop do shutdown.
Use kepalive to avoid cold start.
不要將Lambda當 EC2使用
Event : upstream
context : involvement
Lambda re deploy will reset variable to init.
Lambda source code limit is 250MB. ZIP limit is 50MB.
Fileb (b is byte)
Amazon ECR : dockerhub
Customer facing : API Gateway
HTTP : Simple HTTP
Support Swagger configuration
Support Canary releases 金絲雀部署
|