Replication of The /api Endpoint
Up to 80% Faster Response Time for Europe & APAC available for everyone on the 26th Feb
TLDR: We are replicating our /api
endpoint in 2 regions (Europe, Australia) for all users on February 26, 2022. If you’re in Europe, Asia, or Oceania, this will decrease the response time of all /api
queries by more than 60%. This should be transparent for you, except if you’re using the tag array passed in the /api request. If you’re using the tag array please, read more about it in the “What do I need to do?” section below.
At Prismic, we’ve made it our mission to allow thousands of teams across the globe to create rich content that will enable their companies to grow on the web.
Since 2010, when it was introduced as a ranking factor in the Google algorithm, page speed has become increasingly important for your SEO.
We’ve invested a lot in the past years to make your website faster and to help you optimize your SEO performance, namely by:
- Making your API calls more reliable and stable.
- Improving the speed of each image that we deliver by offering Image Optimizing & Compression for free.
We are now working on making your API calls even faster than they were by introducing the replication of one of the most critical endpoints of our API. The /api
endpoint.
Introducing the /api replication to your API
What is the /api endpoint?
Every time you want to fetch content through the Prismic API, two queries are necessary:
- The first request goes to your main API endpoint:
/api
. This endpoint doesn't include any content. It only includes meta-information about your content. For example a ref. A ref is the ID for the most recent version of your content. - The second query goes to your content API, and includes the ref from your first query:
/api/v2/search
. The ref ensures that the API returns the most recent version of your content and prevents the API from serving stale cached content.
This two-request process is key to our rapid API response times. We use this ref as an indicator to know if we should provide cached content or not through our CDN. Thanks to this mechanism we are providing cached data for more than 90% of requests that you make to our API.
For the /api
endpoint (the one providing you the ref), we cannot provide any cached data. This is because we want the master ref to be up-to-date all the time. Some of you requested that we work on optimizing the response time of this endpoint and that’s exactly what we did.
Replicating /api in Europe and Australia
By analyzing these optimization requests, we figured out pretty fast that all of them were coming from Europe, Asia, or Australia. This is due to the fact that our main servers are located in the United States, so we understood that response times for customers in that region were already very fast.
The main issue raised was due to the network latency brought by the distance between some clients and our servers delivering the /api
endpoint.
This is why we decided to commence the work needed to replicate the /api
endpoint in Europe and Australia.
The European and Australian endpoints are available in beta and are already used by more than 2,000 of our customers. Given the beta’s success, we’ve decided to roll this feature out for all repositories on February 26, 2022.
What does this change for me?
The release of this feature will drastically improve response time for the /api
endpoint making your website way faster than before.
Our benchmarks are showing an improvement of more than 65% for the location that we tested.
If you don't believe us, believe Alex Cioflica | Gaming Architect at Flutter Entertainment
"Having an API located closer to our customers and data centers, we've seen the response time for getting the master ref being reduced with approximately 70%. This has resulted in a much smaller lead time when using the Content Query API. Overall, it has improved the rendering speed of our products, by having the documents from Prismic aggregated faster"
What do I need to do?
Absolutely nothing if you don't use the tag property of the /api
; this feature will be activated automatically on February 26, 2022. Even though we announced the deprecation of using the tag array passed in the /api
request in April, we’ve extended that date to allow some of our users to get more time for the migration.
This is now the last extension and the last call to do the migration.
If you have any question about this please, don't hesitate to ask them on our community forum.