Pagination and speed

Hi,

I have staticache on my kirby website
Flux :: BW - code + design — Amiens is good but https://jaiunsite.com/flux/page:2 not really.
I know I have a page with a lot of images archive instagram BW - code + design — Amiens

So what can I do ? Split this post with many images (any tools ?) ? add a template for images ?
Force cache for page:x ?

I just visited your URL, on my Smartphone, and can’t really confirm the hassle with the speed of loading pages you described. :thinking:

But I can imagine that having a really long one page like your archive has is not beneficial for loading speed, specially with lots of images in it.

Maybe you should split of you one long page in many separate one OR separate the whole archive into smaller more distinctive ones, thematically or by tags or something like that.

Just an Idea. :wink:

There’s definitely something not working as expected at the moment with your Kirby performance. Page 2 loads in 5s-60s (mostly “waiting” state in http response) while page 1 in ~1s, with only 20 content items loaded for the pages.

@KranzKrone As said the given example of /flux page 2 shouldn’t be of that bad performance. It has not that much content that splitting up should be necessary. This looks like a code issue but without code we can’t say much more.

Have you checked what happens if you disable staticache?

  1. How does your configuration look like in regards to routing, caching?
  2. What code do you use for the pagination logic?

If you can’t further debug the issue from here, you can also find people who can help you professionally debug and optimize the site here in the community (yes, me, too).

Without Staticache it’s the same problem.

In my home page

<?php snippet('pagination', ['pagination' => $notes->pagination()]) ?>

collections notes.php

return function ($site) {
    return $site->children()->listed()->filterBy('template', 'note')->sortBy('date', 'desc');
};

snippet pagination.php

<?php
/*
  Snippets are a great way to store code snippets for reuse
  or to keep your templates clean.

  The pagination snippet renders prev/next links in the
  blog, when articles spread across multiple pages

  More about snippets:
  https://getkirby.com/docs/guide/templates/snippets
*/
?>
<?php if ($pagination->hasPages()): ?>
<nav class="pagination">
  <?php if ($pagination->hasPrevPage()): ?>
  <a class="pagination-prev" href="<?= $pagination->prevPageUrl() ?>">&larr;</a>
  <?php else: ?>
  <span class="pagination-prev">&larr;</span>
  <?php endif ?>
  <?php if ($pagination->hasNextPage()): ?>
  <a class="pagination-next" href="<?= $pagination->nextPageUrl() ?>">&rarr;</a>
  <?php else: ?>
  <span class="pagination-next">&rarr;</span>
  <?php endif ?>
</nav>
<?php endif ?>

and this :

<?php
(function /* staticache */ () {
  $root = __DIR__ . '/site/cache';

  if (php_sapi_name() === 'cli') return;
  if (in_array($_SERVER['REQUEST_METHOD'], ['GET', 'HEAD']) === false) return;

  $root .= '/jaiunsite.com_flux/pages';
  if (is_dir($root) !== true) return;

  $path = $root . '/' . ltrim($_SERVER['REQUEST_URI'] ?? '', '/');
  $path = preg_replace('#^' . preg_quote($root) . '/flux/#', $root . '/', $path);

  if (is_file($path . '/index.html') === true) {
    $path = $path . '/index.html';
  } elseif (is_file($path) !== true) {
    return;
  }

  if ($mime = @mime_content_type($path)) {
    header("Content-Type: $mime");
  }

  die(file_get_contents($path));
})();


require __DIR__ . '/vendor/autoload.php';
echo (new Kirby)->render();

I have a CloudFlare to speed up the cache…

What can I do step by step ?

I’ve seen perf issue reports which were related to referencing deleted pages: Discord Maybe it’s also such a thing?

OK, I delete cache :slight_smile:
and
0.3s on first page
3s on 2nd page :cry:
(panel looks faster)

I’m not sure deleting the cache helps tbh… As I understood it, it was the references to deleted pages that caused the delays. (It’s possible I haven’t understood it :P)

Any idea ?
I don’t understand why “make a page:X” is so long… just thumbnails, titles and excerpts.

are there any pages in the entire collection you’re paginating that are referencing no-longer existing pages or files? If not, you can discard my comment.

Probably, I change some names and urls. This is a staticache problem or kirby problem ?