Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Increase WordPress Performance on the Stack

tjasko
April 06, 2013

Increase WordPress Performance on the Stack

A presentation that was originally shown at WordCamp Miami 2013 by Taylor Jasko (@tjasko) all on how to increased the performance of WordPress on exclusively on the back-end.

tjasko

April 06, 2013
Tweet

Other Decks in Technology

Transcript

  1. End Goal= Make WordPress BLAZING FAST on the Stack SRC:

    http://www.flickr.com/photos/21474493@N02/7967778988/
  2. 1 Make WordPress über fast Handle some HTTP DoS attacks

    2 Have your server work much less 3 All on only one server! 4 . com @tjasko Would you like to...
  3. . com @tjasko Just kiddin’... But things do get slow.

    Let’s see an example of a WP site under heavy load
  4. . com @tjasko Don’t let “script kiddies” take you down.

    SRC: http://www.flickr.com/photos/ lrargerich/3187525211/
  5. How can we fix this? Design a fast stack! SRC:

    http://www.flickr.com/photos/ edenpictures/6556085943/
  6. . com @tjasko The Web server - Apache vs Nginx

    - Apache Nginx Asynchronous-based Multiple connections per thread process-based every connection needs a new thread Both perform Similar under light loads The major difference: memory usage
  7. . com @tjasko “NGINX’s memory and CPU footprints are minimal,

    and predictable. After switching to NGINX the CPU usage on the load balancing servers dropped three times.”
  8. . com @tjasko PHP There’s not much to choose from...

    CGI FastCGI PHP-fpm They are all technically the same thing... just a different implementation.
  9. . com @tjasko MySQL there are few things to keep

    in mind to keep your databases fast.
  10. 1 Use the correct config (small, medium, large, huge??) Try

    to use InnoDB (vs MyISAM) 2 Make sure you are using query caching 3 . com @tjasko make sure that...
  11. . com @tjasko SERVER CONFIG 1 Get your own server

    (dedicated or virtual) Try to use the Linux Kernel v3.2 2 SSDs or RAID is nice... or both ;) 3 Red Hat vs CentOS vs Debian vs... 4
  12. . com @tjasko Is this running on a super powerful

    server? OS: Processor: Memory: Network: Disk: Debian “Squeeze” i7 -2600 8GB DDR3 1 Gigabit Port 2x 1TB SATA2 (s/w raid 1)
  13. worker_processes 8; worker_connections 1024; use epoll; #for kernel 2.6+ multi_accept

    on; sendfile on; tcp_nodelay on; gzip on; gzip_disable "MSIE [1-6].(?!.*SV1)"; gzip_comp_level 3; gzip_proxied any; gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; set_real_ip_from 127.0.0.1; real_ip_header X-Forwarded-For; port_in_redirect off; server_name_in_redirect off; Make Nginx Faster GZIP For Varnish Nginx Config (nginx.conf)
  14. pm = dynamic pm.max_children = 50 pm.start_servers = 15 pm.min_spare_servers

    = 5 pm.max_spare_servers = 25 pm.process_idle_timeout = 60s request_terminate_timeout = 30s process manager Type PHP Config (pool.d/www.conf) limit ON simultaneous requests # OF processes MADE on startup # OF idle processes MAX idle processes TIME TO WAIT TO KILL PROCESS MAX EXECUTION TIME
  15. MYSQL Config (my.conf) Just use the right config /usr/share/doc/mysql- server-5.5/examples

    my-huge.cnf.gz my-large.cnf.gz my-medium.cnf.gz my-small.cnf 1G-2GB RAM MySQL 512MB RAM 128MB RAM & Web Server <= 64M (would not use) . com @tjasko
  16. Also make sure to use query caching . com @tjasko

    query_cache_type=1 query_cache_limit=2M query_cache_size=32M Turns caching on Max size of query to be cached Total size of queries to cache MYSQL Config (my.conf)
  17. Varnish + wordPREss = ❤ 1 default.vcl = http://bit.ly/VarnishVCL DAEMON_OPTS="-a

    :80,:443 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -p thread_pool_add_delay=2 \ -p thread_pools=8 \ -p thread_pool_min=100 \ -p thread_pool_max=4000 \ -s malloc,2G” 2 3 Have Nginx on port 8080, Varnish on 80 . com @tjasko 4 Use the WP-Varnish Plugin bit.ly/wpvarnish
  18. . com @tjasko And you now have a really fast

    wordpress installation! All on just one server
  19. . com @tjasko But it can be even Faster... 1

    Cache WordPress in Memcached with W3 Total Cache 2 Install PHP-APC to cache PHP scripts 3 Try out Nginx pagespeed: http://bit.ly/nginxpagespeed