Site AI Auditby Internet Solutions

Slow External API Calls: Stop Another Service Slowing You

৭ নভেম্বর, ২০২৬7 মিনিটে পড়াওয়েবসাইটের স্পিড
Slow External API Calls: Stop Another Service Slowing You

Short answer: If your server asks another service for data before it sends a page, your page can be no faster than that service. A slow weather feed, shipping quote, review service or licence check then becomes a slow website. The cure is to find these calls, keep the answers in a cache, set short timeouts and decide in advance what visitors see when the service does not answer.

What an external API call is

An API is a way for one program to ask another for information. Your website uses them more often than you may think. A shop asks a payment provider to confirm a payment, a shipping module asks a carrier for prices, a news widget asks a feed for headlines, and a plugin asks its own maker whether your licence is valid. Each of these is a request sent over the internet, and your page may wait for the reply.

There are two places where this happens. The first is on the server, in PHP, Node or another language, before the page is built. The second is in the visitor’s browser, through scripts that fetch data after the page has loaded. The server-side kind is more dangerous for speed, because it delays the first byte and everything that follows it.

Why one slow service slows your pages

Think of a waiter who must go to another restaurant for one ingredient before serving your table. If that kitchen is busy, your table waits, however fast your own kitchen is. A server that makes an external request in the middle of building a page does the same. It holds a worker process while it waits, and that worker cannot serve anyone else.

This has two effects. The page is slow for the visitor who triggered the call, and under load the site as a whole slows down, because all workers end up waiting. The guide to PHP workers and busy sites explains why a limited pool of workers fills up so quickly. A slow third party can therefore turn a small delay into an outage.

Typical culprits

WordPress sites are especially prone to this, because its HTTP functions are easy to use and plugins call them freely. By default a WordPress request waits up to five seconds for a reply, which is a very long time for a page that should load in two.

How to find the slow calls

  1. Look at the server response time. A high time to first byte on uncached pages suggests work done on the server. The article on reducing server response time shows how to measure it.
  2. Use a profiler or debug plugin. Tools such as the free Query Monitor plugin for WordPress list every outgoing HTTP request on a page, with its address and duration.
  3. Check the Server-Timing header. If your application reports timings for its parts, you can see how long outside calls take. The guide to the Server-Timing header explains the format.
  4. Compare logged-in and logged-out pages. Some calls occur only in the admin area, and others only for visitors.
  5. Test during busy and quiet times. A call that is fast at night and slow at noon points to a shared or overloaded service.
  6. Look at the browser waterfall. For browser-side calls, the chart described in the guide to reading a waterfall chart shows requests to other domains and how long each one takes.

Fix 1: Cache the answer

Most data does not change every second. Exchange rates, review totals, weather and feed headlines can be stored for minutes or hours. Ask the service once, keep the answer and reuse it for every visitor until it is old.

Fix 2: Set short timeouts

A timeout is the longest time you will wait for a reply. Default values are often generous, to avoid errors, but for a public page a long wait is worse than a missing widget. Set a connection timeout of one or two seconds and a total timeout slightly longer, and choose lower values for non-essential data. A review widget that does not load is a small problem. A page that hangs for five seconds loses visitors.

Also limit retries. Three quick retries against a service that is down triple the time that a worker is blocked.

Fix 3: Move the call out of the page

Fix 4: Plan for failure

Every service fails sometimes, so decide what your page does then. Options include showing the last cached value, hiding the widget, showing a neutral message or using a default such as a standard shipping price. Test it by blocking the address of the service on a test copy of the site. Many owners are surprised to see how much of the page breaks.

For critical services, such as payment, keep a clear message for visitors and an alert for you. For optional services, let the page work without them.

Choose and review providers carefully

Before you add an external service, ask how fast it answers, where it runs and what happens when it is down. Prefer providers that publish status pages and response times. Remove services you no longer use, because old widgets and plugins keep sending requests for years. The same principle applies to scripts in the browser, which the article on third-party scripts covers in detail.

How Site AI Audit helps

Site AI Audit does not list the server-side calls your code makes, so it cannot name the slow service. It measures what a visitor feels: server response time, the Google PageSpeed score, Core Web Vitals, compression and page weight. A slow server response on a simple page is a strong sign that something is waiting on the server, and it tells you where to start looking. The free check covers up to 50 pages and needs no sign-up. You can run a free check of your website or see the plans for weekly monitoring and alerts.

