Using Prismic increased 10x our page loading time

Hi,

Most pages of the website I'm building are loading in 30-100ms in dev.
If I load a prismic document, the loading time increases around 300-800ms in dev.

In preprod env. (dedicated server) the loading time is badly impacted by prismic too.
From 100ms (without Prismic) to 500-600ms (with Prismic).

The user guides tells that cached response time is around 25ms but that's not what I experiment.

$api = Api::get("https://winesmart.cdn.prismic.io/api/v2");
$document = $api->getByUID('page', 'my-slug');

Here is a sample url generated by the php kit (~100-350ms loading time)
https://winesmart.cdn.prismic.io/api/v2/documents/search?page=1&pageSize=20&ref={"_tracker"%3A"9pVevxDO"}&q=[[%3Ad%20%3D%20at(my.page.uid%2C%20"mentions-legales")]]&lang=*

Can you tell me if i do something wrong ?
How to contain loading time in a decent range ?
Do I have to use caching system ?

Thanks.

Hello @ludovicmeyer, this is strange. What you've found in the user guides is valid/up-to-date information. So there shouldn't be a reason why the response time increases. Usually, this happens when having network issues or because the browser doesn't have the file in the cache yet.

If you're ever curious about our connectivity status and the health of the API you can always check out Status page

Hello @Pau, do you experience under 100ms response with this url ?

https://winesmart.cdn.prismic.io/api/v2/documents/search?page=1&pageSize=20&ref={"_tracker"%3A"9pVevxDO"}&q=[[%3Ad%20%3D%20at(my.page.uid%2C%20"mentions-legales")]]&lang=*

I tested from my own computer with fiber and no latency.
A colleague tested with his own connection (and computer).
And finally I tested from my dedicated server.
All my tests are around 150-300ms and are a bit random even on the same machine. I can't have network issues on all the tools I tried.

The ~25ms response time seems to be for cached query and the status page displays response time for non cached queries.
Can you tell me if the url I gave is eligible for caching and is cached ?

Hello Ludovic, Those request are a bit specific as you can see in the query string URL your query is including a tracker as a ref. {"_tracker"%3A"9pVevxDO"}

This tracker is meant to display for you the edit button on your website and yes some processing is done in order to do that that can slow down your request.

This is though only for you as a user because you're logged in to prismic.
All users browsing your website will get a different behaviour (no tracker) that will be way faster, you can try that by browsing your website with incognito mode.

The response time should be way faster.

Let me know,
Renaud

Thank you very much for your answer @renaud . I can completly understand that being logged in prismic can impact the loading time.
I will test everything in inconito mode and without prismic preview script. I will try to export the query created by the php-kit in this configuration.
I'll be back shortly with good... or bad news :grinning:

This issue has been closed due to inactivity. Flag to reopen.