Smarty impact on Web page performance--Turn on Opcache

Source: Internet
Author: User

In the previous article "Smarty on the impact of Web page performance", the default does not open Opcache, so I installed a zend opcache extension, re-experiment, the results are as follows:

Have Smarty

Using Apache's AB command for stress testing, concurrent with 10, is not large, while using the SAR command to calculate the CPU utilization. The command is as follows:

./ab-c 10-n 100000 http://cq01-rdqa-dev072.cq01.baidu.com:8008/index.php

Sar-u 2 >/tmp/smarty.sar &

CPU utilization is counted every 2 seconds, fetch 23 rows of data, average later, cpu idle = 86.8535%, that is, the average CPU utilization is 13.1%, save 19.7% than not turn on Opcache

Collected 100,000 execution time logs with an average execution time of 0.000784178 seconds, saving about 10 milliseconds compared to Opcache.

The AB command shows the requests per second:2104.07 [#/sec] (mean), which increases by 1306 than does not turn on Opcache

No Smarty

CPU utilization is counted every 2 seconds, fetch 40 rows of data, average later, cpu idle = 92.8845%, that is, the average CPU utilization is 7.1%, save 2% than not turn on Opcache

200,000 execution time logs were collected, with an average execution time of 8.63295e-05 seconds, or 86.3296 microseconds, saving 93 microseconds compared to not turning on Opcache.

The AB command shows the requests per second:2478.31 [#/sec] (mean), which increases by 152 than does not turn on Opcache

Conclusion: It can be found that, after opening opcache, there are smarty cases, the performance has obvious improvement, can be said to be doubled. 20% increase in CPU without smarty, 50% savings in execution time

Without smarty, the number of lines of code is less, with dozens of rows, so the elevation is not obvious. There are smarty cases where the number of lines of code is more, plus the cache, so it is obvious.

In the case of opening opcache, there is a significant difference between smarty and smarty performance.

Smarty impact on Web page performance--Turn on Opcache

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.