Performance Flashcards

1
Q

What is PAAS? What does it offer?

A

Platform as a service.

Easy horizontal scaling
Component level performance tuning
Infrastructure security.

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

Is Response Time Important?

A

Yes, Constitutes to a drop in sales, traffic, searches. If it takes more than 100ms it is instantaneous and then greater than 7 seconds is abandonment time. Speed is a feature.

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

Where does time go during Web Request?

A

Request Sent -> Web Server -> App Server (controller & model) -> Database access -> View rendering -> OS/Network Stack -> Back to user, render on user. All assets loaded, run scripts, rendering done.

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

What Client side of request takes the most time?

A

CSS Selectors & JavaScript = 41% of client rendering time.

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

What hinders client side of request speed

A

JavaScript interpreter, javascript is single threaded,
Html Parse - 21%
Selector Engine 29%

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

Why is it bad to draw a bell curve distribution of users response time?

A

The response time distribution is not a bell curve and is actually extremely Right skewed ^___ So you should not draw a bell curve, but a skewed curve. Most users experience good connection and availability.

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

Scalability

A

Means different things in different context.

For Saas: as number of users increases how to does app availability change

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

Service Level Objective

A

Time to Satisfy user request.
SLO: Instead of worse case or average, what % of users get acceptable performance?
Specify percentile, target response time, time window.

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

ApDex Score

A

Given a latency T for user satisfaction:
Satisfaction <= T
Tolerable T <= user <= 4T
Apdex = #Satisfactory + (.5)(tolerable) / requests
0.85 to .93 generally good
But it can hide systematic outliers. Eg critical action occurs once every 15 clicks but takes 10x as long. SO your Apdex is being scored well, but you have a systematic problem with your app taking too long

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

What is a good Threshold?

A

1000 - 2000ms is best

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

What do you do if site is slow?

A

Overprovision: Just add more servers since they are cheaper, but only good for smaller sites

Large Site: Dangerous since you have so many idol servers now

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

App wants 99.9% uptime and it was down for an hour. Can it make its goal?

A

We don’t have enough information because we don’t know what the time frame is for the uptime goal, like over a year or over a day. Then you also don’t know if they had outages in the past.

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

What does a 99.999% up time per year entitle?

A

<= 5 minutes down per year

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

What are the kinds of monitoring?

A

At development time (profiling)
Probing while the site is down using an external monitor.
Both are normally used.

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

What is internal monitoring?

A

Info collected in your app but stored locally.
Server on Heroku injected measurement points in the stack and then in background gets this data shipped to another site and then gives you historical data. You can just use Relic as a gem and that’s all you need to do to test it. It has a free tier.

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

What are options for monitoring?

A

Google Analytics for clicks and time in between user action, Slow Controller and DB queries with NewRelic. Availability with pingdom. Unhandled exceptions airbrake

17
Q

What should we measure for our app health?

A

Stress Testing or load testing: how far can I push my system before performance becomes unacceptable and before it grasps and dies.
Usually one component will be bottleneck.

18
Q

What are Longevity Bugs?

A

They are bugs that happen a while after production and it is usually stuff like memory leaks where over time they get worse until they get over manageable. The way around this is to just reset the servers every set time period so it never waits long enough to crash from memory leaks.

19
Q

Running out of sessions is an example of?

A

Self-denial of service attacks like hitting homepage and such -> Where your homepage takes some effort to load and then a massive amount of users would hinder it. You can avoid this with not expensive home pages.

20
Q

what is not a high interest metric to the app operator?

A

Maximum CPU Utilization which does not affect the user.

21
Q

What can you do to your application that helps with responsiveness?

A

You can define the queries and how users get presented. Since the database is hard to scale this is a point to worry about. Find ways to optimize queries and such.

22
Q

What is n + 1 Query problem?

A

Traversing an association through an immediate table. You call fans and then you call fans.movies For each of these records you retrieve 1 query and then an additional n queries for each one query. You can avoid this with active record. Tell it @fans = Moviegoer.where(‘’’’’’’).includes(:movies) this will stop from needing to do additional queries and it helps with speed. You also don’t want to preload associations that you don’t use. It will only waste time.

23
Q

How to fix n + 1?

A

Bullet gem can help recognize them. Solution is to rewrite them.

24
Q

What are indices?

A

Speed up access when searching DB table by column other than primary key. It is just like hash table. Always index foreign keys.

25
Q

Where should you put a feature flag?

A

Not in a file, Put it in a database or a place you can change at run time.