Wk 3 Storage Flashcards

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
Q

Disadvantages of distributed databases:

A

Difficult to ensure accuracy, completeness and consistency.

26
Q

Advantages distributed systems:

A

A database for each service enables independence in development.

27
Q

Distributed transactions:

A
  • Two phase commit
  • sagas
28
Q

Two phase commit:

A

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
Q

Issues with two phase commits:

A
  • centralised coordinator
  • while everyone is voting all databases are locked waiting for the coordinator to decide
30
Q

Sagas

A

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
Q

Sagas what do they sacrifice?

A

Atomicity and rely on consistency

32
Q

Brewers convention:

A

You can’t have availability, consistency and partition tollerance all the the same time.

33
Q

CAP theorem

A

There are 3 fundamental guarantees

34
Q

Availability

A

Response is received from every node
( Always access)

35
Q

Consistency

A

The same response is received from every node

36
Q

Partition Tollerance

A

The system works even if it becomes disconnected

37
Q

CP example

A

Banks even if there is a network failure they stay consistent

38
Q

CA

A

Unable to tollerate a system failure, you cant have a network ( ex. mainframe )

39
Q

How to decompose a database ?

A
  • database then code
  • code then database
  • code and database
40
Q

Database then code decomposition:

A

Split the database first then split the code.

No short term benefit
Cost atomisation

41
Q

Code then database

A

Split the code first as it’s easier to revoke.

Short term benefits
Confidence to complete the decomposition

42
Q

Code and database

A

Split the code and database as the same time

No benefits, more work all at once

43
Q

Ap

A

Drops consistency sometimes.

44
Q

Why would a cloud provider be dissatisfied with the use of JSON communication for documents

A
  • 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
Q

Problems of using a centralised database for microservices:

A

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
Q

Ap for microservices:

A
  • partition tolerant( available even if there is a network partition)
  • may have some inconsistency issues
47
Q

Improve communication between microservices :

A
  • 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