In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Php engine optimization
6.1.php engine cache optimization
First of all, there are two main factors affecting the efficiency of php. First, libphp5.so needs to compile php source code into opcode tree (opcode); second, php needs to read and write with the database, and the concurrency ability of the database is very low.
So the php cache accelerator is to solve the above first reason, caching opcode content in order to prevent php from repeatedly compiling php code every time it requests, because on high-traffic websites, a large number of repeated compilations will reduce a lot of resources and time events, so the bottleneck here is that the repeated compilation of php not only affects the corresponding speed, but also increases the load on the server, in order to solve this problem. So the php accelerator was born.
To solve the problem between php and mysql, memcache is used, and the cache is set up between php and mysql, which effectively improves the concurrency of the database.
View nginx compilation parameters
/ application/nginx/sbin/nginx-V
View nginx version
/ application/nginx/sbin/nginx-v
View apache version
/ application/apache/bin/apachectl-v
View apache compilation parameters
Cat / application/apache/build/config.nice
View Mysql compilation parameters
Grep CONFIGURE_LINE / application/mysql/bin/mysqlbug
View php compilation parameters
/ application/php/bin/php-I | grep configure
6.1.1 install the php engine cache accelerator
Echo 'export LC_ALL=C' > > / etc/profile
Source / etc/profile
Echo $LC_ALL
Yum install perl-CPAN
(1) eaccelerator
Tar xf eaccelerator-0.9.6.tar.bz2
Cd eaccelerator-0.9.6
/ application/php/bin/phpize
. / configure\
-- enable-eaccelerator=shared\
-- with-php-config=/application/php/bin/php-config
Make
Make install
Make install completion will display such a directory and record it.
Ls / application/php5.3.27/lib/php/extensions/no-debug-zts-20090626/
(2) xcache
Http://xcache.lighttpd.net
/ application/php/bin/phpize
. / configure\
-- enable-xcache\
-- with-php-config=/application/php/bin/php-config
Make
Make install
Note: just install one for xcache and eaccelerator
Php cache acceleration software category
Xcache,eaccelerator,Zend,apc
How to choose
Xcache,eaccelerator is advised to choose one of the two.
Xcache > eaccelerator
Reason:
A.xcache is faster and more efficient
B.xcache development is more active
Opcode cache acceleration software ↑
6.1.2 Database Cache memcache
Php bottleneck:
1. You need to parse the php code.
two。 Need to request the database, and the database concurrency is relatively low.
Solution: set up cache between php and database, memcached (client software)
Server memcached-1.4.3.tar.gz
Client memcache-2.2.5.tgz
Tar xf memcache-2.2.5.tgz
Cd memcache-2.2.5
/ application/php/bin/phpize
. / configure-- with-php-config=/application/php/bin/php-config
Ls / application/php5.3.27/lib/php/extensions/no-debug-zts-20090626/
6.1.3PDO_MYSQL expansion module
The PDO extension defines a lightweight, consistent interface for PHP to access the database, which provides a data access abstraction layer so that no matter what database is used, the query can be executed and the data can be obtained through a consistent function.
Tar xf PDO_MYSQL-1.0.2.tgz
Cd PDO_MYSQL-1.0.2
/ application/php/bin/phpize
. / configure\
-- with-php-config=/application/php/bin/php-config\
-- with-pdo-mysql=/application/mysql
Make
Make install
Ls / application/php5.3.27/lib/php/extensions/no-debug-zts-20090626/
6.1.4 install the image processing program and imagick extension module
BEGIN failed--compilation aborted at Makefile.PL line 24.
Make [1]: * * [PerlMagick/Makefile] Error 2
Make [1]: Leaving directory `/ home/xiaoyi/tools/ImageMagick-6.5.1-2'
Make: * * [all] Error 2
Yum install perl-CPAN-y
Tar xf ImageMagick.tar.gz
Cd ImageMagick-6.5.1-2 /
Make
Make install
Cd..
Tar xf imagick-2.3.0.tgz
Cd imagick-2.3.0
/ application/php/bin/phpize
. / configure-- with-php-config=/application/php/bin/php-config
Make
Make install
[root@apache imagick-2.3.0] # ls / application/php5.3.27/lib/php/extensions/no-debug-zts-20090626/
Eaccelerator.so imagick.so memcache.so pdo_mysql.so
6.1.5 configure the extension
Cp / application/php/lib/php.ini / application/php/lib/php.ini.bak
Vim / application/php/lib/php.ini
819 extension_dir = "/ application/php5.3.27/lib/php/extensions/no-debug-zts-20090626/"
Trailing append
1919;-
1920 extension = memcache.so
1921 extension = pdo_mysql.so
1922 extension = imagick.so
1923;-
Quick copy:
Extension = memcache.so
Extension = pdo_mysql.so
Extension = imagick.so
(1) configure the eaccelerator plug-in
1. Configure the eaccelerator cache directory
Mkdir-p / tmp/eaccelerator
Chown ett / tmp/eaccelerator-R
This directory can be stored in tmpfs memory file system, SSD solid state disk
Cat > > / application/php/lib/php.ini / application/php/lib/php.ini
Finally, through phpinfo (); check that all extensions have been installed
Wget http://blog.zyan.cc/soft/linux/webbench/webbench-1.5.tar.gz
Tar xf webbench-1.5.tar.gz
Cd webbench-1.5
Make
Make install
565 webbench-c 100-t 10 http://bbs.etiantian.org/forum.php
566 webbench-c 200-t 10 http://bbs.etiantian.org/forum.php
567 webbench-c 300-t 10 http://bbs.etiantian.org/forum.php
568 webbench-c 400-t 10 http://bbs.etiantian.org/forum.php
569 webbench-c 500-t 10 http://bbs.etiantian.org/forum.php
570 webbench-c 500-t 30 http://bbs.etiantian.org/forum.php
571 webbench-c 600-t 30 http://bbs.etiantian.org/forum.php
Webbench-c 650-t 30 http://bbs.etiantian.org/forum.php
573 webbench-c 550-t 30 http://bbs.etiantian.org/forum.php
574 webbench-c 520-t 30 http://bbs.etiantian.org/forum.php
575 webbench-c 510-t 30 http://bbs.etiantian.org/forum.php
Forgot to stress test the website before installing eaccelerator--
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.