Tuning ApacheMy SQLPHP Outline Simple Tuning ApacheMy SQLPHP
- Slides: 24
Tuning Apache/My. SQL/PHP
Outline • • • Simple Tuning Apache/My. SQL/PHP 冗 in PHP code 贅 in SQL command 肥 in data set External Tuning Apache/My. SQL/PHP Q&A
Apache – Static pages
Apache – Dynamic Pages
Apache – Life Cycle
Apache – Request Loop
Apache – Tuning in httpd. conf (1) • • Min. Spare. Servers Max. Spare. Servers Start. Servers Max. Clients
Apache – Tuning in httpd. conf (2) Start. Servers pre-fork Min. Spare. Servers Max. Clients
Apache – Tuning in httpd. conf (3) • Remove useless module – diet httpd memory size • Virtual. Host / Error. Log & Custom. Log – for Log Analysis – Log file rotate(+gzip) faster
My. SQL – Tuning (1) • Use my. cnf – my-medium. cnf (128 M) – my-large. cnf (512 M) – my-huge. cnf (1 G-2 G) – my-Custom. cnf (? )
My. SQL – Tuning (2) • Environment – build with WITH_LINUXTHREADS (Free. BSD) – Running on Linux, threading & file system
PHP - Tuning • Apache Module & CGI – Less memory usage • Different CGI/CLI – extensions. ini -> no different (Free. BSD) • Nothing to do? – See Next Slide……
冗 in PHP code (1) if ( isset($_GET[‘do_a’])) { N 1 lines code; } if ( isset($_GET[‘do_b’])) { N 2 lines code; } if ( isset($_GET[‘do_c’])) { N 3 lines code; } ……………; syntax check lines L = N 1+N 2+N 3+…… 每次只執行其中一部分。 if ( isset($_GET[‘do_a’])) { require(‘do_a. php’); } if ( isset($_GET[‘do_b’])) { require(‘do_b. php’); } if ( isset($_GET[‘do_c’])) { require(‘do_c. php’); } ……………; syntax check lines L = 1+1+1+…… 需要的部分才載入來執行。
冗 in PHP code (2)
贅 in SQL command (1) SELECT * FROM cddb JOIN composer; // m x n if ( $cddb[‘cddb_id’] == 1 && $cddb[‘composer_id’] == 2) echo( $cddb[‘composer_name’] ); SELECT * FROM cddb // O(m x n) LEFT JOIN composer ON composer_id=cddb. composer_id; if ( $cddb[‘cddb_id’] == 1 ) echo( $cddb[‘composer_name’] ); SELECT * FROM composer; SELECT * FROM cddb; // n // m if ( $cddb[‘cddb_id’] == 1 ) echo( $composer[$cddb[‘composer_id’]][‘name’] );
贅 in SQL command (2)
肥 in data set (1) qid set index, O(log N) for select 1 SELECT * FROM Q 500 WHERE qid IN (1, 4, 8, 10, …); // select 50 -> 50 * O(log 500) SELECT * FROM Q 1 M WHERE qid IN (1, 4, 8, 10, …); // select 50 -> 50 * O(log 1000000)
肥 in data set (2)
External Tuning - Apache • httpd. conf: Max. Clients MAX value 512 ? • kqueue (Free. BSD) • Redirect to thttpd / lighttpd – For static files
External Tuning - My. SQL • Use the Money – Powerful CPU, more CPU/HT/Core – Much more RAM – Faster I/O Storage
External Tuning - PHP • Operation/Object Code Improvement – Zend Optimizer (www. zend. com) – Turck-MMCache (Source. Forge. net) • Data cache – Memcached (www. danga. com)
- Flavorful sentence
- Present simple past simple future simple test
- Past simple future simple
- Present simple present continuous past simple future simple
- Present continuous past continuous future continuous
- Simple present, simple past, simple future
- Present past future simple continuous exercises
- Future continuous tense vs future simple
- Present simple tense
- Future simple present simple
- Windows xp tuning
- Tuning base de datos sql server
- Tuning protocol
- Ssis optimization
- Sql server 2005 performance monitor
- Open office
- Mainframe mips optimization
- Performance tuning in oracle for beginners
- Klev tuning
- Glusterfs tuning
- Modified schwabach test
- When two tuning forks of 132 hz and 137 hz
- športna predelava vozil
- Apache performance tuning windows
- Rostellar hooklets are shaped like tuning forks