Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Understanding XHProf: Pinpointing Why Your Site...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Ezra Gildesgame
April 19, 2014
Programming
210
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix It
Ezra Gildesgame
April 19, 2014
Other Decks in Programming
See All in Programming
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
380
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
350
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
540
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
8.8k
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
170
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
170
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
130
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
570
Ghostty + Neovimで作る 透明でカッコ良い開発環境
j341nono
0
130
Verilogで学ぶCPU自作入門.pdf
uyuki234
8
3.6k
wkhtmltopdfの次どうするか問題2026
willnet
2
1.8k
難しいけど、読めた。- OSSの入口に立った話。
sts11142
0
130
Featured
See All Featured
Docker and Python
trallard
47
4.2k
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
sira's awesome portfolio website redesign presentation
elsirapls
0
420
KATA
mclloyd
PRO
35
16k
Test your architecture with Archunit
thirion
2
2.4k
Building an army of robots
kneath
307
46k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
550
BBQ
matthewcrist
89
10k
Building AI with AI
inesmontani
PRO
1
1.3k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
340
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
510
Transcript
Understanding XHProf Pinpointing Why Your Site is Slow and How
to Fix It Ezra Gildesgame - Acquia @ezrabg Stanford Drupal Camp 2014
The Problem: Slow Websites/Web apps • Unhappy users leave •
Severs can’t sustain load
Every second counts • http://blog.kissmetrics.com/loading-time/
XHProf provides information about execution time • Time spent by
the server to generate page sent to the web browser (or API endpoint) • Also measures memory & CPU usage
XHProf does not measure: • Time to First Byte (TTFB)
• Page render time (happens in the browser) • Other aspects of front-end performance • For page render time, see Chrome Dev tools, YSlow
Our goal: Reduce page execution time • Improve user experience
• Improve concurrency and efficient use of server resources.
Avoid speculation: • “Maybe it’s x” • Wasted time on
fruitless investigation • Wasted time on inappropriate remediations • Vague problem descriptions, “Eg, Views is slow”
Misconceptions
Misconceptions
Be smart, m’kay? • Tools like Views & Panels empower
you to do inefficient things but aren’t necessarily bad for performance • Views render & query, Panels pane caches are great tools to improve performance
Example problem statement • “Entity loads are slow because when
we load entities, we load field X which also loads Y data, which spends Z time in the database. Page A loads 1,000 entities of type X.”
Use XHProf to • Pinpoint the root cause of performance
problems • Develop a surgical remediation plan
Key UI Elements • # of function calls • Wall
time (Inclusive/exclusive) • Memory usage • CPU time
Exclusive/Inclusive • Exclusive: This function only • Inclusive: This function
and all child functions
CPU Time vs Wall Time • CPU Time: Time spent
by the CPU • Wall time: Time including disk I/O • CPU time != Wall time? Likely waiting for disk
We may find: • Function called many times unnecessarily •
Consider a static cache
We may find: • Slow queries • Execute page again
with Devel query log, use built-in explain feature
We may find: • Many fast queries that stack up
We may find
We may find • Queries that are quick to execute
but slow to assemble
We may find: • Excessive entity loads • Excessive calls
to memcache set/get
What is “excessive” • It depends! Know your app. •
Maybe you need that data on that request: Make it less expensive to compute • Maybe you don’t need that data: Don’t compute it
We may find: • Page-blocking calls (eg, 3rd-party API requests)
• Queue these
We may find: • Excessive calls to watchdog() • Notices
can slow down your site. • Fix those notices!
We may find: • Views/Panels render time - Dig deeper!
We may find:
Getting started • Brew install xhprof • Install: http://drupal.org/project/xhprof •
Alternative: https://github.com/ msonnabaum/xhprof-single-file
Avoid dirty runs. • Eliminate menu rebuilds • Disable Devel
query log • Disable XDebug - Really. • Test as a non-admin (access control is expensive. We want to observe that.)
Know which caches are in place • Views caches (Disable
Views caches: https:// gist.github.com/msonnabaum/9671947) • Panels Caches • Other caches
Other caches
“ZOMG! The site is slow!” • ORLY • Develop a
plan to measure and set goals
“Slow” Define success with specific performance goals • Execution time
on specific page logged in as specific user under specific conditions • Quantify improvements on a per-page basis
Example template
Case examples
Example 1
Example: Static Caching in CTools https://drupal.org/node/2049087 • Eliminated ~128,000 calls
to t() • Reduced memory footprint • Reduced page execution time by 2 seconds • Simple fix
Example: Static caching of node access grants https://drupal.org/comment/8495029 • node_access_grants()
never changes within a request • Why compute it multiple times within a request?
Example: Avoid unnecessary entity loads https://drupal.org/node/2169099
Optimize node access query building https://drupal.org/comment/8516319
Questions?