Update tutorial-performance-tuning.md

This commit is contained in:
崔亮
2018-11-17 17:44:35 +08:00
committed by GitHub
parent 0d48209adf
commit e859b812b5

View File

@@ -132,8 +132,8 @@ CREATE TABLE session (
但是请注意,某些缓存的存储当达到存储限制会清除缓存数据。出于这个原因,你应主要在不存在存储限制时才使用这些缓存存储。 但是请注意,某些缓存的存储当达到存储限制会清除缓存数据。出于这个原因,你应主要在不存在存储限制时才使用这些缓存存储。
如果你的服务器支持 [Redis](http://redis.io/),强烈建议你通过使用 [[yii\redis\Session]] 来作为会话存储。 如果你的服务器支持 [Redis](http://redis.io/),强烈建议你通过使用 [[yii\redis\Session]] 来作为会话存储。
If you have [Redis](http://redis.io/) on your server, it is highly recommended you use it as session storage by using 如果您的服务器上有 [Redis](http://redis.io/)
[[yii\redis\Session]]. 强烈建议您使用 [[yii\redis\Session]] 作为会话存储。
## 优化数据库 <span id="optimizing-databases"></span> ## 优化数据库 <span id="optimizing-databases"></span>
@@ -187,6 +187,11 @@ class PostController extends Controller
composer dumpautoload -o composer dumpautoload -o
``` ```
另外,您可以考虑使用
[authoritative class maps](https://getcomposer.org/doc/articles/autoloader-optimization.md#optimization-level-2-a-authoritative-class-maps)
和 [APCu 缓存](https://getcomposer.org/doc/articles/autoloader-optimization.md#optimization-level-2-b-apcu-cache)。
请注意,这两种选择可能适用于您的特定情况,也可能不适合您。
## 处理离线数据 <span id="processing-data-offline"></span> ## 处理离线数据 <span id="processing-data-offline"></span>
@@ -215,6 +220,6 @@ composer dumpautoload -o
- [XHProf](http://www.php.net/manual/en/book.xhprof.php) - [XHProf](http://www.php.net/manual/en/book.xhprof.php)
- [XDebug profiler](http://xdebug.org/docs/profiler) - [XDebug profiler](http://xdebug.org/docs/profiler)
## Prepare application for scaling ## 准备扩展应用程序
When nothing helps you may try making your application scalabe. A good introduction is provided in [Configuring a Yii2 Application for an Autoscaling Stack](https://github.com/samdark/yii2-cookbook/blob/master/book/scaling.md). For further reading you may refer to [Web apps performance and scaling](http://thehighload.com/). 当没有任何帮助时,您可以尝试使您的应用程序可扩展。[Configuring a Yii2 Application for an Autoscaling Stack](https://github.com/samdark/yii2-cookbook/blob/master/book/scaling.md) 中提供了一个很好的介绍。有关进一步阅读,请参阅 [Web apps performance and scaling](http://thehighload.com/).