sofia wp user group presentation

22
WordPress Server Optimizations Даниел Канчев WordPress Sofia User Group Февруари 2014

Upload: daniel-kanchev

Post on 09-May-2015

182 views

Category:

Technology


2 download

DESCRIPTION

I used this presentation for the meeting of the WP Sofia User Group during February 2014.

TRANSCRIPT

Page 1: Sofia WP User Group Presentation

WordPress Server Optimizations

Даниел Канчев WordPress Sofia User Group Февруари 2014

Page 2: Sofia WP User Group Presentation

Performance Guru @SiteGround Security Freak Server Migrations Specialist VIP Customer Management FOSS Addict Addicted to extreme sports

Даниел Канчев@dvkanchev

Page 3: Sofia WP User Group Presentation

По-доволни потребители —>> $$$

По-добри позиции в Google/Yandex

По-ниски разходи за web hosting

Защо трябва да оптимизирате?

Page 4: Sofia WP User Group Presentation

Направете план

Page 5: Sofia WP User Group Presentation

Web server setup - Apache or nginx

PHP setup - PHP-FPM, FastCGI, APC

MySQL setup

Object caching - Memcached/Redis

Full page (HTTP) caching - Varnish, nginx

Основни моменти в оптимизацията

Page 6: Sofia WP User Group Presentation

MySQL

Използвайте Percona - http://www.percona.com/

Използвайте tmpfs за MySQL tmpdir - http://goo.gl/UOTjlW

MySQLtuner.pl - http://mysqltuner.pl

Page 7: Sofia WP User Group Presentation

PHP

PHP handlers - DSO, SuPHP/SuExec, FastCGI/PHP-FPM

PHP modules info

Opcode caching, object caching - APC, xCache, Memcached, Redis

Page 8: Sofia WP User Group Presentation

WordPress Interaction with Your Database

First request goes to the database server

Page 9: Sofia WP User Group Presentation

Object Caching

First request goes to the database server

Objects are also stored in Memcached

Page 10: Sofia WP User Group Presentation

Object Caching

All consecutive requests are forwarded to the Memcached server

Page 11: Sofia WP User Group Presentation

Scanning

Lexing

Parsing

Compilation

Opcode

How PHP Works

Execution

Page 12: Sofia WP User Group Presentation

!

Opcode

PHP Opcode Caching

Execution

Page 13: Sofia WP User Group Presentation

Reverse Proxy Servers

Page 14: Sofia WP User Group Presentation

Reverse Proxy Servers

Page 15: Sofia WP User Group Presentation

Reverse Proxy Servers

Page 16: Sofia WP User Group Presentation

Reverse Proxy Servers

Page 17: Sofia WP User Group Presentation

nginx config which works

http://polihronov.wordpress.com/

Page 18: Sofia WP User Group Presentation

Varnish config# Never cache administrator if (req.url ~ "wp-(login|admin)" || req.url ~ "preview=true") { return (pass); } if (req.http.Cookie ~ "(^|;\s*)(wpSGCacheBypass=1)(;|$)") { return(pass); } if (req.http.Cookie ~ "(^|;\s*)wordpress_logged_in_([^;]+)(;|$)") { return(pass); } if (req.http.Cookie ~ "(^|;\s*)(woocommerce_items_in_cart=1)(;|$)") { return(pass); } if (req.http.Cookie ~ "comment_author") { return(pass); } !include "common.vcl"; !return (lookup);

Page 19: Sofia WP User Group Presentation

To CDN or not to CDN ?

Page 20: Sofia WP User Group Presentation

Изводи

Оптимизацията е процес, а не събитие.

Винаги тествайте. Пазете информацията от всички тестове.

Информирайте се от големите акули.

Page 21: Sofia WP User Group Presentation

Полезни линкове

http://highscalability.com/

http://www.mysqlperformanceblog.com/

http://wiki.nginx.org/WordPress

http://velocityconf.com/

Page 22: Sofia WP User Group Presentation

Bash Мерси!@dvkanchev / [email protected]