First load very slow - up to 10 Seconds

Permalink
Hey, I have a problem with a small website in concrete5 8.1 When I hit the page for the first time, it takes up to 8-10 Seconds. After that it loads very fast, also in other browsers. After about 2 hours it is slow again for the first load. Cache is activated.

For debugging I turned on the database protocol.

Do you have ideas why the first load can be so slow?

Thank you
Nico

dercin
 
Gondwana replied on at Permalink Reply
Gondwana
Probably the c5 cached copy of the page isn't created until its first access. By default, pages in c5's cache expire after some period (although I think it's 6 hours).

These days, there could be a lot of other intermediate caches involved, including CDN (eg, Cloudflare).
dercin replied on at Permalink Reply 1 Attachment
dercin
Hey,

I think the c5 cache is not the reason for the slow version because after deleting the cache in c5 the loading time of the page still fast enough, with open dev tools and browser cache disabled.

I have attached a little screenshot from dev tools when it took a very long time....
Greetings
Nico
mesuva replied on at Permalink Reply
mesuva
I've noticed this with 8.1 on one of our resellers servers.

I've found on one server that if a site hasn't been accessed for some time, it can take many seconds to initially load - then after that it's really fast to change pages. This is with caching off, and caching on doesn't appear to impact this initial site load.

The exception with this server is that I believe it's still running spinning hard disks, while the other reseller accounts we have are running SSDs. On the SSD servers there's really no noticeable initial slowdown.

My guess then is that the server is taking a long time to physically read and load into memory concrete5's core files, basically parse the PHP. Once it's loaded up into memory I think it's cached (PHP wise) so it doesn't have to read from the server's hard disk on every page load.

This is just a theory. I've tried a few experiments like setting up a cron job to hit the server every few minutes, sort of like a rough 'keep-alive'. This actually appears to work, but it doesn't feel like an appropriate solution.

So my suggestion would be to review your hosting - is it perhaps just slow with disk reads?

I recall seeing Korvin committing something to github for 8.2 that uses a different approach to autoloading the core concrete5 files, something to make it more efficient I believe.
dercin replied on at Permalink Reply
dercin
Thank you for your detailed answer.
Then perhaps we can hope for an update in the future.. :) I check my hosting.

Greetings from Germany.
dercin replied on at Permalink Reply
dercin
Okay I updated to 8.2.1 now.

Still the same Problem. The first load on a day is about 8 Seconds after that It's fast on all clients for the next hours.
Steevb replied on at Permalink Reply
Steevb
Do u have the right code in your htaccess file for speed?

Do u have the right php settings and modules in place?

Do u have a URL we can look at?

Does ‘WebPageTest’ or ’Nibbler’ show any help with issues?
typoman76 replied on at Permalink Reply
typoman76
I see exactly the same issue on some of my sites.
First load in the morning is very slow. After that constantly fast.
And its not the concrete5 cache. This happens with uncached site or with caching on.

It really looks like there is an initial load for the site and then cached with php or something else.

So if anyone has a good idea. I'm interested in a solution.
dercin replied on at Permalink Reply
dercin
Hey,

Im sorry the website is still not public so I can't write the URL here. But I tested it with some tools, also nibbler and webpagetest and couldn't find any heavy problems yet. The important thing is, the tests could load the page in 1-2 seconds. It is only the first load a day, that is really slow. I will check tomorrow again and try to start with a test.

My htaccess is still quite empty:

AddType image/svg+xml .svg

# 1 Month for most static assets
<filesMatch ".(css|jpg|jpeg|png|gif|js|svg|ico)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>

<ifmodule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</ifmodule>

# -- concrete5 urls start --
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
# -- concrete5 urls end --



This a part of Website info in c5

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - On - If blocks on the particular page allow it.
Full Page Cache Lifetime - Only when manually removed or the cache is cleared.

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
7.1.9

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imagick, imap, intl, json, libxml, limiter, mbstring, mcrypt, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, pspell, readline, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib

# PHP Settings
max_execution_time - 90
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 10000
memory_limit - 256M
post_max_size - 96M
sql.safe_mode - Off
upload_max_filesize - 96M
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
opcache.max_accelerated_files - 7963
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5

In config I activated imagick.

Regards
kspitzley replied on at Permalink Reply
kspitzley
Did anyone have any resolution to this? I'm on Bluehost (unhappily) and they insist that their server resources are fine but I'm seeing a long stall before the website seems to 'hit' the server, and then once it does things seem to load OK. But there is a 5-10 second stall before anything even starts happening. I am not a server admin by any means so I have no idea how to troubleshoot this beyond doing as much optimization as I can. But if the server doesn't even get hit for 7 seconds, my optimization doesn't really matter much. I also get intermittent mySQL "too many connections" errors, which is certainly not due to traffic.

My environment info:
# concrete5 Version
Core Version - 8.5.1
Version Installed - 8.5.1
Database Version - 20190301133300

# concrete5 Packages
Block Designer (3.3.0), Block Designer Pro (3.0.1), ExchangeCore reCAPTCHA (1.1.1), Formidable (Full Version) (2.0.7), Spacer (0.9.4), Vivid Simple Accordion (1.0.1)

