Scalability and High Availability Flashcards

1
Q

What is scalability?

A

The ability of an app to handle and withstand the increased load without sacrificing the latency.
For instance, if your app takes x seconds to respond to a user request. It should take the same x seconds to respond to each of the million concurrent user requests on your app.
The backend infrastructure of the app should not crumble under a load of a million concurrent requests.

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

What is the latency?

A

The time taken to process the request & respond

No matter how much the traffic load on a system builds up, the latency should not go up

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

Two Types of latency

A
  1. Network Latency(The time taken to send the packet from point A to point B. )- To cut down N/W latency, Businesses use CDN(Content Delivery Network) and try to deploy their servers across the globe as close to the end-user.
  2. Application Latency: The time taken to process the user request
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to reduce application latency?

A

Run Stress and Load test on application and scan for bottlenecks

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

What is vertical Scaling?

A

Adding more power to the existing resources.
The first step towards scaling up when the traffic increases.
Doesn’t require code refactoring or any complex configurations at a code level.
There is a limit for vertical scaling.

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

What is horizontal Scaling?

A

Adding more hardware to the existing pool of hardware resource pool.
No limit to horizontally scaling

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

What is cloud elasticity?

A

If the site has a heavy traffic influx more server nodes get added & when it doesn’t the dynamically added nodes are removed.

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

What are the points to consider when running code in a distributed environment?

A

The code needs to be stateless. No Static instance in the class.

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

Major bottlenecks for scaling an app

A
  1. Database: Apps horizontally scaled out but all communicating with one single DB. This is a bottleneck scenario. Make use of Database Partitioning, Sharding, or multiple database servers to make module efficient.
    2.Application Architecture: A common architectural mistake is not using asynchronous processes & modules where ever required rather all the processes are scheduled sequentially.
  2. Not using Caching in application wisely
  3. Inefficient configuration and setup of LB
  4. Adding business logic to DB
  5. Not picking up the right DB
    Need transactions & Strong Consistency- Relational DB
    HA and Less Consistency- NoSQL
  6. Bad Coding Standards
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Steps to Improve the Scalability of the app

A
  1. Profiling(Memory Profiling, Code Profiling)
  2. Caching(Cache wisely. Cache everywhere. Cache all static content. Hit the DB when it is really required. Try to serve all read requests from the cache. Use a write-through Cache( Write in both DB and Cache while updating/inserting)
  3. CDN (Using a CDN further reduces the latency of the application due to the proximity of the data from the requesting user)
  4. Data Compression (Use apt algorithms to compress the data. Store the data in compressed format. Compressed data consumes less bandwidth and download speed at the client becomes faster)
  5. Avoid unnecessary client-server requests.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Parameters to be taken into account while scalability testing:

A
  • CPU Usage
  • Network Bandwidth Consumption
  • Throughput
  • No of request processed within a stipulated time
  • latency
  • Memory usage of the program
  • End-user experience when the system is under heavy load
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is High Availability?

A

The ability of a system to stay online despite infrastructure failures in real-time.
To make a system HA, they are made fault-tolerant using redundancy.

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

Reasons for System failures

A
  1. Software Crashes
  2. Hardware Failures( Overloaded CPU,Overloaded CPU, RAM, hard disk failures, nodes going down. Network outages.)
  3. Human Errors: Flawed configurations & stuff.
  4. Planned Downtime
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is fault Tolerant?

A

The ability of a system to stay up despite taking hits.
An FT System is equipped to handle faults.
In case of these internal failures, the system could work at a reduced level but it will not go down entirely.
Social Media application.
In the case of backend node failures, a few services of the app such as image upload, post likes, etc. may stop working. But the application as a whole will still be up.
This approach is called Fail Soft.
Microservice architecture is the best example of this.

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

What is redundancy?

A

Duplicating the components or instances & keeping them on standby to take over in case of active instance goes down.
This approach is called Active-Passive HA Mode.

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

What is replication?

A
  • Number of similar nodes running the workload together.
  • No Standby or Passive Instances.
  • When a single or a few nodes go down, the remaining nodes bear the load of the service
17
Q

What is HA Cluster?

A

A HA cluster or a failover cluster contains a set of nodes running in conjunction with each other to ensure HA (e.g Kafka Cluster)
The nodes are connected by a private network called Heart Beat Network that continuously monitors the health and status of each node in the cluster.
A single state across all nodes in a cluster is maintained with the help of a shared distributed memory and distributed coordination service like zookeeper

18
Q

Steps to ensure HA Clustering?

A
  1. Disk Mirroring
  2. Redundant network connections
  3. redundant electrical power
  4. Multiple HA clusters run together in one geographical zone ensuring minimum downtime & continual service.( Kafka Mirroring)