Upload
mustafa-uysal
View
774
Download
5
Embed Size (px)
Citation preview
Mustafa Uysal
@m_uysl blog.uysalmustafa.com
#phpkonf
WordPress ile
Büyük Ölçekli Siteler
Ben Kimim?• Yazılım Geliştirici
(Nefis Yemek Tarifleri)
• Kurucu (SKOP)
• WordPress Geliştirici(Plugin | Çeviri | Core)
• Yazar @wpnotlari
1 Numaralı CMS
Genel Kullanım: %26,4
CMS: %59,4
http://w3techs.com/technologies/details/cm-wordpress/all/all
Kimler Kullanıyor
Büyük Ölçek
• 12 M+ tekil ziyaretçi (ay) • 500K+ iOS yüklenme • 2M+ Android yüklenme • 6M+ sayfa gösterimi (peak)
• 6M+ app screen view (gün)
Büyük Ölçek
• 40+ eklenti • ~2M wp_posts • ~200K Tarif • Toplam 50M Kayıt • 12G+ Veritabanı
Nelerle
• Load Balancer (HAProxy + KeepAlived) • Varnish • Web Server (Apache + Nginx) • MySQL (1 Master, 3 Slave)
• Memcached • Elasticsearch • RabbitMQ • MongoDB
http://stackshare.io/nefisyemektarifleri-com/nefisyemektarifleri
HAProxy + Keepalived
• Giriş yapmamış kullanıcılar • Dogpile etkisi • Çok RAM az CPU
https://github.com/dreamhost/varnish-vcl-collection
https://wordpress.org/plugins/varnish-http-purge
Web Sunucuları• Apache • Nginx • Gereksiz modulleri kaldır • mod_php yerine php-fpm kullanın • mpm/php-fpm konfigurasyonu
• StartServers /pm.start_servers • MaxClients /pm.max_children • MinSpareServers /pm.min_spare_servers • MaxSpareServers /pm.max_spare_servers
MySQL Sunucuları
• Güncel Sürüm MySQL
•InnoDB kullan • tmpdir icin tmpfs • ince ayar
• query_cache_size • max_connections • innodb_buffer_pool_size • thread_cache_size
Elasticsearch
• MySQL’e göre çok hızlı • Gelişmiş Arama • Tavsiye yazılar • Arşiv sayfaları • ElasticPress
• WP_Query => Elasticsearch port
https://github.com/10up/ElasticPress
• 300k arama/gün • 2 Server • Gelen: 70mbps • Giden 200mbps
RabbitMQ
• ASYNC işler • Mail bildirimleri • Push bildirimleri
• WP-CLI Worker
CACHE ALL THE THINGS!
Cache
• Performans • Kullanıcı memnuniyeti • Bot memnuniyeti • Sunucu memnuniyeti • Düşük maliyet
Cache Tipleri
• Opcode Caching • Full Page Caching • Object Caching • Fragment Caching
Opcode Caching
• APC • XCache • Zend Opcache
•OPcache (php 5.5+)
Full Page Caching
• Varnish • Batcache • WP Super Cache • W3 Total Cache • nginx microcaching
Object Caching
define('WP_CACHE', true);
Object Caching• Redis • Memcached • Transients API
• set_transient • get_transient
• Object Cache API • wp_cache_set • wp_cache_get
https://wordpress.org/plugins/memcached/
https://wordpress.org/plugins/wp-redis/https://wordpress.org/plugins/memcached-redux/
Fragment Caching
• Kullanıcıya özel • TTL
https://gist.github.com/markjaquith/2653957
CDN
• Datacenter dışındaki cache • 100TB /ay • Minimum hop • Minimum origin request
İpuçları
• Master/Slave • Write/Read • multisite
MySQL Operasyonları
• Uzun süren işlemler (5s+) • Mümkünse gece
WP-CLI
• Bulk işlemler • Kendi komutlarımızı
yazabiliyoruz • multisite destekler
wp-cli.org
• Cache grupları farklı makinelere bölünebilir
• Pre-warm caching => Cron • lock mekanizması
Dogpile Etkisi
WP_Query Parametreleri
• Task Runner (gulp/grunt) • CSS ve JS sıkıştır • CSS ve JS birleştir
• Görsel optimizasyonu • Lazy Load • HTTP 2
HTTP İsteğini Düşür
• PHP 5.2.4 bağlayıcı değil • MVC zorlamanın alemi yok • WordPress Code Standardı
PHP Yazarken
https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/
Eklentiler 40k+ Eklenti Code review Yüksek trafik için yazılmiyor
Güncellemeler
Core Minor’u bekle Code review, neler değişmiş? Database Upgrade Localde uygula (defalarca)
define('WP_DEBUG', true);define('WP_DEBUG_LOG', true);define('SAVEQUERIES', true);
Debug
https://wordpress.org/plugins/query-monitor/
Backup
✦ Eklentiler işe yaramaz ✦ RSYNC ✦ Amazon s3 ✦ Periyodik Dump
Tavsiye Kaynaklar
✦ https://codex.wordpress.org/High_Traffic_Tips_For_WordPress
✦ https://www.scalewp.io/ ✦ https://10up.github.io/Engineering-
Best-Practices/ ✦ https://vip.wordpress.com/plugins/
Sorular?
Mustafa Uysal
@m_uysl blog.uysalmustafa.com
#phpkonf
Teşekkürler
Bize Ulaşın