# concrete5 Overrides
blocks/search/templates/spsa_search/controller.php, blocks/search/templates/spsa_search/view.php, blocks/search/templates/spsa_search/view.css, blocks/search/templates/spsa_search/viewZZZZZ.css, blocks/search/templates/spsa_search, blocks/search/templates, blocks/search, blocks/marningal_functions/icon.png, blocks/marningal_functions/form.php, blocks/marningal_functions/controller.php, blocks/marningal_functions/view.php, blocks/marningal_functions/db.xml, blocks/marningal_functions/js_form/handlebars-v4.0.4.js, blocks/marningal_functions/js_form/handlebars-helpers.js, blocks/marningal_functions/js_form, blocks/marningal_functions/edit.php, blocks/marningal_functions/css_form/repeatable-ft.form.css, blocks/marningal_functions/css_form, blocks/marningal_functions/composer.php, blocks/marningal_functions/add.php, blocks/marningal_functions/auto.js, blocks/marningal_functions/config.json, blocks/marningal_functions, blocks/vivid_simple_accordion/templates/faq/view.php, blocks/vivid_simple_accordion/templates/faq/view.css, blocks/vivid_simple_accordion/templates/faq/view.js, blocks/vivid_simple_accordion/templates/faq, blocks/vivid_simple_accordion/templates, blocks/vivid_simple_accordion, blocks/formidable/templates/job_application/view.php, blocks/formidable/templates/job_application/view.css, blocks/formidable/templates/job_application, blocks/formidable/templates, blocks/formidable, blocks/essential_functions/icon.png, blocks/essential_functions/form.php, blocks/essential_functions/controller.php, blocks/essential_functions/view.php, blocks/essential_functions/db.xml, blocks/essential_functions/js_form/handlebars-v4.0.4.js, blocks/essential_functions/js_form/handlebars-helpers.js, blocks/essential_functions/js_form, blocks/essential_functions/edit.php, blocks/essential_functions/css_form/repeatable-ft.form.css, blocks/essential_functions/css_form, blocks/essential_functions/composer.php, blocks/essential_functions/add.php, blocks/essential_functions/auto.js, blocks/essential_functions/config.json, blocks/essential_functions, blocks/page_list/templates/job_postings/view.php, blocks/page_list/templates/job_postings/view.css, blocks/page_list/templates/job_postings, blocks/page_list/templates/rfp_postings/view.php, blocks/page_list/templates/rfp_postings/view.css, blocks/page_list/templates/rfp_postings, blocks/page_list/templates/active_projects/view.php, blocks/page_list/templates/active_projects/view.css, blocks/page_list/templates/active_projects, blocks/page_list/templates/public_notices/view.php, blocks/page_list/templates/public_notices/view.css, blocks/page_list/templates/public_notices/viewold.php, blocks/page_list/templates/public_notices, blocks/page_list/templates/homepage_alert/view.php, blocks/page_list/templates/homepage_alert/view.css, blocks/page_list/templates/homepage_alert/viewold.php, blocks/page_list/templates/homepage_alert/viewold2.php, blocks/page_list/templates/homepage_alert, blocks/page_list/templates, blocks/page_list, themes/spsa/description.txt, themes/spsa/images/SPSA_Color_Logo_Horizontal.eps, themes/spsa/images/spsalogo.png, themes/spsa/images/spsa-color.png, themes/spsa/images/spsalogo_sml.png, themes/spsa/images/SPSA_White_Logo_Horizontal.eps, themes/spsa/images/SPSA_Black_Logo_Horizontal.eps, themes/spsa/images/Asset 1spsa-white.png, themes/spsa/images/favicon.ico, themes/spsa/images, themes/spsa/view.php, themes/spsa/elements/subheader.php, themes/spsa/elements/header.php, themes/spsa/elements/footer.php, themes/spsa/elements, themes/spsa/job.php, themes/spsa/thumbnail.png, themes/spsa/css/fullcalendar.min.css, themes/spsa/css/maina.css, themes/spsa/css/foundation.css, themes/spsa/css/main101319a.css, themes/spsa/css/mainYYYY.css, themes/spsa/css/main101219a.css, themes/spsa/css/mainZZZZ.css, themes/spsa/css/main101519a.css, themes/spsa/css/main10919a.css, themes/spsa/css/main.css, themes/spsa/css, themes/spsa/js/appold.js, themes/spsa/js/foundation.js, themes/spsa/js/app.js, themes/spsa/js/moment.min.js, themes/spsa/js/fullcalendar.min.js, themes/spsa/js/foundation102219a.js, themes/spsa/js/Chart.min.js, themes/spsa/js, themes/spsa/default.php, themes/spsa/page_theme.php, themes/spsa/full.php, themes/spsa/home.php, themes/spsa/rfp.php, themes/spsa

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - On - If blocks on the particular page allow it.
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache

# Server API
cgi-fcgi

# PHP Version
7.3.10

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, imagick, imap, intl, ionCube Loader, json, libxml, mbstring, mysqli, mysqlnd, odbc, openssl, pcntl, pcre, PDO, pdo_mysql, PDO_ODBC, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, pspell, readline, Reflection, session, SimpleXML, soap, sockets, SPL, sqlite3, standard, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib

# PHP Settings
max_execution_time - 1000
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 1000
max_input_vars - 4000
memory_limit - 2048M
post_max_size - 2048M
upload_max_filesize - 2048M
ic24.api.max_timeout - 7
mbstring.regex_stack_limit - 100000
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
odbc.max_links - Unlimited
odbc.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5