Для начала начну с того, что после вот этого поста:
http://alexrayu.com/blog/drupal-739-vs-drupal-8-rc1-performance
Я был очень удивлен комментариям, процитирую:
Wim Leers написал:
You conveniently fail to mention two things in the blog post:
1. You compare Drupal 8's out-of-the-box performance with a tweaked Drupal 7: you enabled the page cache.
2. Drupal 7's page cache is inferior: a) no instantaneous updates; b) any node or comment posted causes the entire page cache to be cleared (!); c) many user actions that cause the page to change do not invalidate the page cache, so stale content continues to be sent.
In other words, Drupal 7's page cache:
- shows stale content, hence the site appears broken to the site owner
- is cleared in its entirety and thus far less effective
Hence this is an apples-to-oranges comparison.
A Drupal 8 site with the Page Cache enabled is functionally equivalent to a Drupal 7 site with Page Cache disabled. Make that comparison instead, and the chart will look vastly different.
Wim Leers написал:
Claiming every tutorial recommends this does not make this comparison correct. Only bad articles say "Enable page cache.", good articles say "Enable page cache, but know that it comes with disadvantages X, Y and Z." — i.e. they provide the necessary nuance.
If you simply refuse to compare things correctly or even call out the necessary nuances, fine, then there is nothing else I can say.
Если коротко, то вы не то и не так сравниваете. Очень много слов что сравнивать работу кеша Drupal 7 и кеша Drupal 8 не верно, так как они предоставляют разные данные.
Окей. Давайте сделаем "правильно":
- установил Drupal 7.
- набил в него контента через devel generate
- мигрировал это все дело на drupal 8
- параметры хостинга: CPU E5-1650 v3 @ 3.50GHz, php_memory_limit = 512M, HW SSD RAID 5, Innodb database. xcache opcode. php-5.6
В итоге получилось 2 такие вот страницы:
http://drupal7.drupal-site.net/node/199
http://drupal8.drupal-site.net/node/199
Если вы посмотрите исходник HTML в самом конце вы увидите данные которые я буду приводить ниже.
Эти данные генерируются на уровне php, специально разработанным модулем php.
Тест 1. Cтраница материала 199 под авторизированым пользователем.
Drupal 7 сайт с отключеным кешированием. , авторизация под админом
Drupal 8 c включенным кешированием, авторизация под обычным пользователем
Drupal 7
queries total:
222
select:
221
insert:
0
update:
1
other:
0
memory peak:
5.25 Mb
execution time : 130.570 ms
queries time : 7.706 ms
utime: 120.981 ms
stime: 6.000 ms
oublock: 0
inblock: 0
profiler_time: 18.943 ms
profiler_time_before call: 14.068 ms
profiler_time_after call: 4.875 ms
Drupal8
Summary:
queries total:
125
select:
125
insert:
0
update:
0
other:
0
memory peak:
16.75 Mb
execution time : 152.216 ms
queries time : 1.403 ms
utime: 141.978 ms
stime: 7.999 ms
oublock: 0
inblock: 0
profiler_time: 18.522 ms
profiler_time_before call: 14.900 ms
profiler_time_after call: 3.621 ms
Итог: Drupal 8 150ms и Drupal 7 130ms
Напоминаю у Drupal 7 отключен кеш для "честного сравнения".
Теперь все тоже, но под анонимным пользователем.
Тест 2. эта страница под анонимным пользователем.
Drupal 7 сайт с отключеным кешированием.
Drupal 8 c включенным кешированием
Drupal 7
queries total:
181
select:
181
insert:
0
update:
0
other:
0
memory peak:
4.50 Mb
execution time : 110.098 ms
queries time : 5.157 ms
utime: 99.985 ms
stime: 7.998 ms
oublock: 0
inblock: 0
profiler_time: 17.804 ms
profiler_time_before call: 12.630 ms
profiler_time_after call: 5.174 ms
Drupal 8
queries total:
3
select:
3
insert:
0
update:
0
other:
0
memory peak:
2.75 Mb
execution time : 12.615 ms
queries time : 0.034 ms
utime: 9.999 ms
stime: 2.000 ms
oublock: 0
inblock: 0
profiler_time: 0.506 ms
profiler_time_before call: 0.417 ms
profiler_time_after call: 0.089 ms
Но при этом контент появился не сразу... и после разбирательств я нашел запрос на
http://drupal8.drupal-site.net/history/199/read
queries total:
23
select:
22
insert:
0
update:
1
other:
0
memory peak:
7.00 Mb
execution time : 33.361 ms
queries time : 0.212 ms
utime: 24.996 ms
stime: 8.999 ms
oublock: 0
inblock: 0
profiler_time: 2.847 ms
profiler_time_before call: 2.277 ms
profiler_time_after call: 0.571 ms
Итог: Drupal 8 12+33 = 45ms и Drupal 7 110ms
Напоминаю у Drupal 7 отключен кеш для "честного сравнения".
А теперь попробуем небольшой модуль render_boost
По сути это кеш рендеринга. А значит данные актуальные при отображении.
Доступно для теста тут: http://rb.drupal7.drupal-site.net/node/199
Тест 1. Авторизированный.
queries total:
183
select:
182
insert:
0
update:
1
other:
0
memory peak:
5.00 Mb
execution time : 61.199 ms
queries time : 8.722 ms
utime: 53.992 ms
stime: 1.999 ms
oublock: 0
inblock: 0
profiler_time: 7.444 ms
profiler_time_before call: 4.981 ms
profiler_time_after call: 2.463 ms
Тест 2. Анонимный
queries total:
141
select:
140
insert:
1
update:
0
other:
0
memory peak:
4.50 Mb
execution time : 52.414 ms
queries time : 5.385 ms
utime: 47.993 ms
stime: 2.000 ms
oublock: 0
inblock: 0
profiler_time: 6.931 ms
profiler_time_before call: 4.675 ms
profiler_time_after call: 2.256 ms
Итого сделаем табличку результата:
Инсталляция тест 1 (авторизированый) тест 2 (аноним)
Drupal 7 no cache 130ms 110ms
Drupal8 cache enabled 150ms 45ms
Drupal 7 + render boost 60ms 52ms
Комментарии к цифрам теста: Я делал по несколько запросов, чтоб дать возможность разогреться opcode cache, drupal cache и render_boost кешу и выбирал лучшую цифру из нескольких запросов. Суть теста показать возможности системы кеширования Drupal 7, Drupal 8 и Drupal 7 + render_boost в приблизительных цифрах