Why your system feels slow far from the server, and how to fix it
By Onen Benard
Founder & Technical Lead

A system that feels instant in the office can feel sluggish to a customer in Gulu, a partner in Nairobi or a donor in London. Usually nothing is broken. The delay comes from three ordinary things: how far each request travels, how much work the server does before it answers, and how much the page weighs once it arrives. This article explains each one in plain terms and sets out the fixes that make the biggest difference, in the order we normally apply them.
Why distance matters more than people expect
Data travels through fibre-optic cable at roughly two thirds of the speed of light, about 200,000 kilometres a second. That sounds instant, but it adds up. Every 1,000 kilometres of cable adds around five milliseconds each way. Even in theory, a round trip from Kampala to a data centre in Western Europe takes around 60 milliseconds. Real cable routes leave East Africa along the coast and through undersea systems, so in practice it is usually noticeably longer.
A single round trip is not the problem. The problem is that a browser needs several of them before anything appears. It has to look up the address, open a connection, agree on encryption, then ask for the page, so three or four round trips can pass before the first byte of the page arrives. A page that then loads twenty further files from the same distant server repeats some of that cost again. This is why a server on another continent can make a well-built system feel slow.
Measure before you move anything
Guessing is expensive, so start by measuring where the time actually goes. Three numbers tell you most of what you need:
- Time to first byte: how long the server takes to start answering. If it is high, the delay is distance, server work, or both.
- Largest Contentful Paint: how long until the main content is visible. Google treats 2.5 seconds or less as good.
- Total page weight: how many megabytes a first visit downloads. On mobile data, every one of them costs your visitor money as well as time.
Measure from where your users really are, on the devices they really use. A test on office fibre with a new laptop tells you very little about a mid-range Android phone on a busy 4G network. Browser developer tools can simulate a slower connection, and free tools such as Google's PageSpeed Insights report what real Chrome users experience on your site.
Fix one: serve files from close to the user
Images, stylesheets, scripts and fonts are identical for every visitor, so they do not need to come from your main server at all. A content delivery network (CDN) keeps copies of them in data centres around the world and serves each visitor from the nearest one. Providers such as Cloudflare run servers in many African cities, including in East Africa, so a visitor in Kampala can receive most of a page from a server a few hundred kilometres away rather than several thousand.
Two settings make a CDN far more effective. First, give each file a name that changes whenever its content changes, for example style.3f9a1c.css. Second, tell browsers and the CDN they may keep those files for a year. Returning visitors then load almost nothing, and an update reaches everyone immediately because its name is new.
Fix two: cache whole pages where you can
Many pages are the same for everyone: the homepage, service pages, articles. There is no reason to rebuild them from the database on every visit. Keeping a finished copy for a short time, at the CDN or on the server, removes most of the server's work and most of the delay. When someone publishes a change, the cached copy is cleared so visitors never see stale content for long.
Pages that differ per person, such as a dashboard or an account page, cannot be cached in the same way. They benefit more from the fixes below.
Fix three: choose where your server lives on purpose
Many systems end up hosted in Europe or North America simply because that was the default option. If most of your users are in East Africa, it is worth comparing alternatives. The major cloud providers now operate regions in South Africa, and there are professional colocation data centres in Nairobi and in Kampala. The right answer depends on where your users are, your budget, and whether your contracts or regulators require data to stay in a particular country.
Be careful about splitting things up. Moving the application closer to users while leaving the database far away can make things worse, because the application then waits on the distant database several times for every single page.
Fix four: make the data layer keep up
Fast code does not help if every request still waits on the database. The most common causes we find are:
- Too many queries per page. A list of 50 items that makes one database query per item is a classic problem. Fetching them together often turns hundreds of queries into two or three.
- Missing indexes. Searching or sorting by a column the database has not indexed forces it to read the whole table. One well-chosen index can turn seconds into milliseconds.
- Repeating expensive work. Figures such as monthly totals or dashboard counts can be calculated once and kept in a fast cache such as Redis for a few minutes.
For systems with users in several regions, read replicas, which are copies of the database placed closer to users, can serve most requests locally. Changes still have to be written to one main database, so this suits systems where people read far more than they write.
Where edge computing fits
Edge platforms such as Cloudflare Workers and AWS Lambda@Edge run small pieces of code in the same nearby data centres as a CDN. They are a good fit for quick decisions that do not need your database: redirects, language or country detection, checking that a visitor is signed in, or assembling a page from cached parts. They do not help much if the code still has to fetch data from one distant database for every request. Use them for the parts of a request that can be answered locally.
Keep it fast after launch
Speed tends to decay as a system grows. Sound operating habits stop that from happening:
- Deploy through an automated pipeline so every release is built, tested and released the same way.
- Monitor response times and uptime from more than one location, and get an alert before your customers notice a problem.
- Resize and compress uploaded images automatically, so a single 8 MB photo cannot slow the homepage.
- Take backups daily and test that you can actually restore them. A backup that has never been restored is a hope, not a plan.
A short checklist
- Measure time to first byte, Largest Contentful Paint and page weight from your users' locations.
- Put static files behind a CDN with long cache lifetimes and versioned file names.
- Cache public pages and clear the cache when content changes.
- Host the application and its database together, as close to most users as is practical.
- Remove repeated queries, add the right indexes and cache expensive figures.
- Automate deployment, monitoring and tested backups.
Most systems become noticeably faster after the first three steps alone, without changing a line of the main application. If your system feels slow to the people who use it, we are happy to measure it with you and tell you honestly where the time goes.
Written by Onen Benard, Founder & Technical Lead