Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install xcache3.1.2 for php acceleration

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how to install xcache3.1.2 for php acceleration, the article is very detailed, has a certain reference value, interested friends must read it!

1. Introduction

XCache is an open source opcode cache / optimizer, a fast and stable PHP opcode buffer that has been well tested and runs steadily on high-traffic / high-load production machines. It can improve the performance of PHP on your server, it can avoid repetitive compilation process by buffering the compiled PHP data into shared memory, and can directly use buffer compiled code to improve speed. It can usually increase your page generation rate by 2 to 5 times and reduce the server load. The XCache project is led by mOo, who is also a development member of Lighttpd.

Release version of each branch

Current stable version: 3.2.x (fully supports 5.1 ~ 5.6)

XCache 3.2.0.

Demo page: http://xcache.lighttpd.net/demo/

Current stable version: 3.1.x (fully supports 5.1 ~ 5.5)

XCache 3.1.2.

2. Premise: 1.1.Installation of stress testing tool webbench

Webbench can simulate up to 30, 000 concurrent connections to test the load capacity of the website, which is better than the ab stress testing tool that comes with Apache, and is particularly convenient to install and use.

[root@webtools] # wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz[root@webtools]# tar xf webbench-1.5.tar.gz [root@webtools] # cd webbench-1.5 [root@webwebbench-1.5] # make & & make install [root @ webwebbench-1.5] # echo $? 01.2, Add DNS record to native hosts [root@web ~] # vim / etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.0.111 www.25linux.com192.168.0.111 bbs.25linux.com192.168.0.111 blog.25linux.com1.3, Stress testing with webench [root@web] # webbench-c 300-t 30 http://www.25linux.com/Webbench-Simple Web Benchmark 1.5Copyright (c) Radim Kolar 1997-2004 GPLOpen Source Software. Benchmarking: GET http://www.25linux.com/300 clients, running 30 sec. Speed=2940 pages/min, 722666 bytes/sec.Requests: 1470susceed, 0 failed.3, download xcache [root@webtool] # wget http://xcache.lighttpd.net/pub/Releases/3.1.2/xcache-3.1.2.tar.gz4, install [root@webtool] # tar xfxcache-3.1.2.tar.gz [root@webtool] # cd xcache-3.1.2# phpize is used to install php extension module Through phpize, you can build the plug-in module of php [root@web xcache-3.1.2] # / usr/local/php/bin/phpizeConfiguring for:PHP Api Version: 20121113Zend Module Api No: 20121212Zend Extension Api No: 220121212 [root@web xcache-3.1.2] #. / configure--enable-xcache-- with-php-config=/usr/local/php/bin/php-config [root@web xcache-3.1.2] # make & & make install

At the end of the installation, something like the following line appears:

Installing shared extensions: / usr/local/php/lib/php/extensions/no-debug-zts-20121212/

Indicates that the installation is successful!

5. Configure 5.1 to create xcache cache file: [root@webxcache-3.1.2] # touch / tmp/xcache [root@webxcache-3.1.2] # chmod 777 / tmp/xcache5.2 create xcache administrator password: [root@webxcache-3.1.2] # echo-n "12345678" | md5sum e10adc3949ba59abbe56e057f20f883e-remember the above md5 password When configuring later, you will use a 5.3 copy of the xcache daemon to the website root directory: [root@web xcache-3.1.2] # cp-r htdocs/ / usr/local/nginx/html/www/xcache [root@web xcache-3.1.2] # chown nginx:nginx-R / usr/local/nginx/html/xcache5.4 first import the sample configuration provided by xcache into php.ini: [root@web xcache-3.1.2] # cat xcache.ini > > / etc/php.ini5.5 configuration php supports xcache [root@web xcache-3.1.2] # vim / etc/php.ini [xcache-common] extension = xcache.so [xcache.admin] xcache.admin.enable_auth = Onxcache.admin.user = "xcache" xcache.admin.pass = "25d55ad283aa400af464c76d713c07ad" [xcache] xcache.shm_scheme = "mmap" xcache.size = 60Mxcache.count = 1xcache .slots = 8Kxcache.ttl = 0xcache.gc_interval = 0xcache.var_size = 4Mxcache.var_count = 1xcache.var_slots = 8Kxcache.var_ttl = 0xcache.var_maxttl = 0xcache.var_gc_interval = 300xcache.var_namespace_mode = 0xcache.var_namespace = "" Xcache.readonly_protection = Offxcache.mmap_path = "/ tmp/xcache" xcache.coredump_directory = "" xcache.coredump_type = 0xcache.disable_on_crash = Offxcache.experimental = Offxcache.cacher = Onxcache.stat = Onxcache.optimizer = off [xcache.coverager] xcache.coverager = Offxcache.coverager_autostart = Onxcache.coveragedump_directory= "" 5.6 restart httpd service Service [root@webxcache-3.1.2] # service nginx restart [root@webxcache-3.1.2] # service php-fpm restart6, Test:

Browser: enter http://www.25linux.com/xcache, prompt for user name: xcahe, password: 12345678, you can log in

Xcache installed successfully!

7. Stress test [root@web www] # webbench-c 300-t 30 http://www.25linux.com/ # webbench-c concurrency-t run test time URL Webbench-Simple Web Benchmark 1.5Copyright (c) Radim Kolar 1997-2004, GPLOpen Source Software. Benchmarking: GET http://www.25linux.com/300 clients, running 30 sec. Speed=3120 pages/min, 766997 bytes/sec.# response requests per second is 3120, the amount of data transmitted per second is 766997. Compared with the data tested before the installation of xcache, we can see that xcache can improve the access speed of PHP pages. Requests: 1560 susceed, 0 failed.

Add:

Stress and performance testing should be put before the product launch, not after the launch.

When testing, concurrency should be gradually increased from small to small, for example, when concurrency is 100, observe how much the load of the website is, whether the opening of the page is smooth, how much is the concurrency of 200, what is the concurrency when the website is slow to open, and how much is the concurrency when the website cannot be opened.

More detailed testing of a page, such as e-commerce sites can focus on testing shopping carts, promotion pages, etc., because these pages account for a large proportion of the total site visits.

Note: when webbench does stress and performance testing, the software itself will consume CPU and memory resources. In order to test accurately, it is recommended that webbench be installed on other servers to achieve more accurate test data.

The above is all the contents of the article "how to install xcache3.1.2 for php acceleration". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report