COMP9321 Web Application Engineeringcs9321/16s1/lectures/lec10/Lec-10.pdf · 2016-05-12 ·...

Post on 11-Aug-2020

0 views 0 download

Transcript of COMP9321 Web Application Engineeringcs9321/16s1/lectures/lec10/Lec-10.pdf · 2016-05-12 ·...

COMP9321 Web Application Engineering

Improving Performance

1 COMP9321, 16s1, Week 10

http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2442

Dr. Basem Suleiman

Service Oriented Computing Group, CSE, UNSW Australia

Semester 1, 2016, Week 10

Review…

Performance

2 COMP9321, 16s1, Week 10

Performance

3 COMP9321, 16s1, Week 10

Scalability

4 COMP9321, 16s1, Week 10

Why does performance and scalability matter ?

5 COMP9321, 16s1, Week 10

Architectural Considerations

(Network)

6 COMP9321, 16s1, Week 10

Architectural Considerations - Network

7 COMP9321, 16s1, Week 10

http://www.cs.cornell.edu/courses/cs519

Architectural Considerations - Network

8 COMP9321, 16s1, Week 10

https://devcentral.f5.com

Architectural Considerations - Network

9 COMP9321, 16s1, Week 10

By Kanoha - Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=7868809

Content Delivery (or Distribution) Network (CDN): an interconnected series of

servers that cache, store, and distribute web content to end-users simultaneously

based on their proximity (geographical distribution)

Single server distribution CDN scheme of distribution

Architectural Considerations - Network

10 COMP9321, 16s1, Week 10

http://www.cdnreviews.com/what-is-cdn/

Content Delivery (or Distribution) Network (CDN): an interconnected series of

servers that cache, store, and distribute web content to end-users simultaneously

based on their proximity (geographical distribution)

Architectural Considerations

(Servers)

11 COMP9321, 16s1, Week 10

Architectural Considerations - Server

12 COMP9321, 16s1, Week 10

Architectural Considerations - Server

13 COMP9321, 16s1, Week 10

Architectural Considerations - Server

14 COMP9321, 16s1, Week 10

General Techniques for Improving

Performance and Scalability

15 COMP9321, 16s1, Week 10

General Techniques for Improving Performance and Scalability

16 COMP9321, 16s1, Week 10

1. Caching and Replication

2. Parallelism

3. Redundancy

4. Asynchrony

5. Resource Pooling

General Techniques for Improving Performance and Scalability

17 COMP9321, 16s1, Week 10

1. Caching and Replication

General Techniques for Improving Performance and Scalability

18 COMP9321, 16s1, Week 10

2. Parallelism

More on implementing multi-thread applications in Java https://docs.oracle.com/javase/tutorial/collections/streams/parallelism.html

General Techniques for Improving Performance and Scalability

19 COMP9321, 16s1, Week 10

3. Redundancy

General Techniques for Improving Performance and Scalability

20 COMP9321, 16s1, Week 10

4. Asynchrony

General Techniques for Improving Performance and Scalability

21 COMP9321, 16s1, Week 10

5. Resource Pooling

Improving Performance using HTTP features

22 COMP9321, 16s1, Week 10

Improving Performance using HTTP features

23 COMP9321, 16s1, Week 10

Improving Performance using HTTP features

24 COMP9321, 16s1, Week 10

Improving Performance using HTTP features

25 COMP9321, 16s1, Week 10

Improving Performance using HTTP features

26 COMP9321, 16s1, Week 10

Improving Performance using HTTP features

27 COMP9321, 16s1, Week 10

Improving Performance using HTTP features

28 COMP9321, 16s1, Week 10

Improving Performance using HTTP features

29 COMP9321, 16s1, Week 10

AJAX = Asynchronous JavaScript and XML

• Update a web page without reloading the page

• Request data from a server - after the page has loaded

• Receive data from a server - after the page has loaded

• Send data to a server - in the background

Improving Performance using HTTP features

30 COMP9321, 16s1, Week 10

Improving Database Access

31 COMP9321, 16s1, Week 10

Improving Database Access

32 COMP9321, 16s1, Week 10

Improving Database Access

33 COMP9321, 16s1, Week 10

Improving Database Access

34 COMP9321, 16s1, Week 10

Improving Database Access

35 COMP9321, 16s1, Week 10

Improving Database Access

36 COMP9321, 16s1, Week 10

Improving Database Access

37 COMP9321, 16s1, Week 10

