ESB's and Gateways (Async / sync) Flashcards

1
Q

What is an ESB?

A

Service/object which handles the business logic on top of services in SOA and ties them together.

Think: a router which routes the messages and monitors that there is no errors and maintains the order that things needs to happen - often synchronously.

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

What is synchronous programming?

A

When events are dependent/connected with each other.

Example: order food, wait for food, eat. You can’t start the next action.

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

How does synchronous programming work in a program?

A

Components, events, tasks and activities are chained. They are dependent on the other finishing before starting. Only one execution at a time.

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

How many threads does synchronous programming happen on?

A

One or multiple.

As long as Thread B waits for Thread A to finish before starting.

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

Why do you think about SOA when you think synchronous programming?

A

Because the ESB sometimes have to wait for one service in order to be ready to call the next one.

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

When is synchronous programming used?

A

In sensitive systems where the data needs to be precise and received in exact order.

When debugging. It’s better to see things step by step.

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

Pros with synchronous programming?

A

No need to implement response routing. A call automatically happens after the previous is done.

No need to correlate a response to a request. Its implicit.

It is safer.

Easy to follow and debug / test.

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

Cons with synchronous programming?

A

Prone to network errors and exceptions.

Failure is permanent, you need to send the request again, no automatic retry options.

You can’t send to multiple receivers.

Senders application is blocked until response.

The sender and receiver needs to be online at the same time.

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

What is asynchronous programming?

A

Parallel execution on tasks.

Mainly when tasks is ran separately from the main program. So for example the main program can still be used. (scrolling on an application).

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

When is asynchronous programming used?

A

When programs need to perform multiple operations at the same time.

For example: input/output operations. file- database- network I/O

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

What is the extra requirements with asynchronous programming?

A

It requires handling, usage of async/await - then/catch. To ensure that the response is ready before trying to send it.

So await sending the response until it has gotten the data from the database.

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

How does asynchronous programming work?

A

Components, events, tasks are ran independently. Then each component notifies the main thread when done.

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

What are the pros of asynchronous programming?

A

Real time.

Loose coupling of applications

Multiple receivers are possible.

Sender and receiver does not need to be online at the same time.

Increase in throughput (not performance).
- Throughput is the amount of service a program can do.

No timeouts. The call is done when it’s done.

Sender can send more messages while other tasks execute.

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

Cons with asynchronous programming?

A

It adds complexity to your program.

No immediate response from a call - you have to wait for the task to complete before using the response.

Sender needs to account for responses and requests on its own. (frameworks do it for you).

Harder to debug.

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

A comparison with ASYNC / SYNC

A
In sync...
Data is sent In blocks / frames.
Uses more time to finish a task.
All resources needs to be available.
Used in SOA - ESB

in async…
data is sent in bytes
can save time because more action can happen simultaneously.
Used in cloud

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

What is a Gateway and what is its primary job?

A

Software that is in ‘front’ of API’s as a single point of entry for a group of microservices.

Job: is to handle protocol translation and route calls to the right services. It is kind of like an ESB but also not.

17
Q

What are some features of the Gateway?

A

Authentication

Security policy enforcement1

Load balancing

Cache management

Dependency resolution

Interface, contracts and service oriented agreement
- (SLA) management - Who calls what

18
Q

What are some pros with Gateways?

A

More security (extra layer before Microservices)

Can combine different communication protocols

Can be used to mock services (stubs) when creating integration tests.

Load balancing and orchestration

Decreases complexity by organising dependencies and calls.

19
Q

What are some cons with Gateways?

A

It’s a single point of failure. Bottleneck also.

Might add complexity to the microservices. depends on size.

Needs to be updated when a new microservice is added.

Potential vendor lock.

If two microservices receive 1000 requests. The gateway needs to receive 2000. (Bottleneck).

20
Q

Why would you use Gateways?

A

To allow for many results to be built by many microservices and sent back to the client in one response.

The gateway can handle load balancing

It is easier for teams to program up against a gateway endpoint.

The gateway can do load balancing.

It is easy to update out microservices.

More secure as it adds another layer.

21
Q

Compare an ESB and a Gateway

A

They both route requests and keep track of a sequence. The ESB will add some extra business logic though.