Normal amount of database queries
Permalink
I've inherited a couple of C5 sites, which I'm experiencing poor performance on. This is running on a mid-tier Azure linux web resource; I've pasted environment information below.
Every page is 4-5 seconds time to first byte, these pages are really simple. After the first request returns, the page is snappy loading other artifacts - this is definitely something related to C5 on the server.
I turned on query logging and cleared it out, loaded just the homepage, which has the same navigation and footer as the rest of the site, plus a few text and image content blocks. This resulted in 670 database queries. One load, of one page.
The query "select Pages.cID, Pages.pkgID, Pages.siteTreeID, Pages.cPointerID, Pages.cPointerExternalLink, Pages.cIsDraft, Pages.cIsActive, Pages.cIsSystemPage, Pages.cPointerExternalLinkNewWindow, Pages.cFilename, Pages.ptID, Collections.cDateAdded, Pages.cDisplayOrder, Collections.cDateModified, cInheritPermissionsFromCID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cCheckedOutUID, cIsTemplate, uID, cPath, cParentID, cChildren, cCacheFullPageContent, cCacheFullPageContentOverrideLifetime, cCacheFullPageContentLifetimeCustom from Pages inner join Collections on Pages.cID = Collections.cID left join PagePaths on (Pages.cID = PagePaths.cID and PagePaths.ppIsCanonical = 1) where Pages.cID = ?" is run 127 times.
The query "SELECT t0.cID AS cID_1, t0.cvID AS cvID_2, t0.akID AS akID_3, t0.avID AS avID_4 FROM CollectionAttributeValues t0 WHERE t0.cID = ? AND t0.cvID = ? AND t0.akID = ? LIMIT 1" is run 106 times.
And so on. Is this in any way normal? As below, every caching option is set to on, I've checked the files on the server, the cache files are present. I can't imagine 607 queries to the MySql DB for a single page; any ideas as to the issue?
# concrete5 Version
Core Version - 8.3.1
Version Installed - 8.3.1
Database Version - 20171218000000
# concrete5 Packages
Easy Fancybox 2 (1.2), ExchangeCore reCAPTCHA (1.1.1), Fluid Gallery (2.8.1), Framework Theme (0.3), Fundamental (4.0.5), Simple Gallery (1.0.7)
# concrete5 Overrides
None
# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - On - In all cases.
Full Page Cache Lifetime - Only when manually removed or the cache is cleared.
# Server Software
Apache
# Server API
apache2handler
# PHP Version
7.2.11
# PHP Extensions
apache2handler, bcmath, calendar, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imagick, imap, intl, json, ldap, libxml, mbstring, mcrypt, mysqli, mysqlnd, odbc, openssl, pcntl, pcre, PDO, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pdo_sqlsrv, pgsql, Phar, posix, Reflection, session, shmop, SimpleXML, soap, sockets, sodium, SPL, sqlite3, sqlsrv, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib
# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - -1
max_input_vars - 1000
memory_limit - 128M
post_max_size - 8M
upload_max_filesize - 2M
ldap.max_links - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
odbc.max_links - Unlimited
odbc.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pdo_sqlsrv.client_buffer_max_kb_size - 10240
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
opcache.max_accelerated_files - 4000
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5
Every page is 4-5 seconds time to first byte, these pages are really simple. After the first request returns, the page is snappy loading other artifacts - this is definitely something related to C5 on the server.
I turned on query logging and cleared it out, loaded just the homepage, which has the same navigation and footer as the rest of the site, plus a few text and image content blocks. This resulted in 670 database queries. One load, of one page.
The query "select Pages.cID, Pages.pkgID, Pages.siteTreeID, Pages.cPointerID, Pages.cPointerExternalLink, Pages.cIsDraft, Pages.cIsActive, Pages.cIsSystemPage, Pages.cPointerExternalLinkNewWindow, Pages.cFilename, Pages.ptID, Collections.cDateAdded, Pages.cDisplayOrder, Collections.cDateModified, cInheritPermissionsFromCID, cInheritPermissionsFrom, cOverrideTemplatePermissions, cCheckedOutUID, cIsTemplate, uID, cPath, cParentID, cChildren, cCacheFullPageContent, cCacheFullPageContentOverrideLifetime, cCacheFullPageContentLifetimeCustom from Pages inner join Collections on Pages.cID = Collections.cID left join PagePaths on (Pages.cID = PagePaths.cID and PagePaths.ppIsCanonical = 1) where Pages.cID = ?" is run 127 times.
The query "SELECT t0.cID AS cID_1, t0.cvID AS cvID_2, t0.akID AS akID_3, t0.avID AS avID_4 FROM CollectionAttributeValues t0 WHERE t0.cID = ? AND t0.cvID = ? AND t0.akID = ? LIMIT 1" is run 106 times.
And so on. Is this in any way normal? As below, every caching option is set to on, I've checked the files on the server, the cache files are present. I can't imagine 607 queries to the MySql DB for a single page; any ideas as to the issue?
# concrete5 Version
Core Version - 8.3.1
Version Installed - 8.3.1
Database Version - 20171218000000
# concrete5 Packages
Easy Fancybox 2 (1.2), ExchangeCore reCAPTCHA (1.1.1), Fluid Gallery (2.8.1), Framework Theme (0.3), Fundamental (4.0.5), Simple Gallery (1.0.7)
# concrete5 Overrides
None
# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - On - In all cases.
Full Page Cache Lifetime - Only when manually removed or the cache is cleared.
# Server Software
Apache
# Server API
apache2handler
# PHP Version
7.2.11
# PHP Extensions
apache2handler, bcmath, calendar, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imagick, imap, intl, json, ldap, libxml, mbstring, mcrypt, mysqli, mysqlnd, odbc, openssl, pcntl, pcre, PDO, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pdo_sqlsrv, pgsql, Phar, posix, Reflection, session, shmop, SimpleXML, soap, sockets, sodium, SPL, sqlite3, sqlsrv, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib
# PHP Settings
max_execution_time - 30
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - -1
max_input_vars - 1000
memory_limit - 128M
post_max_size - 8M
upload_max_filesize - 2M
ldap.max_links - Unlimited
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
odbc.max_links - Unlimited
odbc.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pdo_sqlsrv.client_buffer_max_kb_size - 10240
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
opcache.max_accelerated_files - 4000
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5
The culprit is usually an over-enthusiastic Autonav, especially if you have multiple nav's on a page.
If that is the case:
a) Adjust autonav settings so that it only crawls the pages you need to show
b) enable caches
c) replace with manual nav or nested manual nav.