web tcard - speed optimization
TRANSCRIPT
1
Web TCard – Speed optimization
Eric Guo
MES Business Systems Analyst
3/22/2015
2
Overview
Background & Objective
Experimental - Measure & Finding bottleneck
Result & Discussion
Conclusion
Learnt from it
3
Background & Objective
Speed
More data source.
Stable (0 downtime)
Agility
Built for mobile instead of paper.
Built for next 10 years.
4
Measure & Finding bottleneck in CR report
Using M1512ME9F3.02 and MT TCard as example.
http://cvpmesip04/TCardPrint/
– Total loading time 3.86s
• Including 16 sub report, time in ms
• 103+49+228+71+240+46+55+110+49+55+89+49+18+47=1209 MS
• All rest time is relative with render or running in Crystal Report internally.
5
Latency times every programmer should know
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 4x mutex op, 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns 20x datacenter roundtrip
Read 1 MB sequentially from disk 20,000,000 ns 80x reading in seq from memory
Send packet CA->Netherlands->CA 150,000,000 ns
By Jeff Dean (http://research.google.com/people/jeff/):
6
Analysis and feasibility analyze
Sub-report slowdown the total processing
– But it’s needed and necessary because of biz requirement
Deep link table join will cause slowness
– But you need link those table to take data to be showing in T-Card latter.
Crystal Report takes 2.6+ seconds to do internal works
– But it’s almost can not make any change to affect it
Crystal Report will failed to loading report sometime
– No source code, no way to improve.
7
Days of future past – act like X-Men
Sub-report slowdown the total processing
– Stop using sub-report in new web t-card
Deep link table join will cause slowness
– Stop using any join when query DB table
Crystal Report takes 2.6+ seconds to do internal works
– No internal code, everything should can be changed
Crystal Report will failed to loading report sometime
– Stop using Crystal Report
8
Perception is Reality
Stop using sub-report in new web t-card
– Fetch data in one place
Stop using any join when query DB table
– One query per one table, in-memory calculation all T-Card info, do filter, join.
No internal code, everything should can be changed
– Know each line of time taken
Stop using Crystal Report
– Whole web T-Card built on the open source stack
9
Trace the SQL payload by line
10
Result & Discussion
M1512ME9F3.02 is now takes 0.68s to loading
5 times faster.
11
Conclusion & Learnt From It
Make things faster probably need re-think the whole design.
Except make things faster, many things also important.
Maintain cost
Support cost
Stability
Simplicity
The more you known, the more freedom you have to balanced contradiction requirement
– http://cvpscmip01/mv.git