pressing words with a cloud: wordpress technical overview, the art of the scale, and the cloud

16
www.nyphp.com / www.nyphp.org 06/26/22 1 Pressing Words with a Cloud WordPress Technical Overview, the art of the Scale, and the Cloud Hans Zaunere, Managing Member WordCamp Indonesia 2010 January 30 th , 2010

Upload: valent-mustamin

Post on 08-May-2015

3.015 views

Category:

Technology


1 download

DESCRIPTION

Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud, by Hans Zaunere, from New York PHP (Courtesy by Zend / Rynet Cipta Teknologi), for WORDCAMPID - WordCamp Indonesia 2010. Auditorium Gunadarma University, Depok, January 30, 2010

TRANSCRIPT

Page 1: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 1

Pressing Words with a CloudWordPress Technical Overview, the art of the Scale, and the Cloud

Hans Zaunere, Managing Member

WordCamp Indonesia 2010

January 30th, 2010

Page 2: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 2

Overview

• The Technology Behind WordPressHow Things Actually Fit Together

• Can WordPress Do That?Customization and Large-Scale Deployments

• Pressing Words – Scaling and the CloudWordPress is Part of the AMP Family

WordPress as a Modern Web Application

Page 3: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 3

WordPress Technical Overview

• An AMP application – one of many– AMP = Apache/MySQL/PHP– One of the most popular platforms on the web today– Enables the blogosphere by providing attainable web technology

• AMP is used for…– Intranets, corporate sites, e-commerce, web services– Blogs, social networks, CMSs– Facebook, Yahoo, NY Times– … and much, much, much, MUCH, more

In Good Company

Page 4: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 4

Architectural Overview

• AMP: Acronym for three key software components• Basis of modern, dynamic, web/internet applications

Apache/MySQL/PHP: The Cartel

“More internet applications speak PHP than any other”

Apache Provides the transit

MySQL Provides the data

PHP Provides the processing – the “glue”

Page 5: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 5

PHP Language Overview

• The programming language WordPress is written in– “...a widely-used open source general-purpose scripting

language that is especially suited for web development and can be embedded into HTML”

– Borrows from other languages – mostly C, Perl and Java

• For your themes – "embedded into HTML"– Allows dynamic generation of content– The non-HTML part of WordPress themes– Those annoying <?php and ?> tags

• For your plug-ins – "general-purpose scripting language"– The programming logic– Connects databases, RSS feeds, and other data sources

PHP is the PHP: Hypertext Preprocessor

Page 6: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 6

Working on the Web - HTTP

• Apache is designed to handle HTTP communication– HTTP is the HyperText Transfer Protocol, used for exchanging

information on the WWW– Apache provides the runtime for processing requests and

providing WordPress' response

Web Server – Trafficking Partner

Page 7: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 7

Working on the Web - HTML

• PHP is designed to process hypertext (templates)– HTML is the HyperText Markup Language– Gives structure to the data contained in the WordPress database

HTML – The “Goods”

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"....><html> <head> <title>Hello World</title> </head> <body> <b> <?php echo 'Hello World!'; ?> </b> <?php echo 'At the tone, the time will be: '.date('r'); ?> </body></html>

Page 8: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 8

Working on the Web - SQL

• PHP is designed to communicate with databases– ...and other data sources...

– SQL is the Simple Query Language, used for manipulating and retrieving WordPress data (user information, posts, etc)

• SQL is also used for complex or “relational” data

MySQL – The “Supplier”

SELECT ID FROM wp_users WHERE user_login = 'username'

SELECT ID,meta_value FROM wp_users,wp_usermeta WHERE user_id=ID AND user_login = 'username'

Page 9: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 9

Putting It All Together

• Web browser uses HTTP to make web server request• Apache passes control to PHP

which in turn executes WordPresscode to understand how to respond

• Often this means running a database query

Your Cast and Crew – Apache / MySQL / PHP

<?php

$Result = mysql_query("SELECT post_title,DATE_FORMAT(post_date,'%M, %D, %Y') AS post_date FROM wp_posts WHERE category='4',$MYDBR);

$ResultCount = mysql_num_rows($Result);$ResultArray = array();

for( $i = 0; $i < $ResultCount; ++$i ){ $ResultArray[$i] = mysql_fetch_assoc($Result);}?>

Page 10: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 10

• PHP manipulates returned data and generates HTML

• PHP and the web server use HTTPto respond

• Web browser receivesHTML and displays theresults

<!DOCTYPE...><ul> <?php foreach( $ResultArray as $Key => $Row ): ?> <li><?=$Row[post_title']?> (<?=$Row['post_date']?>)</li> <?php endforeach; ?></ul>

Putting It All TogetherThe Finale

Page 11: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 11

• Volunteer organization for women interested in technology

• Over 40 chaptersworldwide

• Considerations– Each chapter to

have it's own blog– Support multiple-users and permissions per chapter– Unified platform to share and aggregate information

• Deployment and customization of WordPress MU

www.girlsintech.netA Case Study in Complexity

Page 12: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 12

• High profile media company• Dozens of blogs covering

various topics• Requirements

– Frequent huge spikes in traffic– Keep unified online look and feel– Integrate with other web properties for consistent online

experience

• Utilizes large server farms in the cloud for scalability• Customization of HTML and PHP code

www.nytimes.com/blogs/A Case Study in Traffic

Page 13: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 13

Scaling into the Cloud

• WordPress is another AMP application – so…– It can be deployed onto cloud servers– Configure and install once – deploy multiple times– Manage from a single interface– Scale by adding servers

• Multi-Tenant– One web server hosting multiple blogs using virtual hosting

• Single-Tenant– One operating system instance hosting a single blog

• MU (multi-user)– WordPress MU provides multiple blogs from single server

How WP Storms the Cloud…

Page 14: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 14

Scaling into the Cloud

• WordPress is another AMP application – so…– The database is a bottleneck and the hardest to scale– Caching can help but…– … as writes increase (comments, new posts, multiple users)…– … the database becomes strained and caching is ineffective

• Keep things optimized– Consider performing query analysis and adding indexes– Fine-tune database settings– Custom code or query to avoid pressure points

• Keep things clean– Optimize your stack and save as an image in the cloud– Minimize plug-ins – the less code the better

…or are Those Storm Clouds?

Page 15: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 15

Conclusions

• WordPress is an AMP application– Uses Apache / MySQL / PHP– Benefits from the same service as any other AMP app

• Utilizing the cloud gives flexibility and options - but…– Customizations and optimizations are still needed– High traffic /High complexity always requires special attention

• No single silver-bullet – cloud or anything else– Hire skilled PHP engineers -

specific experience a plus but not required

Engineer the right WordPress solution

Page 16: Pressing Words with a Cloud: WordPress Technical Overview, the art of the Scale, and the Cloud

www.nyphp.com / www.nyphp.org

04/11/23 16

Thank You

[email protected]

For renowned worldwide online support, New York PHP Mailing Listsare free and available to anyone:

http://www.nyphp.org/Mailing-Lists