Module 2b - Services & Microservices Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a service?

A

A service is a self-contained and reusable component that performs a specific task.

Ex: return price of a stock, append a message to a blog

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

What is encapsulation with respect to services?

A

A service is encapsulated if it exposes an interface and hides its implementation

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

What are Web Services?

A

Services that use web protocols (ex HTTP) for transport

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

How are services accessed? As in how do they facilitate communication between other services?

A

Through communication protocols that may be layered on top of other protocols for transport

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

What is a service-oriented architecture? (SOA)

A

An architecture where functionality is separated into a collection of services that can can be developed, deployed, and maintained independently

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

Service-Oriented Architectures include middleware infrastructure. Why?

A

To facilitate integration of services

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

What strategy do microservice-based architectures follow that service-oriented-architectures do not?

A

Microservice Architectures take the divide-and-conquer strategy of service-oriented-architectures and make it more loosely coupled and distributed

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

Do Microservices rely on a common communication mechanism? Do they share data?

What benefits & drawbacks does this provide?

A

They don’t rely on a single method of communication, and they do not share data.

This improves fault tolerance but complicates coordination among components

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

Are microservices are typically divided into small computing units. What is the benefit of this?

A

They become easy to develop, deploy, and maintain independently than larger components.

This also helps scalability

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

What is SOAP?

A

Simple Object Access Protocol

Can only make HTTP POST requests

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

What other protocol is SOAP layered on top of?

What does SOAP use for its message format?

A

SOAP is layered on top of HTTP

SOAP uses XML as its message format

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

What is REST?

A

Representational State Transfer

A stateless model for interacting with HTTP

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

What is the motivation behind using REST over SOAP

A

Simple Web services can be constructed by using HTTP protocol directly instead of layering another protocol on top of it (SOAP does that). SOAP only can make POST requests

REST is lighter weight than SOAP

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

Does REST avoid layering another protocol on top of HTTP?

A

REST directly provides access to remote resources using HTTP methods such as GET, PUT, POST

REST is a model of interaction rather than a protocol

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

What differentiates REST from SOAP?

A
  • REST is not a protocol (SOAP is)
  • SOAP can only make POST requests, REST can make all HTTP requests
  • REST is stateless
  • REST defines the format of messages (SOAP is only XML)
  • REST can cache responses to GET requests, SOAP cannot
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How does caching work in REST vs SOAP?

A

REST can make HTTP GET requests. When such a response is returned, it can be cached using existing HTTP mechanisms.

SOAP transports requests using non-idempotent HTTP POST messages - SOAP can only make POST requests

17
Q

What are microservices?

A

Fine-grained, loosely-couples services which are isolatable and function independently of other microservices

18
Q

What 4 architectural styles do Service-Oriented-Architectures combine?

A
  • Layered Architecture
  • Object based Architecture
  • Data centred Architecture
  • Event based Architecture
19
Q

What are RESTful Architectures?

A

REST-based Web services. They are based on resource sharing

20
Q

What are the 4 key characteristics of RESTful architectures?

A
  1. Resources are identified through a single naming scheme, namely URI (Universal Resource Identifiers)
  2. All services offer the same interface, consisting of at most four operations (PUT, GET, DELETE, POST)
  3. Messages sent to or from a service are fully self-described
  4. After executing an operation at a service, that component forgets everything about the caller (stateless execution)
21
Q

What does stateless execution in REST mean?

A

HTTP is stateless meaning it does not explicitly keep track of users and sessions.

22
Q

What are Cookies and why do Applications use them?

A

Cookies are a form of persistent storage kept in the client for a resource request. They use cookies to maintain information about a REST API call and manage the state of the interaction

23
Q

Suppose a RESTful service calls an API to get an image from a gallery microservice. If the metadata returned is purely the image, would the API be able to retrieve the “next” image in the gallery?

A

It cannot. The REST API call does not maintain state or any additional metadata about the resource.

24
Q

What is JSON? whats is the use case with REST?

A

Java Script Object Notation.

Used in RESTful services to encode the API metadata

25
Q

What makes JSON scalable and more useful than XML?

A

JSON is compact and easy to parse (easier than XML). It also predefines all the datatypes that it encodes (number, string, boolean, array, object, null)

26
Q

How is JSON structured?

A

A collection of key-value pairs, keys must be strings. Values are any of: number, string, boolean, array, object or null