You might assume that if your favorite websites or videos take ages to load in Nairobi or Lagos, it’s because the local internet connection isn’t very good. But increasingly, you’d be wrong.

In June David Weekly , a Google product manager, looked at loading speeds for various websites as he sat in Jomo Kenyatta Airport in Nairobi. The quality of the Wi-Fi itself was excellent but many sites were still loading slowly, so Weekly investigated where those sites were being served from. He found that Facebook and Google Kenya were reaching him from London; Apple was coming to him from Paris; and Twitter was trekking all the way from Atlanta, Georgia.

Data moves fast, but it still takes time to travel great distances. Each time you click on a link to a web page, your device sends a request that is routed to a server where the web page is hosted, and the data for the page is sent back to you. That server can be tens or hundreds or thousands of miles away; if it’s thousands, the round trip can be a considerable fraction of a second, and a typical web page is built up out of dozens of such requests to servers in different places.

Moreover, most of the websites Africans visit are hosted overseas, so they feel these long latency gaps more often than users in, say, London or San Francisco.

A much bigger problem with overseas hosting isn’t speed, however, but cost. Figures from Nairobi-based startup Angani show that a connection to the Kenya Internet Exchange for one gigabit per second costs internet service providers (ISPs) $350 per month, while the same amount of data from an international submarine cable costs a staggering $200,000. So even if a user pays an ISP for a fast internet connection in Kenya, data may flow much more slowly from overseas.

As “last mile” infrastructure (i.e., the internet connections themselves) has improved on the continent, hosting infrastructure has not kept pace. As an example, Google reports seven data centers in the US, four in Europe, two in Asia, one in Latin America—and none in Africa. (This is not to pick on Google, which has lots of other infrastructure in Africa and has done some good work to improve content delivery.)

Angani is one of the key players now changing that story. As its CEO, Phares Kariuki, told me, “in our Nairobi office there are four different infrastructure providers running high speed fiber links just to our building. So when it comes to infrastructure on the ground we have more infrastructure than some US cities. We also have a multitude of undersea cables for bringing in data internationally—four cables land in Mombasa alone. So raw capacity is no longer the issue. But the speeds are still not improving, as David Weekly pointed out, simply because the content is not hosted locally. We lose the benefits of having in-country delivery infrastructure by not having reliable hosting infrastructure.”

Over the past two years Angani been rolling out improvements, including over a thousand servers and associated cloud-management software, connected directly to the local internet backbone. This is the sort of basic infrastructure that makes it practical for web content viewed locally to be hosted locally as well.

While Africa currently accounts for only 3% of global internet traffic, faster and cheaper internet should launch a virtuous cycle. Better infrastructure will enable Africans to use the internet in ways that are currently not possible, upping the continent’s share of global traffic and therefore spurring more investment and more improvements.

One company that will benefit is health-care technology startup mPharma, which is building an electronic prescription system aimed at making drugs easier and cheaper to buy. Patients can the app to check the availability of drugs at nearby pharmacies, while doctors, pharmacists and pharmaceutical companies can use it to make sure the right drugs are supplied to the right places. Two major benefits that mPharma would get from better internet infrastructure, says its CEO, Gregory Rockson, are “a reduction in the lag time between searching for a drug in the app and getting a response on where it can be found” and the ability to “include more data-heavy features in our app without having to worry about the cost that comes with it.”

For Rockson, lower costs are just as important as higher speeds. “Cheaper internet opens the door for greater access to the majority of Africans who have been left behind in the internet economy,” he says. As Angani has written, “We believe that Africa’s internet evolution story will be no different from the rest of the world. We listen to music. We watch movies. We play games online…. Let’s bring our content back onto the continent.”