performance - a challenging craft

48
A Challenging Craft

Post on 21-Oct-2014

1.040 views

Category:

Technology


1 download

DESCRIPTION

In my talk at socrates 2011, I descrived why performance is a craft and what to do to ensure great performance. I concluded with a few best practies and wonder if there are more

TRANSCRIPT

Page 1: Performance  - a challenging craft

A Challenging Craft

Page 2: Performance  - a challenging craft

Customer

Fabian

My day to day job is to help customersfixing software performance

People really struggle with performance

But most of them struggle with coding as well

That‘s me

If creating good software is a craft,performance should be one as well

Page 3: Performance  - a challenging craft
Page 4: Performance  - a challenging craft

Art

Some say:„creating software is art“

Art and software developmentneed creativity

Page 5: Performance  - a challenging craft

Magic

Fixing performance isoften considered magic

Magic is something only you understand

you do in a hard tofollow fashion

Page 6: Performance  - a challenging craft

Craft

Correctness in detail

Research and verification

Page 7: Performance  - a challenging craft

Which way?

All types share Passion

Learning

Experience

Page 8: Performance  - a challenging craft
Page 9: Performance  - a challenging craft
Page 10: Performance  - a challenging craft
Page 11: Performance  - a challenging craft

Money

(in parts of the world)

Value == Money

We need a business casefor performance

What is the impact ofbad performance?

Page 12: Performance  - a challenging craft

Typical (?) retailer

Amazon measured theimpact of 100ms delay

Sales dropped by 1%

In a year that would be245 Million USD

Page 13: Performance  - a challenging craft

New?

Instable or slow softwaredelays time to market

Slow software is no longeraccepted by customers

Page 14: Performance  - a challenging craft

Snail Mail

Insurances like to sendpaper via mail

Not meeting deadlines cancause Legal issues

Canceled contracts

Loss of money

Page 15: Performance  - a challenging craft

Is A Craft

Page 16: Performance  - a challenging craft

Performance

Engineering

Calculate Execution Time Code x = 5ms

Code y = 2*x = 10ms

Know code in advance

Waterfall approach

Proving the performance of softwareis more difficult than proving the correct function

Page 17: Performance  - a challenging craft

Look closely

We prove functionalcorrectness with automatedtests

High coverage

Run examples and see if they are fast

Page 18: Performance  - a challenging craft

How much load

breaks the system?

Done late in project

If done at all

No chance to fix anything

Page 19: Performance  - a challenging craft

42cm are fast?

Avoid human errors

Require machine decidablefail / pass check

What is the measure?

Page 20: Performance  - a challenging craft

Our Environment

Functionality is independentof the environment

Performance characteristicscan vary Unusable slow

Lightning fast

Page 21: Performance  - a challenging craft

Developers

driving fast

Underpowered hardware

Loaded with toolsand stuff

Luckily not the productionenvironment

Page 22: Performance  - a challenging craft

Crawling Production

More power

But also more load

How much faster isproduction than development?

Any estimation on how much better or worse theenvironments are is incorrect

Page 23: Performance  - a challenging craft

Stop playing

Real performance testsneed real systems

Test in production

Clone productioninfrastructure

Page 24: Performance  - a challenging craft

Tweets per second

Amount of data isunpredictable

Application usage isunpredictable

How thought of using Twitter for build notification?

Page 25: Performance  - a challenging craft

Dev

Test Test1

Test Test2

Test Test3

Showing 3/3

Fabian Lange

Uwe Friedrichsen

Mirko Novakovic

Showing 3/6,434,867

Prod

Page 26: Performance  - a challenging craft

Load Baselines

Syntethic load tests areunrealistic

No application has hundredsof users doing the sameprocedure again and again

Understanding real load is difficult

Page 27: Performance  - a challenging craft

Live Systems are live

Real usage cannotbe generated

Real usage can becaptured & replayed

Be careful

Page 28: Performance  - a challenging craft

App Monitor

Continous performance tests

Close to real setup

Observe production behavior

Fix issues fast

Page 29: Performance  - a challenging craft

Another Movement

Conflicting interests Development: Change

Operations: Stability

Need to work together

Page 30: Performance  - a challenging craft

Is A Challenge

Page 31: Performance  - a challenging craft

Let users test?

Can‘t we do anything beforeproduction?

We want to deliver something,which works perfectly!

Page 32: Performance  - a challenging craft

Missed Target

Optimizations might haveno impact

Micro-Optimizations aredangerous

Page 33: Performance  - a challenging craft

Sonar

Soft Measure

Works good for code quality

Are there performance best practices?

Page 34: Performance  - a challenging craft

Good Waterfalls

Yahoo Best Practices

Google Best Practices

Plenty of tools

Work well

Page 35: Performance  - a challenging craft

Naive implementation looks fine

But is not multithreaded

Page 36: Performance  - a challenging craft

This is threadsafe

But slow

Page 37: Performance  - a challenging craft

This is correct

Correct synchronisation is hard

Page 38: Performance  - a challenging craft

Check Log Level (Ugly)

Check Log Level (Nicer)

Page 39: Performance  - a challenging craft

Static SimpleDateFormat is wrong

Working with Datesand Calendars isvery expensive!

Page 40: Performance  - a challenging craft
Page 41: Performance  - a challenging craft

Some people misuse it as loop

Results are unexpected behavior or slow execution

Page 42: Performance  - a challenging craft

Indeed finds bugs

Analyzes Java Bytecode

Knows 58 Performance Bugs

Most are rather trivial

Page 43: Performance  - a challenging craft

Verifies Java

Detecting deadlocksis difficult

Many thesis's on deadlockdetection

Few code

Page 44: Performance  - a challenging craft

IBM

Support Assistant

Hidden Gem

Tries to cause Deadlocks

Page 45: Performance  - a challenging craft

We need more and reliable Code Performance Metrics

Best Practices

Tools

Page 46: Performance  - a challenging craft

Is A Challenging Craft

Page 47: Performance  - a challenging craft

Q & A

Page 48: Performance  - a challenging craft

Art flickr.com/photos/37202375@N03/3490107873

Magicflickr.com/photos/princes_milady/4238912548

Crossroadsflickr.com/photos/40481200@N06/4857965280

Envelopesflickr.com/photos/creatingmotherhood/3663914542

Testflickr.com/photos/cayusa/2159980025

Scalesflickr.com/photos/reinvented/309512320

Tape Measureflickr.com/photos/hippie/2466583497

World flickr.com/photos/heimdahlrecounts/4346082743

Toysflickr.com/photos/sbluerock/364123380

TPSflickr.com/photos/twitteroffice/5681263084

Bananasflickr.com/photos/design-dog/1249337589

Dartflickr.com/photos/malavoda/2369876508

YSlowdeveloper.yahoo.com/yslow

Pagespeedcode.google.com/speed/page-speed

Java Lockingen.wikipedia.org/wiki/Double-checked_locking

PHP Ternary Operatorfabien.potencier.org/article/48/the-php-ternary-operator-fast-or-not

JavaScript for .. Instackoverflow.com/questions/500504/javascript-for-in-with-arrays

Findbugsfindbugs.sourceforge.net

Jlintjlint.sourceforge.net

IBM Multicore SDKwww-01.ibm.com/support/docview.wss?uid=swg21456945