In the late 19th century, the French had tried building a sea-level canal through Panama that ignored water’s inevitable flow downward. It was aborted after 22,000 Frenchmen died of tropical diseases; their burial sites still line the outer ring of the canal. The United States finally built it nearly right, thanks to President Theodore Roosevelt and some US-backed rebellions that helped Panama gain independence from Colombia.

Now, a massive $5 billion infrastructure project is attempting nothing less than to master gravity again, and, in the process, to tame the flows of globalization. The 26,000 Panamanian workers who are now making the canal deeper and wider designate the Atlantic as North and the Pacific as South. For ships to rise or fall with these waters, the canal has a complicated system of locks where vessels are isolated and water flows in or out to move them up or down. The locks will be made more modern and streamlined; huge slabs of concrete mark the eventual home of these steel compartments.

Panamanians, who gained control over the canal after a politically bruising fight in the US Senate in the late 1970s, overwhelmingly voted for the expansion in a 2006 referendum. But the United States is a close partner. The two countries are still inextricably linked. There is no continental waterway in the United States; Panama is our cut-through. With 65 percent of canal cargo traffic originating in or destined for the United States, the changes here are being carefully followed by American industries looking to speed up transport of goods. The expansion is all about eliminating “dwell time.”

To make that happen, the canal has to get bigger. It is narrow on both ends, and wide where the artificial Gatun Lake opens. Men, all men, look like flies against the backdrop of an excavation that will make the canal deeper in parts, much wider, and much more efficient. There are dumpsters everywhere, hundreds of them moving dredge and dirt and clay to new mountains — called Panama’s Pyramids — every hour of every day. The skyline looks like a crane festival. Large trucks, with wheels that would crush an SUV, and, according to the proud guide, whose tires cost over $20,000 each, rush in all directions, moving land to make way for water.

All this activity is because of a basic math problem. Ships used to be built to cater to the size limits of the 50-mile-long canal; they are known as “Panamax” vessels and are often over 105 feet wide, leaving just a few feet on each side to get through the narrowest parts of the canal. It isn’t much, and the Panamax boats, carrying up to 5,000 steel containers, known as TEU (for 20-foot equivalent unit) boxes that are the measure of productivity in the world of shipping, barely fit through the cramped space. The process of moving a ship through is amazingly quiet, as if the ship itself were holding its breath to seem skinnier for a tight-fitting dress.

The Panamax boats limit how much grain, or coal, or retail items, or soybeans, or any other items going to market can fit. Too many small boats made the canal inefficient. When it gets too crowded, or something goes wrong, wait times can last as long as 10 days.

To remain competitive in a global transportation industry where the vast majority of all goods are moved on waterways, the canal had to change. Ships that are too large for the canal take their goods elsewhere: to Suez, or the Straits of Malacca (between Malaysia and Indonesia), or the ports of Los Angeles where cargo is routed on the “land bridge” of railways and highways from West to East Coast. Or the large ships are unloaded at the base of the Panama Canal onto smaller vessels, a process that occurs here every Friday-Sunday.

So-called post-Panamax ships, so big they can exceed 10,000 TEU capacity, are the future of the global supply chain. The vast majority of ships on order are post-Panamax, and by 2030, nearly three-quarters of all shipping will occur on these mega-vessels.

And so they dig, and excavate and alter the landscape here, once again trying to master the waters that connect the world and its economy. History does not tolerate long dwell times.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.