Related reading

The bottom line

Your site is as fast as the slowest thing it waits for. Find the outside calls, store their answers, limit how long you wait and decide what happens when a service fails. These steps cost little and often cut seconds from uncached pages.

FAQ

How do I know if an API call is slowing my page?

Look for a high server response time on pages that have not been cached, and use a profiling tool that lists outgoing requests with their durations. A request that takes seconds is the likely cause.

Is it safe to cache API responses?

Yes, for data that can be a little old, such as rates, feeds and ratings. Do not cache private data, such as account details, in a way that could be shown to another visitor.

What is a good timeout?

For public pages, one or two seconds for non-essential services is a sensible start. Payment and other essential steps may need more, but they should happen outside normal page loads.

Do browser-side calls matter too?

Yes, but they delay less, because the page can render first. They can still slow interaction and shift the layout, so load them late and reserve space for them.

Can a plugin make outside requests without my knowledge?

Yes. Many plugins check licences, updates or remote settings. A request log or profiler shows them, and you can remove or replace plugins that call out too often.

#Page speed#Troubleshooting#Web hosting
আপনার নিজস্ব ওয়েবসাইট চেক করুন।আপনার ওয়েবসাইট কি হ্যাকিং থেকে সুরক্ষিত?
বিনামূল্যে শুরু

ব্লগ থেকে আরও

সব আর্টিকেল →
Internet Solutions

আমাদের টিমের আরও কিছু

Internet Solutions-এর তৈরি। আমাদের অন্য প্রোডাক্টগুলোও ব্যবহার করে দেখুন — প্রতিটি আলাদা ভাবে আপনার সময় বাঁচায়।

internet-solutions.net ↗
01সোশ্যাল মিডিয়ায় অটো-পোস্টিং
PostRSS

আপনার RSS ফিডের নতুন পোস্ট স্বয়ংক্রিয়ভাবে Facebook, X, LinkedIn, Telegram এবং আরও ৬০+ নেটওয়ার্কে চলে যায়।

ফ্রি প্ল্যান · ২০১৪ থেকেদেখুন →
02ওয়েবসাইটের জন্য AI লাইভ চ্যাট
Talkmio

আপনার ওয়েবসাইট আপনার নিজের কনটেন্ট থেকে, ভিজিটরের ভাষায়, ২৪/৭ উত্তর দেয়।

ফ্রি প্ল্যান · কার্ড লাগবে নাদেখুন →
03AI সহকারী
Ask Mio

চ্যাট, কোড, ডিজাইন, লেখা ও গবেষণা। প্রতিটি কাজের জন্য Mio সেরা মডেল বেছে নেয়।

ফ্রি প্ল্যানদেখুন →
04ব্লগ ও সোশ্যাল মিডিয়ার জন্য AI অটোপাইলট
AI Blog Autopilot

AI ২,০০০–৩,০০০ শব্দের SEO আর্টিকেল লেখে এবং প্রতিটি ৫৮+ সোশ্যাল নেটওয়ার্কে শেয়ার করে।

প্রথম ৩টি আর্টিকেল ফ্রিদেখুন →
05গভীর SEO ক্রল
Site SEO AI Audit

AI সার্চে দৃশ্যমানতাসহ ৭টি ক্ষেত্রে পূর্ণ SEO ক্রল, প্রভাব অনুযায়ী সাজানো সমাধানসহ।

প্রথম অডিট ফ্রিদেখুন →
06RSS ও প্রোডাক্ট ফিড
RSS Feed Creator

যেকোনো ওয়েব পেজ থেকে RSS তৈরি করুন, সঙ্গে Google ও Meta-র জন্য নিজে থেকে আপডেট হওয়া প্রোডাক্ট ফিড।

ফ্রি প্ল্যানদেখুন →
07ওয়েব ডেভেলপমেন্ট ও SEO
Internet Solutions

ওয়েবসাইট, ই-শপ ও কাস্টম সিস্টেম — আমাদের টিম ডিজাইন করে, তৈরি করে এবং চালায়।

২০১১ থেকেদেখুন →