Module 14 - API gateway Flashcards

1
Q

What is an API gateway

A

Middleware, that manages access to microservices in an enterprise solution. Microservices are often in the form of REST APIs

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

What are the different issues that can be solved with API gateways

A
  1. Changing service locations
  2. Load balancing
  3. Security enforcement
  4. Monitoring
  5. Caching
  6. Versioning
  7. Service aggregation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Pros and cons of no gateway for the issue of changing service locations

A

Pro: Faster
Cons:
Whenever change, need all client to change
Require all clients to change their config files

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

Pros and cons of API gateway for the issue of changing service locations

A

Pro:
Indirect invocation of microservices
Whenever Microservices change, customers still call the same URL

Cons:
Developers need to change and maintain API gateway configs
Slower
Single point of failure

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

Pro cons for NO GATEWAY for LOAD BALANCING

A

Description:
Client choose a random URL to invoke
Whenever there is a change, all clients need to change
Developers can see which microservice they calling through the URL

Cons:
Use up a lot of port numbers
Not realistic for all clients to change

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

Pro cons for API GATEWAY for LOAD BALANCING

A

Description:
Client calls a single URL to the gateway, gateway reroutes. API gateway needs to know all the locations

Pros:
Indirect invocation of microservices
Whenever there is a change, clients do not need to change, just call the API gateway
No need to expose the service instances externally

Cons:
Need to maintain API gateway
Slower, due to more processing
Single point of failure

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

3 options for SECURITY OPTIONS

A

Option1: Check at the client
Only good against non technical users
If malicious, can modify to get what they want

Option 2: Check at each instance of microservice
Close to the things you want to protect. Can customise according to the needs, but a lot of duplicated code among all the microservices

Option 3: Check at API gateway
Decouple security checks from functional code in microservices
Centralised; no duplicated code
Don’t need to redeploy services if there is change in security configs

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

3 options for MONITORING

A

Option 1: Monitor at the client
Use the client’s devices to monitor, reduce load on servers
But users can modify code and be malicious

Option 2: Monitor at each instance of the microservices
Can customise to each microservice
but duplicated code, if change need to redeploy

Option 3: Monitor at API gateway
Decouples monitoring code from functional code
Dont affect each other

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

3 options for CACHING

A

Option 1: At client
Reduces the number of requests a client makes, reducing load on servers
But takes up space at client side, and is user specific

Option 2: At microservices
Reduce the number of times the microservice is actually run
Doesn’t reduce the number of requests sent from clients, a lot of duplicated code, and need to redeploy if got changes

Option 3: at API gateway
Decouples from functional code, changes do not need to redeploy
All clients benefit from centralised cache

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

2 options for VERSIONING

A

Option 1: Two versions running in parallel
Clear separation of versions
Need to duplicate all functions
Once removed old version, client may experience downtime

Option 2: Merging 2 versions via API gateway
Reroutes the client request according to version number specified. If remove, just reroute to the next one, less downtime
Troublesome to configure all settings in api gateway

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

2 options for SERVICE AGGREGATION

A

Option 1: separate invocation of multiple microservices in client
More flexible
Need more API calls, 1 request 1 call

Option 2: Aggregated invocation of multiple services
Client only send 1 request to API gateway and it makes multiple calls to the individual microservices
Not as flexible and is difficult to define combination rules within API gateway

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