Wk 3 Storage Flashcards

(47 cards)

1
Q

Microservice bus function:

A

Connects microservices together with an open pluggable framework.

Instead of all services having a different protocol you have a common protocol “Bus”.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Microservice bus Characteristics :

A

It has a single:
- communication protocol
- Data format
- Interface convention

Ex:
Http
Json
Rest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Http:

A

Synchronous protocol.
Client sends a request and then blocks the channel until it receives a response form the server.

It is well understood, widely implemented and trusted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Http request sections:

A
  • Request Line
  • Headers
  • Body ( optional)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Rest

A

Representational state transfer. ( Way to standardize APIs)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are a the resources provided by microservices:

A

Resources are formed by combining smaller resources.

Not all resources fit together.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Resources archetypes:

A
  • Documents
  • Collection
  • Store
  • Controller
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Documents:

A

Describe operations on files like resources.

Ex GET PUT DELETE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Collection:

A

Operations on directory like resources.

The server chooses the name of the resources.

Ex
Get reads directory
Post create new resource in the directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Store:

A

Collection of objects.

Each item in the store is named differently.

Operations are directory like but the user decides the object name.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Controller:

A

Describes impossibile operations on external resources.

Posts causes the external resource to carry out some task and returns any result.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Google remote procedure call

A

Services connected through grpc are defined using protocol buffers (type safety) and binary data ( for efficient transfer)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How does grpc work:

A

You agree between two services a binary format that you are going to exchange there after you use your binary encoding.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Benefit or grpc

A

7 times faster than REST when recieving data and 10 times faster when sending.

( No need to change the data to JSON)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

An enterprise computer system may store data using:

A
  • centralised database
  • distributed database
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Centralised database / monolith database andvantages:

A
  • easier
  • ensures accuracy
  • consistency of data is maintained
  • completeness
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Disadvantages of centralised databases:

A

Everything is coupled so you need an agreement from all departments to effect a change.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Centralised database transactions:

A
  • Commit ( completes successfully) database is moved to a new consistent state

-Aborts ( completes unsuccessfully) the database is restored to a previous consistent state

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

ACID properties of a transaction:

A
  • Atomicity
  • Consistency
  • Isolation
  • Durability
20
Q

Atomicity

A

Something either happens or it donts

21
Q

Consistency

A

No transaction is half done

22
Q

Isolation

A

One transaction can’t see the actions of another, doesn’t matter the order

23
Q

Durability

A

If a transaction happens, it succeeds even if the system fails ( need to check this is correct)

24
Q

Distributed database

A

Consists of a series of databases each assigned to a series of individual microservice.

25
Disadvantages of distributed databases:
Difficult to ensure accuracy, completeness and consistency.
26
Advantages distributed systems:
A database for each service enables independence in development.
27
Distributed transactions:
- Two phase commit - sagas
28
Two phase commit:
A transaction coordinator asks a number of participant transactions to vote whether they are prepared to commit a change. Each participant holds locks on its data involved in the transaction until the coordinator decides to commit or abort.
29
Issues with two phase commits:
- centralised coordinator - while everyone is voting all databases are locked waiting for the coordinator to decide
30
Sagas
A coordinator transaction asks each participant to commit or abort a sequence. The data involved in the transaction is locked only until it decides to commit or abort. If all participants commit then everything is good otherwise the sequence ends and a compensating transaction is made to undo the work of those that have committed.
31
Sagas what do they sacrifice?
Atomicity and rely on consistency
32
Brewers convention:
You can't have availability, consistency and partition tollerance all the the same time.
33
CAP theorem
There are 3 fundamental guarantees
34
Availability
Response is received from every node ( Always access)
35
Consistency
The same response is received from every node
36
Partition Tollerance
The system works even if it becomes disconnected
37
CP example
Banks even if there is a network failure they stay consistent
38
CA
Unable to tollerate a system failure, you cant have a network ( ex. mainframe )
39
How to decompose a database ?
- database then code - code then database - code and database
40
Database then code decomposition:
Split the database first then split the code. No short term benefit Cost atomisation
41
Code then database
Split the code first as it's easier to revoke. Short term benefits Confidence to complete the decomposition
42
Code and database
Split the code and database as the same time No benefits, more work all at once
43
Ap
Drops consistency sometimes.
44
Why would a cloud provider be dissatisfied with the use of JSON communication for documents
- overhead JSON imposes on binary data - additional overhead processing -additional storage overhead From encoding and decoding binary using base64. Provider use a custom binary format such as gRPC avoids processing and storing overheads , sacrifice flexibility
45
Problems of using a centralised database for microservices:
The database is distributed across many services: - duplication : multiple copies of data - consistency : copies up to date - security : must have controls everywhere - transaction management : must have ACID properties
46
Ap for microservices:
- partition tolerant( available even if there is a network partition) - may have some inconsistency issues
47
Improve communication between microservices :
- standard protocol REST small set of common operations - http : handles client server networking - standard data format XML JSON easily processed and extended - Remote procedure call grpc automatically generates networking code