介绍
我们运行大量的TYPO3 7.6和TYPO3 10.4安装仅作为前端应用程序的后端。我们编写了几个中间件和 extbase 插件来管理我们的数据。
问题
从TYPO3 7.6迁移到TYPO3 10.4后,一般执行性能明显变慢。例如登录前端用户。TYPO3 7.6与PHP 7.0一起运行,TYPO3 10.4与PHP 7.4一起运行。
PHP 性能测试
首先,我用一个小的基准脚本测试了 PHP 的一般性能。结果是,PHP 7.4比 PHP 7.0快 30%左右。我在同一硬件上使用 docker 容器在本地进行了此测试。操作码缓存已启动并正在运行。
因此,使用 PHP 7.4,TYPO3 的执行速度应该提高 30%。但事实并非如此。它更慢。
TYPO3 性能测试
所以我用TYPO3 7.6 LTS、TYPO3 10.4 LTS和TYPO3 11.1进行了几次性能测试。一般的执行速度差别很大。我为这 3 个版本安装了标准 TYPO3,只添加了一个登录表单并测量响应时间。
TYPO3 版本 | 行动 | 响应时间(毫秒) | 时间比 TYPO3 7.6 慢 |
---|---|---|---|
7.6 | 前端用户登录 | 185 | |
10.4 | 前端用户登录 | 759 | 4.1 |
11.1 | 前端用户登录 | 802 | 4.3 |
7.6 | 前端用户注销 | 26 | |
10.4 | 前端用户注销 | 185 | 7.2 |
11.1 | 前端用户注销 | 187 | 7.3 |
所有动作连续运行5次并计算平均值。
问题
- 我怎么能理解这种行为?在 PHP 方面,我的速度提高了 30%,但 TYPO3 获得了一切,并且需要更多资源来执行相同的操作。
- 加速 TYPO3 10.4 或 11.1 的选项有哪些?
- TYPO3 和/或 PHP 设置中是否有配置选项以获得更好的性能?
非常感谢您的每一个提示或提示。
更新
这是精确测量的设置和描述。
TYPO3 7.6.32
软件版本
Ubuntu 18.04 / Apache 2.4.29 / MariaDB 10.1.44 / PHP 7.0.33
核心 PHP 设置
max_execution_time: 240
max_input_time: 60
max_input_vars: 1500
memory_limit: 512M
xdebug: Off
Zend OPcache PHP 设置
Opcode Caching: Up and Running
Optimization: Enabled
SHM Cache: Enabled
File Cache: Disabled
Startup: OK
Shared memory model: mmap
Cache hits: 9544
Cache misses: 694
Used memory: 23044360
Free memory: 44064504
Wasted memory: 0
Interned Strings Used memory: 2361632
Interned Strings Free memory: 1832672
Cached scripts: 686
Cached keys: 1356
Max keys: 3907
OOM restarts: 0
Hash keys restarts: 0
Manual restarts: 0
Zend OPcache 指令
opcache.blacklist_filename: no value
opcache.consistency_checks: 0
opcache.dups_fix: Off
opcache.enable: On
opcache.enable_cli: Off
opcache.enable_file_override: Off
opcache.error_log: no value
opcache.fast_shutdown: 0
opcache.file_cache: no value
opcache.file_cache_consistency_checks: 1
opcache.file_cache_only: 0
opcache.file_update_protection: 2
opcache.force_restart_timeout: 180
opcache.huge_code_pages: Off
opcache.inherited_hack: On
opcache.interned_strings_buffer: 4
opcache.lockfile_path: /tmp
opcache.log_verbosity_level: 1
opcache.max_accelerated_files: 2000
opcache.max_file_size: 0
opcache.max_wasted_percentage: 5
opcache.memory_consumption: 64
opcache.optimization_level: 0x7FFFBFFF
opcache.preferred_memory_model: no value
opcache.protect_memory: 0
opcache.restrict_api: no value
opcache.revalidate_freq: 2
opcache.revalidate_path: Off
opcache.save_comments: 1
opcache.use_cwd: On
opcache.validate_permission: Off
opcache.validate_root: Off
opcache.validate_timestamps: On
安装
composer create-project "typo3/cms-base-distribution:^7.6" my-new-project
设置:创建空白页面
激活
关于/aboutmodules/backend/belog/beuser/context_help/core/cshmanual/extbase/extensionmanager/felogin/filelist/fluid/fluid_styled_content/form/frontend/impexp/info/info_pagetsconfig/install/lang/recordlist/rsaauth/rtehtmlarea/的扩展saltedpasswords/调度程序/设置/sv/sys_note/t3editor/t3skin/tstemplate/typo3_console/viewpage
设置
Configuration presets > Debug settings: Live
All configurations: [FE][loginSecurityLevel] = normal
设置
1.更新根TypoScript模板的设置
page = PAGE
page.100 < styles.content.get
2. 为 fe_users 创建文件夹
3. 创建网站用户组
- 组名:测试
4.创建网站用户
- 用户名:test
- 密码:[密码]
- 组:测试
5.首页添加登录表单
测量响应时间
使用 Postman 向 TYPO3 发送请求。
登录
POST http://typo3-76-standard.localhost/ 正文
(x-www-form-urlencoded)
- 用户:测试
- 通行证:[密码]
- PID:[feUserPid]
- 登录类型:登录
登出
POST http://typo3-76-standard.localhost/ 正文
(x-www-form-urlencoded)
- 登录类型:注销
TYPO3 10.4.15
软件版本
Ubuntu 18.04 / Apache 2.4.29 / MariaDB 10.3.22 / PHP 7.4.16
核心 PHP 设置
max_execution_time: 240
max_input_time: 60
max_input_vars: 1500
memory_limit: 1024M
xdebug: Off
Zend OPcache PHP 设置
Opcode Caching: Up and Running
Optimization: Enabled
SHM Cache: Enabled
File Cache: Disabled
Startup: OK
Shared memory model: mmap
Cache hits: 71894
Cache misses: 1146
Used memory: 34302304
Free memory: 99899120
Wasted memory: 16304
Interned Strings Used memory: 3942240
Interned Strings Free memory: 2348768
Cached scripts: 1120
Cached keys: 2146
Max keys: 16229
OOM restarts: 0
Hash keys restarts: 0
Manual restarts: 0
Zend OPcache 指令
opcache.blacklist_filename: no value
opcache.consistency_checks: 0
opcache.dups_fix: Off
opcache.enable: On
opcache.enable_cli: Off
opcache.enable_file_override: Off
opcache.error_log: no value
opcache.file_cache: no value
opcache.file_cache_consistency_checks: On
opcache.file_cache_only: Off
opcache.file_update_protection: 2
opcache.force_restart_timeout: 180
opcache.huge_code_pages: Off
opcache.interned_strings_buffer: 8
opcache.lockfile_path: /tmp
opcache.log_verbosity_level: 1
opcache.max_accelerated_files: 10000
opcache.max_file_size: 0
opcache.max_wasted_percentage: 5
opcache.memory_consumption: 128
opcache.opt_debug_level: 0
opcache.optimization_level: 0x7FFEBFFF
opcache.preferred_memory_model: no value
opcache.preload: no value
opcache.preload_user: no value
opcache.protect_memory: Off
opcache.restrict_api: no value
opcache.revalidate_freq: 2
opcache.revalidate_path: Off
opcache.save_comments: On
opcache.use_cwd: On
opcache.validate_permission: Off
opcache.validate_root: Off
opcache.validate_timestamps: On
安装
composer create-project "typo3/cms-base-distribution:^10.4" my-new-project
设置:创建空白页面
设置
Configuration presets > Debug settings: Live
Feature Toggles > Felogin extbase: Off
设置
1.更新根TypoScript模板的设置
page = PAGE
page.100 = CONTENT
page.100 {
table = tt_content
select {
orderBy = sorting
where = {#colPos}=0
}
}
2. 为 fe_users 创建文件夹
3. 创建网站用户组
- 组名:测试
4.创建网站用户
- 用户名:test
- 密码:[密码]
- 组:测试
5.首页添加登录表单
测量响应时间
使用 Postman 向 TYPO3 发送请求。
登录
POST http://typo3-104-standard.localhost/ 正文
(x-www-form-urlencoded)
- 用户:测试
- 通行证:[密码]
- PID:[feUserPid]
- 登录类型:登录
登出
POST http://typo3-104-standard.localhost/ 正文
(x-www-form-urlencoded)
- 登录类型:注销
TYPO3 11.1.1
软件版本
Ubuntu 18.04 / Apache 2.4.29 / MariaDB 10.3.22 / PHP 7.4.15
核心 PHP 设置
max_execution_time: 240
max_input_time: 60
max_input_vars: 1500
memory_limit: 1024M
xdebug: Off
Zend OPcache PHP 设置
Opcode Caching: Up and Running
Optimization: Enabled
SHM Cache: Enabled
File Cache: Disabled
Startup: OK
Shared memory model: mmap
Cache hits: 71894
Cache misses: 1146
Used memory: 34302304
Free memory: 99899120
Wasted memory: 16304
Interned Strings Used memory: 3942240
Interned Strings Free memory: 2348768
Cached scripts: 1120
Cached keys: 2146
Max keys: 16229
OOM restarts: 0
Hash keys restarts: 0
Manual restarts: 0
Zend OPcache 指令
opcache.blacklist_filename: no value
opcache.consistency_checks: 0
opcache.dups_fix: Off
opcache.enable: On
opcache.enable_cli: Off
opcache.enable_file_override: Off
opcache.error_log: no value
opcache.file_cache: no value
opcache.file_cache_consistency_checks: On
opcache.file_cache_only: Off
opcache.file_update_protection: 2
opcache.force_restart_timeout: 180
opcache.huge_code_pages: Off
opcache.interned_strings_buffer: 8
opcache.lockfile_path: /tmp
opcache.log_verbosity_level: 1
opcache.max_accelerated_files: 10000
opcache.max_file_size: 0
opcache.max_wasted_percentage: 5
opcache.memory_consumption: 128
opcache.opt_debug_level: 0
opcache.optimization_level: 0x7FFEBFFF
opcache.preferred_memory_model: no value
opcache.preload: no value
opcache.preload_user: no value
opcache.protect_memory: Off
opcache.restrict_api: no value
opcache.revalidate_freq: 2
opcache.revalidate_path: Off
opcache.save_comments: On
opcache.use_cwd: On
opcache.validate_permission: Off
opcache.validate_root: Off
opcache.validate_timestamps: On
安装
composer create-project "typo3/cms-base-distribution:^11" my-new-project
设置:创建空白页面
设置
Configuration presets > Debug settings: Live
设置
1.更新根TypoScript模板的设置
page = PAGE
page.100 = CONTENT
page.100 {
table = tt_content
select {
orderBy = sorting
where = {#colPos}=0
}
}
2. 为 fe_users 创建文件夹
3. 创建网站用户组
- 组名:测试
4.创建网站用户
- 用户名:test
- 密码:[密码]
- 组:测试
5.首页添加登录表单
测量响应时间
使用 Postman 向 TYPO3 发送请求。
登录
POST http://typo3-111-standard.localhost/ 正文
(x-www-form-urlencoded)
- 用户:测试
- 通行证:[密码]
- PID:[feUserPid]
- 登录类型:登录
登出
POST http://typo3-111-standard.localhost/ 正文
(x-www-form-urlencoded)
- 登录类型:注销