2

Im running Joomla 3.X and can't seem to pinpoint why I'm getting such high HTTP response times.

I think I narrowed it down to the SEF rules in my .htaccess

I ran some tests and thought to post my results here hoping someone familiar with the Joomla architecture can lead me in the right direction.

Right now the server is on a push style CDN so 200 response OK pages are a non-issue.

Its the 404 pages that will always have a TTFB of around 1-2 seconds - testing here

https://speedvitals.com/ttfb-test

Most sites I check return a 404 in 100-300 ms

Heres what I have so far

I've setup a "rule" on my cdn to bypass the cache for a random url.

When I test the random url as is, these are the times.

slow response 404

If I remove the below SEF snippet from the .htaccess, the 404 response times improve dramatically.

## Begin - Joomla! core SEF Section.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# 
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.

good response time 404

My question(s):

Could this be DB related or could I rule that out because I'm getting good times with the SEF snippet removed?

Apache or perhaps a Joomla config issue somewhere?

Any insight would be very much appreciated, I've been working on this for a while now.

Side note: ( Edited )

If I turn off the SEF setting directly in the Joomla configuration, 404's just stop working.

Any random url shows the home page and a 200 response (in address bar the random url is intact)

I have since tried turning off the SEF setting and removed the snippet from the .htaccess - it now will give the correct apache 404 response for random urls. They also seem to respond well (only when bypassing the CDN cache but thats another topic )

Another Edit

The index.php file

<?php
/**
 * @package    Joomla.Site
 *
 * @copyright  Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

/**
 * Define the application's minimum supported PHP version as a constant so it can be referenced within the application.
 */
define('JOOMLA_MINIMUM_PHP', '5.3.10');

if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<'))
{
    die('Your host needs to use PHP ' . JOOMLA_MINIMUM_PHP . ' or higher to run this version of Joomla!');
}

// Saves the start time and memory usage.
//$startTime = microtime(1);
//$startMem  = memory_get_usage();

/**
 * Constant that is checked in included files to prevent direct access.
 * define() is used in the installation folder rather than "const" to not error for PHP 5.2 and lower
 */
define('_JEXEC', 1);

if (file_exists(__DIR__ . '/defines.php'))
{
    include_once __DIR__ . '/defines.php';
}

if (!defined('_JDEFINES'))
{
    define('JPATH_BASE', __DIR__);
    require_once JPATH_BASE . '/includes/defines.php';
}

require_once JPATH_BASE . '/includes/framework.php';

// Set profiler start time and memory usage and mark afterLoad in the profiler.
//JDEBUG ? JProfiler::getInstance('Application')->setStart($startTime, $startMem)->mark('afterLoad') : null;

// Instantiate the application.
$app = JFactory::getApplication('site');

// Execute the application.
$app->execute();
3
  • 1
    "If I remove the below SEF snippet from the .htaccess, the 404 response times improve dramatically." - If you remove the "SEF snippet" then the non-existent request is no longer being processed by Joomla and you presumably see an Apache 404 response? If you turn off the "SEF setting" in the Joomla config, what remains in the .htaccess file?
    – MrWhite
    Commented Oct 31, 2022 at 12:42
  • Correct @MrWhite I'll see the apache 404 response instead of the Joomla "article or category not found" . You mentioned a scenario I didn't think of and added it to the "Side note" in the post. Appreciate your time.
    – Nick
    Commented Oct 31, 2022 at 23:29
  • Im going to have to relook at this and make sure the CDN is not caching 404 responses. The SEF may not be the culprit after all.
    – Nick
    Commented Nov 1, 2022 at 22:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.