performance - a challenging craft
Post on 21-Oct-2014
1.038 views
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 moreTRANSCRIPT
![Page 1: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/1.jpg)
A Challenging Craft
![Page 2: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/2.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/3.jpg)
![Page 4: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/4.jpg)
Art
Some say:„creating software is art“
Art and software developmentneed creativity
![Page 5: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/5.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/6.jpg)
Craft
Correctness in detail
Research and verification
![Page 7: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/7.jpg)
Which way?
All types share Passion
Learning
Experience
![Page 8: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/8.jpg)
![Page 9: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/9.jpg)
![Page 10: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/10.jpg)
![Page 11: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/11.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/12.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/13.jpg)
New?
Instable or slow softwaredelays time to market
Slow software is no longeraccepted by customers
![Page 14: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/14.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/15.jpg)
Is A Craft
![Page 16: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/16.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/17.jpg)
Look closely
We prove functionalcorrectness with automatedtests
High coverage
Run examples and see if they are fast
![Page 18: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/18.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/19.jpg)
42cm are fast?
Avoid human errors
Require machine decidablefail / pass check
What is the measure?
![Page 20: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/20.jpg)
Our Environment
Functionality is independentof the environment
Performance characteristicscan vary Unusable slow
Lightning fast
![Page 21: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/21.jpg)
Developers
driving fast
Underpowered hardware
Loaded with toolsand stuff
Luckily not the productionenvironment
![Page 22: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/22.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/23.jpg)
Stop playing
Real performance testsneed real systems
Test in production
Clone productioninfrastructure
![Page 24: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/24.jpg)
Tweets per second
Amount of data isunpredictable
Application usage isunpredictable
How thought of using Twitter for build notification?
![Page 25: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/25.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/26.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/27.jpg)
Live Systems are live
Real usage cannotbe generated
Real usage can becaptured & replayed
Be careful
![Page 28: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/28.jpg)
App Monitor
Continous performance tests
Close to real setup
Observe production behavior
Fix issues fast
![Page 29: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/29.jpg)
Another Movement
Conflicting interests Development: Change
Operations: Stability
Need to work together
![Page 30: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/30.jpg)
Is A Challenge
![Page 31: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/31.jpg)
Let users test?
Can‘t we do anything beforeproduction?
We want to deliver something,which works perfectly!
![Page 32: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/32.jpg)
Missed Target
Optimizations might haveno impact
Micro-Optimizations aredangerous
![Page 33: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/33.jpg)
Sonar
Soft Measure
Works good for code quality
Are there performance best practices?
![Page 34: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/34.jpg)
Good Waterfalls
Yahoo Best Practices
Google Best Practices
Plenty of tools
Work well
![Page 35: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/35.jpg)
Naive implementation looks fine
But is not multithreaded
![Page 36: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/36.jpg)
This is threadsafe
But slow
![Page 37: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/37.jpg)
This is correct
Correct synchronisation is hard
![Page 38: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/38.jpg)
Check Log Level (Ugly)
Check Log Level (Nicer)
![Page 39: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/39.jpg)
Static SimpleDateFormat is wrong
Working with Datesand Calendars isvery expensive!
![Page 40: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/40.jpg)
![Page 41: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/41.jpg)
Some people misuse it as loop
Results are unexpected behavior or slow execution
![Page 42: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/42.jpg)
Indeed finds bugs
Analyzes Java Bytecode
Knows 58 Performance Bugs
Most are rather trivial
![Page 43: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/43.jpg)
Verifies Java
Detecting deadlocksis difficult
Many thesis's on deadlockdetection
Few code
![Page 44: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/44.jpg)
IBM
Support Assistant
Hidden Gem
Tries to cause Deadlocks
![Page 45: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/45.jpg)
We need more and reliable Code Performance Metrics
Best Practices
Tools
![Page 46: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/46.jpg)
Is A Challenging Craft
![Page 47: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/47.jpg)
Q & A
![Page 48: Performance - a challenging craft](https://reader033.vdocument.in/reader033/viewer/2022051311/54477bdeafaf9f65178b48ab/html5/thumbnails/48.jpg)
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