why is the application running so slowly?

28
1 of 28 Why is the application running so slowly? [UGF2778] Dr. Paul Dorsey & Michael Rosenblum Dulcian, Inc. www.dulcian.com

Upload: michael-rosenblum

Post on 15-Apr-2017

41 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Why is the application running so slowly?

1 of 28

Why is the application running so slowly?[UGF2778]

Dr. Paul Dorsey & Michael RosenblumDulcian, Inc.

www.dulcian.com

Page 2: Why is the application running so slowly?

2 of 28

Who Am I? – “Dr.Paul” Been Around FOREVER

Spoke at almost every big Oracle conference since ’93 First inductee to SELECT Hall of Fame

Wrote lots of books Designer, Developer, JDeveloper, PL/SQL

Won lots of awards One of initial 6 ACE Directors [+First one fired!]

Built lots of big systems Air Force Recruiting Ethiopian Ministry of Finance and Economic Development Budget System

Known for: Thick Database approach Business Rules

Page 3: Why is the application running so slowly?

3 of 28

Who Am I? – “Misha”Oracle ACECo-author of 3 books

PL/SQL for Dummies Expert PL/SQL Practices Oracle PL/SQL Performance Tuning Tips & Techniques

(Rosenblum & Dorsey, Oracle Press, July 2014)Won ODTUG 2009 Speaker of the YearKnown for:

SQL and PL/SQL tuning Complex functionality

Code generators Repository-based development

Page 4: Why is the application running so slowly?

4 of 28

OverviewPerformance issues are the bane of our existence. We are quick to blame the database (if we are application

developers) Even quicker to blame the developers (if we are DBAs) If all else fails, we can blame the network.

Page 5: Why is the application running so slowly?

5 of 28

Presentation Goals

1. Provide a coherent methodology to identify performance issues.

2. Lay out the most common sources of those problems. 3. Discuss the most common techniques to solve these

performance problems.

Page 6: Why is the application running so slowly?

6 of 28

The Problem

Too many moving piecesContemporary IT = lots of entities within the same organization.

No overall architectural approachPerformance tuning is usually initiated by end-user complaintsSystem audit = blaming contest

Aggregated statistics are meaningless … unless you can explain why a button click on the screen takes

so much time.

Page 7: Why is the application running so slowly?

7 of 28

Why Performance Tuning Fails

Are we solving the wrong problem?Tuning:

Usually makes the database run better Focuses on poorly running SQL

Web applications are frequently unaffected by these performance improvement approaches.

Need to examine the entire system, not just the database.

Page 8: Why is the application running so slowly?

8 of 28

Identifying Performance IssuesNeed to look at the following parts of the system

ClientApplication ServerDatabaseCommunication between client/application server/ database

Page 9: Why is the application running so slowly?

9 of 28

Common Causes of Performance Problems

The most common causes of slow systems:Excessive roundtrips from the application server to the

databaseLarge pages sent to the client Performing operations in the application server that should be

done in the database Poorly written SQL and PL/SQL routines

Page 10: Why is the application running so slowly?

10 of 28

Web Application Architecture

3. App Server

2. Send data from client

to app server 5. DB

6. Return Data fromDB to app server

1. Client

4. Send data fromapp server to DB

7. Data inApp Server

8. Return data from app server

to client 9. Data in client

Page 11: Why is the application running so slowly?

11 of 28

Measuring Performance

Possible approaches:Direct measurement of each step

… if you can Indirect measurement using round trips

… where direct measurement is impossibleMonitor database resources

At least we know how to do that!

Page 12: Why is the application running so slowly?

12 of 28

Timing Language ElementsCommand: Atomic part of the process (any command on any tier)Step: Complete processing cycle in one direction (always one-

way) Can either be a communication step between one tier and another, or a

set of steps within the same tier. Step consists of a number of commands.

Request: Action consisting of a number of steps. A request is passed between different processing tiers.

Round-trip: Complete cycle from the moment the request leaves the tier to the point when it comes back with some response information.

Page 13: Why is the application running so slowly?

13 of 28

Unlikely source of problems. Should not be dismissed entirely. Using AJAX architectures, it is possible to place so much code in the

client that a significant amount of time is required before the request is transmitted to the application server.

Beware of underpowered client machines with inadequate memory and slow processors.

Steps 1 & 9 - Client