Improving Database Access

38 COMP9321, 16s1, Week 10

Improving Database Access

39 COMP9321, 16s1, Week 10

Improving Database Access

40 COMP9321, 16s1, Week 10

JOINT queries

Improving Database Access

41 COMP9321, 16s1, Week 10

JOINT queries

Improving Database Access

42 COMP9321, 16s1, Week 10

INSERT operation

Improving Database Access

43 COMP9321, 16s1, Week 10

INSERT operation

Improving Database Access

44 COMP9321, 16s1, Week 10

Improving Database Access

45 COMP9321, 16s1, Week 10

Improving Database Access

46 COMP9321, 16s1, Week 10

Characteristics of Scalability

47 COMP9321, 16s1, Week 10

Characteristics of Scalability

48 COMP9321, 16s1, Week 10

Characteristics of Scalability

49 COMP9321, 16s1, Week 10

Characteristics of Scalability

50 COMP9321, 16s1, Week 10

https://blog.twitter.com/2011/twitter-search-is-now-3x-faster

• Inefficiencies Twitter’s former Ruby-on-Rails front-end servers

• The front ends ran a fixed number of single-threaded rails worker

processes, each of which did the following:

• parsed queries

• queried index servers synchronously

• aggregated and rendered results

• The model of synchronous request processing uses Twitter’s CPUs

inefficiently

• Over time, significant technical debt in Ruby code base was accrued,

making it hard to add features and improve the reliability of our search

engine..

Characteristics of Scalability

51 COMP9321, 16s1, Week 10

More details on the case study and the Blender implementation: https://blog.twitter.com/2011/twitter-search-is-now-3x-faster

Blender addresses these issues by:

• Creating a fully asynchronous aggregation service. No thread waits on

network I/O to complete

• Aggregating results from back-end services, for example, the real-time,

top tweet, and geo indices

• Elegantly dealing with dependencies between services. Workflows

automatically handle transitive dependencies between back-end services

Scaling and

Request Load Balancing

52 COMP9321, 16s1, Week 10

Scaling & Request Load Balancing

53 COMP9321, 16s1, Week 10

Types of Scaling:

Scaling & Request Load Balancing

54 COMP9321, 16s1, Week 10

Types of Scaling:

Scaling & Request Load Balancing

55 COMP9321, 16s1, Week 10

Request Load Balancing for Horizontal Scaling

Scaling & Request Load Balancing

56 COMP9321, 16s1, Week 10

Request Load Balancing for Horizontal Scaling

Scaling & Request Load Balancing

57 COMP9321, 16s1, Week 10

Scaling & Request Load Balancing

58 COMP9321, 16s1, Week 10

Scaling & Request Load Balancing

59 COMP9321, 16s1, Week 10

Scaling & Request Load Balancing

60 COMP9321, 16s1, Week 10

Scaling & Request Load Balancing

61 COMP9321, 16s1, Week 10

Scaling & Request Load Balancing

62 COMP9321, 16s1, Week 10

Scaling & Request Load Balancing

63 COMP9321, 16s1, Week 10

Application-Level Load Balancing with Stateless Logic

Scaling & Request Load Balancing

64 COMP9321, 16s1, Week 10

Application-Level Load Balancing with Stateless Logic

Scaling & Request Load Balancing

65 COMP9321, 16s1, Week 10

http://www.ibm.com/developerworks/java/library/j-jtp07294/index.html

Application-Level Load Balancing with Stateless Logic

Scaling & Request Load Balancing

66 COMP9321, 16s1, Week 10

Scaling Databases - Replication

Scaling & Request Load Balancing

67 COMP9321, 16s1, Week 10

Scaling Databases - Replication

Scaling & Request Load Balancing

68 COMP9321, 16s1, Week 10

Scaling Databases - Replication

Scaling & Request Load Balancing

69 COMP9321, 16s1, Week 10

Scaling Databases - Replication

Scaling & Request Load Balancing

70 COMP9321, 16s1, Week 10

Scaling Databases - Replication

References

71 COMP9321, 16s1, Week 10

• Building Scalable and High-performance Java Web Applications by Greg Barish,

Addison Wesley

• Building Scalable Web Sites by Cal Henderson, O’Reilly Books

• Gregor Roth, ”Server load balancing architectures”, JavaWorld, October 2008

• http: //www.javaworld.com/javaworld/jw-10-2008/jw-10-load-balancing-1.html

72 COMP9321, 16s1, Week 10