Presentation is loading. Please wait.

Presentation is loading. Please wait.

Memory-efficient and fast websites Malcolm Tredinnick.

Similar presentations


Presentation on theme: "Memory-efficient and fast websites Malcolm Tredinnick."— Presentation transcript:

1 Memory-efficient and fast websites Malcolm Tredinnick

2 Setup ● Web application ● Single machine (or small number) ● No real budget ● Brains, time, enthusiasm

3 Big-time Operations What do they do?

4 Big-time Operations (2) ● Vertical design / horizontal scaling ● Session management ● Geographical scaling ● Staffing

5 Vertical Design

6 Horizontal Scaling

7 Approach ● What is going on? ● What does it mean? ● What can be changed? ● What are the trade-offs? – TANSTAAFL!

8 “Now” and “Later” ● Perspective ● Realism ● Balance

9 Useful Tools ● Server log analysis – logwatch – awstats ● Stat collection – rrdtool – Cricket (for example)

10 Useful Tools (2) ● Live analysis – vmstat – pcat (part of Coroner's Toolkit) – wget/curl – firebug / YSlow – ab (Apache bench) – /proc/ /maps

11 The Players ● Processor ● Memory ● Disk ● Network traffic ● Timeliness ● Reliability ● Consistency ● $$$

12 Weapon Selection ● Web servers ● Databases ● Caches ● Proxies

13 Caching ● On disk – Pre-generated – on-demand ● In memory ● HTTP layer

14 Caching Gotchas ● Coherency ● The thundering herd problem – Objects take non-zero time to create

15 Distributed Workloads ● Static / dynamic split – The DIY approach – Amazon web services (S3, EC2) ● Content delivery networks (CDN) – YUI – Google code

16 In Practice ● Scaling discontinuities ● Post hoc analysis ● Forwards-looking design

17 Prepare For The Worst ● Failure levels – Complete meltdown – Partial unavailability – Inconsistencies ● Slashdot effect ● Mitigating versus solving

18 Learning Is Continuous ● Learn from the big(-ish) guys – livejournal, wikipedia, twitter, slashdot ● HTTP Caching – Mark Nottingham's blog ● Be interested in data structures ● Read documentation ● Experiment

19 Programs ● Web servers and interfaces – Apache ● modpython ● modwsgi – mighttpd – CherryPy – WSGI (Python interface spec) ● Nginx – reverse proxy ● squid

20 Programs (2) ● Databases – PostgreSQL – MySQL – SQLite ● Memcached – in-memory, distribute caching

21 Resources ● Writing minimal Apache config – FIXME! ● The Coroner's toolkit, etc – http://porcupine.org/ http://porcupine.org/


Download ppt "Memory-efficient and fast websites Malcolm Tredinnick."

Similar presentations


Ads by Google