About Yii's method to improve the performance optimization of concurrent numbers

不言
Release: 2023-04-02 22:34:02
Original
2815 people have browsed it

This article mainly introduces the performance optimization method of Yii to improve the number of concurrency. It has a certain reference value. Now I share it with you. Friends in need can refer to it

  1. Turn on YII's APC cache

  • Add under the config/main.php components component:

     'apccache'=>array(
                'class'=>'system.caching.CApcCache'
          ),
    Copy after login
  • Download php_apc.dll, file Put it under php/ext, it may be more troublesome to search....

  • Add the php_apc extension in php.ini:

     extension=php_apc.dll
     apc.rfc1867 = on
     capc.max_file_size = 100M
     upload_max_filesize = 100M
     post_max_size = 100M
    Copy after login

    Restart apache, use Function info(), check whether there is apc extension.

  • Usage:

        Yii::app()->apccache->get(id);
        Yii::app()->apccache->set(id,value,time);
    Copy after login

2. Use yiilite.php
Import yii.php into the entry file index.php , change to introduce yiilite.php

<?php
    error_reporting(E_ERROR);
    $config = dirname(__FILE__) . &#39;/protected/config/main.php&#39;;
    defined(&#39;YII_DEBUG&#39;) or define(&#39;YII_DEBUG&#39;, false);
    defined(&#39;YII_TRACE_LEVEL&#39;) or define(&#39;YII_TRACE_LEVEL&#39;, 3);
    //require_once &#39;../../xq_cgi-yii/framework/yii.php&#39;;
    require_once &#39;../../xq_cgi-yii/framework/yiilite.php&#39;;
    Yii::createWebApplication($config)->run();
Copy after login

Note:

  • Open apc cache and then introduce yiilite.php, because there are some classes in this file that are not currently used will also be loaded in.

  • If apc cache is not turned on, website performance will be reduced.

The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

yii2’s preventive measures against csrf attacks

The above is the detailed content of About Yii's method to improve the performance optimization of concurrent numbers. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
yii
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!