web performance part 3 "server-side tips"
DESCRIPTION
The presentation is devoted to server side tips on improving Web Performance. All 4 presentations will help you reduce latency, enrich optimization of javascript code, discover tricky parts when working with API browser, see best practices of networking and learn lots of other important and interesting things. Enjoy! =)TRANSCRIPT
![Page 1: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/1.jpg)
Web PerformanceServer-side Tips
Andrew Kovalenko
![Page 2: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/2.jpg)
Table of contents➔ Nginx vs Apache➔ Apache performance tuning➔ Nginx performance tuning➔ Web server accelerators➔ Varnish➔ PageSpeed module
![Page 3: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/3.jpg)
Total number of websites
NetCraft: http://news.netcraft.com/archives/2013/06/06/june-2013-web-server-survey-3.html
![Page 4: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/4.jpg)
Web server developers:Market share of active sites
NetCraft: http://news.netcraft.com/archives/2013/06/06/june-2013-web-server-survey-3.html
![Page 5: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/5.jpg)
Nginx vs Apache (requests/seconds)
Amazon EC2Micro Instance
Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
613 MB RAM
Ubuntu 13.10
index.html612 B
earth.png3.7 MB
![Page 6: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/6.jpg)
Nginx vs Apache (memory usage)
![Page 7: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/7.jpg)
Apache basic architecture
![Page 8: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/8.jpg)
Nginx basic architecture
![Page 9: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/9.jpg)
Frontend (Nginx) - backend (Apache)
Front endClient
Back end
➔ php...
Static content
➔ js➔ css➔ images➔ video
...
![Page 10: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/10.jpg)
Nginx config
Light content (html, css, js, xml, rss, txt) Heavy content (photo, video, audio)
➔ g-zip compression➔ expires headers for content proxy➔ file descriptor caching
➔ virtual folder for frequently asked content➔ SSD➔ cache proxied requests
worker_processes, worker_priority, worker_connections, sendfile on, access_log off, tcp_nopush on, gzip on
![Page 11: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/11.jpg)
Apache configRun-TimeCompile-Time
➔ load only required modules➔ choose appropriate MPM
HTTP Compression & Caching
➔ AllowOverride➔ FollowSymLinks and
SymLinksIfOwnerMatch➔ Content Negotiation➔ MPM config➔ KeepAlive and KeepAliveTimeout
Accept-Encoding: gzip,deflate
Separate Static
RewriteCond for images
Other configs
![Page 12: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/12.jpg)
Web server acceleratorsWeb server accelerator
Compression Operatingsystem
Browser Caching Edge Side
Includes
Prefetching Optimizecode
Preemptivehostnameresolution
Ad removal
Client
aiCache Gzip Linux All Yes No Yes Yes Yes All
Apache Traffic Server
Linux
CACHEbox None Linux All Yes No Yes No No Yes End user/ISP
Ishlangu Gzip Linux All Yes No No Yes Yes No All
LotServer None Linux, Windows
All No No No No No No Content Provider
nginx Gzip Unix All Yes No No No Yes No user/ISP
Polipo None Unix, Windows All Yes No No No No No user/ISP
SiteCelerate Text & Images All Yes No Yes No No No user/ISP
Squid None Unix, Windows All Yes Yes No No No No user/ISP
Varnish Gzip on-the-fly compression and decompression
Unix All Yes Yes No No No If You want All
Ziproxy Images, text & any gzippable data
Unix All No No No HTML, JS, CSS
Yes Yes ISP
![Page 13: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/13.jpg)
Varnish
![Page 14: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/14.jpg)
SPDY: PageSpeed moduleSupported platforms:➔ CentOS/Fedora (32-bit and 64-bit)➔ Debian/Ubuntu (32-bit and 64-bit)
Apache 2.2 and higherNginx 1.3.15 and higher, for lower versions build from sources
![Page 15: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/15.jpg)
PageSpeed features➔ Optimizing caching➔ Minimizing round-trip times➔ Minimizing request overhead➔ Minimizing payload size➔ Optimizing browser rendering➔ Optimizing for mobile
all by filters...
![Page 16: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/16.jpg)
add_instrumentationAdds client-side latency instrumentation
Head:window.mod_pagespeed_start = Number(new Date());
End body:pagespeed.addInstrumentationInit('/mod_pagespeed_beacon', 'load', '', 'http://www.modpagespeed.com/add_instrumentation.html');
![Page 17: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/17.jpg)
combine_css
![Page 18: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/18.jpg)
local_storage_cache
![Page 19: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/19.jpg)
resize_mobile_images
![Page 20: Web Performance Part 3 "Server-side tips"](https://reader036.vdocument.in/reader036/viewer/2022062513/554bb758b4c9053a298b4a05/html5/thumbnails/20.jpg)
And a lot more➔ collapse_whitespace➔ combine_javascript➔ dedup_inlined_images➔ defer_javascript➔ extend_cache➔ extend_cache_pdfs➔ inline_css➔ inline_javascript➔ inline_preview_images➔ insert_dns_prefetch➔ move_css_above_scripts➔ move_css_to_head➔ lazyload_images➔ outline_css
➔ outline_javascript➔ prioritize_critical_css➔ remove_comments➔ remove_comments➔ remove_quotes➔ resize_rendered_image_dimensions➔ rewrite_css➔ rewrite_javascript➔ rewrite_style_attributes➔ sprite_images➔ trim_urls➔ etc...