1.Client

9. Data in client

Page 14: Why is the application running so slowly?

14 of 28

Step 2 - Client to Application Server

Less common cause of performance problemsTransmitting large amounts of information over the Internet may

cause problems. Uploading large files Transmitting a large block of data

2. Send data from client to app server

Page 15: Why is the application running so slowly?

15 of 28

Steps 3 & 7 App Server Processing

Processing can be resource-intensive. Java programmers minimize database application logic in the middle tier. Complex data manipulation can be handled much more efficiently with

database code. Thick database approach is the key to efficiently performing web applications.

7. Data in app server

3. App server

Page 16: Why is the application running so slowly?

16 of 28

Step 4 - Application Server to DB

Not instantaneous (but really fast) High number of transmission requests is #1 cause of performance problems. Database-independence is not a good idea.

Single request from a client may require many requests from the application server to the database in order to fulfill.

Examine and measure the number of round-trips from application server to database.

4. Send data from app server to DB

Page 17: Why is the application running so slowly?

17 of 28

Step 5 – DB Performance Problems

Use traditional tuning. Beware of stateless implementation.

Information pertaining to a particular session must be retrieved at the beginning of every request and persistently stored at the end of every request.

Single table may generate massive I/O Redo logs Block contention

5.DB

Page 18: Why is the application running so slowly?

18 of 28

Step 6 – DB to Application Server Transmission Problems

Rare problemBeware of unnecessary data movement.

One record is needed and the whole table is sent.

6. Return data from DB to app

server

Page 19: Why is the application running so slowly?

19 of 28

Step 8 - App Server to Client Transmission Problems

#2 cause of performance problems Keep pages small.

Not too many fields Not too much AJAX or JavaScript Not too big a tree Not too much data in a scrolling block No images, or other unnecessary information

Measure size of page.

8. Return data from app server to client

Page 20: Why is the application running so slowly?

20 of 28

Common Reasons for Poor Performance

Excessive round trips between application server and database

Moving too much into the clientSlow client-side codeSlow queriesBadly written PL/SQLImproperly tuned database

Page 21: Why is the application running so slowly?

21 of 28

Measuring Performance

Page 22: Why is the application running so slowly?

22 of 28

Locating Slow Performance Causes

Embed timers into a system to detect where in the nine possible steps the application performance is degrading.

Strategically placed timers will indicate how much time is spent at any one of the steps in the total process.

Page 23: Why is the application running so slowly?

23 of 28

System Tuning for 3-tier Application(with numbers!)

9-step or

5 round-trip

structure

80 sec100 sec

75 sec50 sec40 sec

40 sec

4 sec

6 sec

15 sec

10 sec

2 sec

3 sec

5 sec

15 sec

ClientApp

server DATABASE

ClientApp

server DATABASE

Page 24: Why is the application running so slowly?

24 of 28

Actions in 5 Round-Trip Structure

Client Level 1. From request

initiation to end of processing User clicks button Response is displayed

2. From request to application server to response receipt Start of servlet call End of servlet call

Application Level 3. From request

acceptance to moment it is sent back Start of processing in

servlet End of processing in

servlet 4. From request sent to

database Start of JDBC call End of JDBC call

Database Level 5. From request

acceptance to sending back the response Start block End of block

Page 25: Why is the application running so slowly?

25 of 28

Performance-Improving Techniques

Reducing round trips to the databaseNo SQL in the application serverReduce size of client pagesTune the databaseTune the SQL

Page 26: Why is the application running so slowly?

26 of 28

ConclusionsIn order to determine why an application is running

slowly, you must: Identify the reasons for the slow running code.Learn how to instrument the code to identify performance

bottlenecks in the client, application server and database.Use techniques for reducing performance problems.

Page 27: Why is the application running so slowly?

27 of 28

Contact Information Paul Dorsey – [email protected] Michael Rosenblum – [email protected] Website – www.dulcian.com Latest books:

Oracle PL/SQL Performance Tuning Tips & Techniques, McGraw-Hill Oracle PL/SQL for Dummies

Page 28: Why is the application running so slowly?

28 of 28

Save the DateCOLLABORATE 17 registration will open on Thursday, October 27.

Call for SpeakersSubmit your session presentation! The Call for Speakers is open until Friday,

October 7

collaborate.ioug.org