Cosmos DB - amitbhilagude/userfullinks GitHub Wiki
1. NoSQL(Not only SQL)
a. Alternative for large data, which can grow in distributed way
b. Alternative to Relational database without building schema
2. Cosmos DB
a. Evaluation of Document DB
b. Auto storage increases and same performance(theoughput)everytime irespective data increases
c. Globally disrubuted
d. Supported API and Model
i. Sql API
1) JSON documents
2) Sql Query
ii. Mongo DB
1) BSON document
2) Mongo DB queries
iii. Table API
1) Key Value pair
2) Azure table storage
iv. Gremline API
1) Graph
2) Vertical ages
v. Cassandra
1) Columner
2) Schema
e. Container
f. Partitions
g. Throughput
h. Auto indexing
3. Cosmos DB account
a. Configuration options
i. Need to have account name globally unique
ii. API types
1) SQL(core)
2) MongoDB
iii. Geo distributed
iv. Geo distributed write
4. Emulator
5. Throughput
a. Charge on RU(Request Unit). It is not no of request
b. Through put Cost
i. Size of item 1 kb
ii. Reads per Second 500
iii. Write per second 100
iv. Cost: 1*500 + 5*100 =1000 RU per second
c. Total cost
i. DB size per 1GB
ii. Throughput cost
d. Pricing calculator
6. Horizontal Partition
a. Scale out work based on partition
b. Important to user correct partition Key to increase scale out and to have query to single partitions.
c. Recommended to have only one container however if there is only one partition will grow more, better to have separate containers and partition
d. All SQL API, queries to specific partition. Need to design partitions accordingly.
e. Max concurrently-1
f. Best practices for partition key
i. Unique id
ii. Use custom property in each document
7. Globally Distributed
a. Write approach for concurrently update same item
i. Last write win
ii. Custom store procedures to decide
b. Data duplication globally
i. Consistency level(upto 5)
1) Strong: need to wait untill it updates globally
2) Session (Defaults) Always get update to same user
3) Weak
8. Data Modelling
a. Design model which will get data in single query
b. Design model which will less number of documents however less size
9. Change Feed Feature
a. Duplicate data when any change is occurred
10. Data Migration tool
a. Open source tool
b. Supports multiple database
11. Special document properties
a. rID
b. attachment
c. Etag
d. ts
e. Self
f. Ttl: Document expiry(disabled by default
12. .Net SDK
a. Check samples
b. Stateful and Stateless paging
13. Server side script
a. Store procedures
i. Bulk update
b. Trigger
i. Types
1) Pre trigger
2) Post trigger
ii. Good for validation
iii. Doesn't trigger automatically
User defined Function (UDF)