Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-23990

Improve cache for URLs, to prevent duplicate queries

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Confirmed
    • Priority: High
    • Resolution: Unresolved
    • Affects Version/s: 5.3, 5.4.0
    • Fix Version/s: None
    • Component/s: Caching
    • Labels:
      None

      Description

      When generating a URL, eZ Publish performs 1+n queries, to fetch the link and all the nodes the way up. When the URL is assembled, it is written to cache. When another, similar URL is generated, all 1+n queries are executed again, even if most of the parts are completely identical.

      For example, consider the following content structure:

      Root
          Tests                               (ezurlalias_ml id: 156)
              13124_folder1            (ezurlalias_ml id: 157)
                  13124_folder2        (ezurlalias_ml id: 158)
                      13124_article1    (ezurlalias_ml id: 159)
                      13124_article2    (ezurlalias_ml id: 160)
                      13124_article3    (ezurlalias_ml id: 161)
                      13124_article4    (ezurlalias_ml id: 162)
      

      When you access the frontend mainpage, a number of duplicate queries is generated:

      ...
      Query    SELECT `id`, `link`, `is_alias`, `alias_redirects`, `lang_mask`, `is_original`, `parent`, `text`, `text_md5`, `action` FROM `ezurlalias_ml` WHERE ( `action` = 'eznode:156' AND `is_original` = 1 AND `is_alias` = 0 )
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '162'
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '158'
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '157'
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '156'
      Query    SELECT * FROM `ezcontentobject_tree` WHERE `node_id` = '155'
      Query    SELECT `id`, `link`, `is_alias`, `alias_redirects`, `lang_mask`, `is_original`, `parent`, `text`, `text_md5`, `action` FROM `ezurlalias_ml` WHERE ( `action` = 'eznode:155' AND `is_original` = 1 AND `is_alias` = 0 )
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '161'
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '158'
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '157'
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '156'
      Query    SELECT * FROM `ezcontentobject_tree` WHERE `node_id` = '154'
      Query    SELECT `id`, `link`, `is_alias`, `alias_redirects`, `lang_mask`, `is_original`, `parent`, `text`, `text_md5`, `action` FROM `ezurlalias_ml` WHERE ( `action` = 'eznode:154' AND `is_original` = 1 AND `is_alias` = 0 )
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '160'
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '158'
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '157'
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '156'
      Query    SELECT * FROM `ezcontentobject_tree` WHERE `node_id` = '153'
      Query    SELECT `id`, `link`, `is_alias`, `alias_redirects`, `lang_mask`, `is_original`, `parent`, `text`, `text_md5`, `action` FROM `ezurlalias_ml` WHERE ( `action` = 'eznode:153' AND `is_original` = 1 AND `is_alias` = 0 )
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '159'
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '158'
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '157'
      Query    SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '156'
      ...
      

      Notice all those duplicate SELECTs:

      SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '158'
      SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '157'
      SELECT `parent`, `lang_mask`, `text` FROM `ezurlalias_ml` WHERE `id` = '156'
      

      Technically this is because the cache is implemented in a simple way as it does not have enough information to clear specific cache.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              nuno.oliveira-obsolete@ez.no Nuno Oliveira (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: