Container logistics is an interesting but complicated topic, with a lot of implicit knowledge kept by industry insiders. In this post, I'll give a brief overview, based on my experiences having worked in the industry for three different shipping companies (all located in Chile) over a period of five years. Hopefully, this will allow people to get more accurate models of the heavy port congestion in Long Beach that has been theorized about extensively here on LW. I can't comment on circumstances specific to that port or the US more generally; but there's a set of underlying intuitions that should give people a solid, universal foundation to think about the issue. Based on those intuitions, I think people are way too optimistic about simple and easy solutions that claim to make major progress on the problem overnight.

Lifecycle of a Container Shipment

I'll start with the basics. Let's say you want to send some cargo from port A to B. Thanks to the invention of standardized shipping containers, this is a relatively easy process, vastly easier than 100 years ago. All the equipment used along the trip (ships, cranes, truck trailers, etc) are specialized for the task of moving containers. This reduces costs dramatically, and makes your cargo arrive faster and safer.

The main trunk lines of international transport are between Asia and the US west coast, and between Asia and Europe (through the Suez canal). There's a significant amount of traffic across the Atlantic too. All of this is done with massive container ships carrying 8'000 or more TEUs (twenty-foot equivalent units. 20' container = 1 TEU, 40' container = 2 TEUs). Then there are many, many feeder services with much smaller vessels, going along the coasts of every continent, delivering cargo to/from smaller ports. I was in charge of container logistics for one such feeder line along the South American West Coast, visiting Colombia, Ecuador, Peru and Chile.

From a user perspective the process of shipping from A to B looks like this: you make a booking with a shipping company. This booking allows you to pick up a standardized container at a depot, which is usually near A, but might be hundreds of kilometers inland as well. You fill the container with your goods, and apply a tamper proof seal. You then arrange to get that container to port A, which will give you a bill of lading (a physical or virtual document similar to a cheque for the goods). The container is then loaded onto a ship, and sometime later that ship arrives at port B, where it can be claimed by someone who holds the bill of lading. The container may or may not be on its original ship: it may have been a straight shot, or it may have been transferred at multiple ports between A and B, e.g., from a small feeder route to a larger trunk route.

After the recipient unloads the container at port B, it returns it to a depot. This depot is either directly owned by the shipping line, or it may be a separate company that offers their services to multiple shipping lines. A depot will typically contain thousands of containers. Here, containers are inspected, and minor damages like tears, dents and oil spills can be cleaned up between uses. Shipping lines will typically insist on a return to a depot even if the recipient immediately wants to ship something back out, for liability reasons.

These depots are concentrated near the port of course, but there are also many depots far away from any port, near important cities and industrial centers. In that sense, a port can have a very large area of influence, and the container fleet that a shipping company keeps will also be spread over this entire area.

Issues of Trust and Cooperation

The whole shipping process involves dozens of actors, from the exporter, through a long chain of companies who handle the container (incurring costs on behalf of the shipment), all the way to the importer. This creates a trust problem: who is responsible for the problems that arise when one part of this chain goes wrong? Some of these companies are hired by the shipping company, others by the exporter or importer, or even by a logistics company acting as a middle man. This is usually solved by some kind of chain of custody, where any problem with the container must be immediately noted and complained about by the relevant party.

I mention this issue because it's important to understand that a major problem like port congestion can't be approached in the same way as something like optimizing the layout of a chemical plant. There is no unified, global objective. All these different actors are trying to make money and shield themselves from having to pay for any extra costs. While there are usually detailed contracts regulating many corner cases, in practice the cooperation between these entities is often done informally, based on long-term relationships between organizations and even between individual people at those organizations.

For example, the exporter usually hires the trucker, and the shipping company hires the port, but then the trucker interacts with the port directly, even though these parties don't have any formal contract. Despite this, they will often know each other and solve smaller problems on the fly without involving their respective clients. Sometimes they’ll bill each other directly for any extra costs, but it’s often hard to translate small favors to precise monetary amounts, so this often ends up being based on reputation and reciprocity.

It’s also important to note that everything related to ship operations (such as the stowage plan I’ll introduce below) must be approved by the ship's captain, who is a naval officer and thus has professional ethical duties similar to a doctor or engineer. The captain is responsible for anything that goes wrong on the ship, they have absolute authority and could in theory refuse to sail for any reason. I mention this to emphasize again that many of the things done in this industry are about properly managing risk and responsibility, and that some optimizations that seem obvious can have hidden legal ramifications.

Port Operations and Container Stacking

Now we get to the part everyone's interested in. What does the flow of containers in and out of a port look like, and how is the space in the port managed?

The most important fact here is that ships are very expensive. A large container ship costs around 100'000 USD for each day of idle time. That’s roughly how much it would cost to lease a ship long-term on the open market, including fixed costs such as crew and ongoing operations, but excluding variable costs such as fuel or berthing fees at the port (i.e., renting one of the berths that allow for loading/unloading). Note that in practice, container ships are mostly owned by the respective shipping company, but the other two major types of ships, bulk carriers and tankers, are frequently leased in this way. The leasing prices of ships also vary dramatically with economic cycles, it is rather a boom/bust type business. The figure I quoted is not meant to be precise, but should be useful to pin down the order of magnitude.

From this we can derive an important guiding principle: minimizing the ship's turnaround time is the highest priority, and everything else must be organized around enabling this. For each visit of a given ship in a port, a ship operator is responsible for organizing the ship's stay. This is someone who works for the shipping company at an office near the port, who is familiar with the port infrastructure and the typical needs of the ship at this and later ports.

The shipping company continuously takes new bookings for all of its ships. Most bookings are made between one month and one week in advance of the ship’s ETA (estimated time of arrival). At the end of that time window, the shipping company stops taking new bookings. At this point, a provisional stowage plan is drafted by the ship operator, specifying where each container will be stowed. This is a hard combinatorial problem, as there are many constraints:

  • ensuring the balance and structural integrity of the ship
  • ensuring that sensitive cargo is stowed in the correct place. Dangerous cargo must be stowed above deck, refrigerated containers (reefers) have their own section with power plugs, wine must be stowed far away from heat sources (engine room), etc.
  • ensuring that the job of the operator at the next port isn't needlessly hard, i.e., not burying containers that will be unloaded soon.

All of this should be achieved while avoiding "wasted" container movements (any movement that isn't loading / unloading) as much as possible.

I don’t have any experience at ports that are part of major trunk routes, but I would expect these issues to be slightly easier to manage for ships that essentially go back and forth between two major destinations (e.g., Shanghai - Long Beach). However, a port such as Long Beach also serves as a transport hub, so only one part of the containers unloaded are actually delivered at this port, with another substantial portion transferred to other ships.

Most customers pick up their empty containers a few days to a week before ETA, although in some cases, customers request earlier pick up and then use the containers as ad-hoc storage of their goods for a few days/weeks at a minor container yard, a train terminal, etc.

Once the stowage plan is made, the port can start receiving containers from customers. The containers are not simply stored in one big pile, but they must be kept separated by type / destination / weight / etc to ensure the stowage plan can be implemented efficiently. It is basically a big and very expensive version of Tower of Hanoi. At this point, it starts getting problematic if a customer wants to make a change to their booking. Getting a container out from the middle of a stack will easily cause 50 container movements (billed at $20 each), and the port doesn't necessarily have enough idle time with their machinery to even do this. A compromise here would be to set this container aside when it naturally comes up in the loading sequence, which only costs one extra movement. This of course wastes time and makes operations harder.

The window for container arrivals closes around 48 hours before ETA, although sometimes the port will accept late arrivals for a fee. A certain percentage of containers always fails to show up, so a final round of adjustments has to be made to the stowage plan.

When the ship finally arrives, it will berth and immediately start unloading, and then loading. A typical stay of a ship is 1-2 days long. During this time, the cranes at the berth should be in continuous operation, not wasting a single second. Almost no amount of money will make the shipping company accept a change to a booking at this point.

After the ship leaves, we now have a second round of Towers of Hanoi at the port, this time with the inbound containers that were unloaded. These are stored at the port and handed out to importers as they send their trucks to pick them up.

Logistical Slack

The important thing to notice in port operations is that the container stacks are relatively close to being "random access", like the memory in your computer. Containers arrive and depart in an unpredictable manner, so they must be put into some sort of order to enable an efficient port stay for the ship. There are many easy suggestions for how to improve port logistics, but they often assume that containers are more or less fungible. This is a bad assumption.

If I was the benevolent dictator of Long Beach, I could enforce more efficient operations in a variety of ways. For example, I could just call in trucks, put arbitrary containers on those trucks, and tell the driver to go wherever this container must go. But not all truckers are willing to travel to arbitrary locations. Not all containers can accept the same kind of truck (e.g. due to weight differences). There are typically trade-offs in terms of reliability vs cost for different truckers. Also, each individual shipment (of one or a few containers) must be cleared by customs separately before it can leave the port.

Similarly, I could stack the containers much more closely together, sacrificing the "random access" property in the process, to create extra space in the port that might increase average throughput. However, this would destroy any guarantee that a given container will ever get out of the port. Humanity as a whole might be better off, but the owner of that particular cargo will be severely affected. The stacks must also be kept separate for different shipping companies. We are not at the point where we can make shipping itself fungible (e.g., forcing one company to carry the empty containers of another back to Asia) because this would require solving complex issues around the sharing of costs and liabilities.

What these kinds of proposals have in common is that they trade off a resource which I'll call "logistical slack" against an immediate, temporary relief of the congestion the port is facing. Losing this logistical slack is similar to "technical debt", a term from software engineering that describes how a piece of software becomes harder to modify and maintain over time, because the people working on it are incentivized to solve their short-term problems in fast and hacky ways, and neglect to maintain a coherent architecture for the project. Technical debt is a bad place to be, and it tends to kill projects over time.

Giving up logistical slack is a terrible idea for very similar reasons. It would cause all operations to become more complex and expensive, like a debt that demands continuous interest payments. The momentary relief created would immediately be consumed, not necessarily in the most efficient way, but rather to appease those who complain the most forcefully. Furthermore, a port simply never has the downtime to do a "spring cleaning"-style reorganization. Thus, any problem created must be cleaned up incrementally over many, many cycles of normal operations. A decision that seems like a good idea now may leave a mess that lasts for years, with the true costs not becoming immediately apparent.

An Aside on Minor Container Yards

I’ll now briefly focus on the container yards where the stacking limit of height 2 was famously removed in Long Beach. If I understand the situation correctly, these are minor yards mostly belonging to trucking companies, which are used as a base of operations for a fleet of trucks.

Such a yard will have some space that can serve as short-term storage for both full and empty containers. For example, a customer has a full warehouse, and wishes to send out a shipment before the shipping company opens its arrival window at the port. The trucking company can arrange for this using their own storage space. Another frequent situation is that there is a truck with an empty container that was just unloaded at some importer’s facility. This container would usually be directly returned to the shipping company. However, if the truck is urgently needed, the trucker can save time by simply dropping it at their own yard, going on to do higher priority work, and return this container a few days later when they have some downtime and their opportunity cost is lower.

I believe that the stacking limit of two for these depots didn’t arise by coincidence. It just happens to be that containers can be stacked up to two high with a standard forklift. This is exactly as sketchy as it sounds and has a tendency to damage the container and can even cause accidents. Any stacking more sophisticated than this requires specialized vehicles (reach loaders, top loaders, etc) that cannot easily travel and are thus dedicated to one site.

I don’t want to claim expertise that I don’t have, and I certainly don’t know the specific situation in Long Beach. But for whatever it’s worth, I believe quite strongly that no significant storage capacity was unlocked by Long Beach’s suspension of stacking height limits.

Container Fleet Management

Container traffic is not balanced across both directions of each given trade route. Most noticeably, the flow of consumer goods from Asia to the US and Europe creates a huge imbalance, which the shipping companies correct for by making regular shipments of empty containers. Similarly, many locations have seasonal products requiring specialized containers. For example in Chile, there are yearly spikes in the demand for reefers, to export avocados and many other fruits and vegetables.

An important part of my job was to keep on top of these imbalances and plan for future demand, requesting empty shipments in and out of "my" ports, keeping the stock low, but not too low. Sometimes, reality did not match the sales projections, and then we ended up either with severe shortages or huge mountains of idle containers.

The former situation caused salespeople to be upset with me, and forced me to burn a lot of accumulated trust with my suppliers to make things happen on tighter timelines. Containers arriving on a given ship can in theory be turned around fast enough to be exported on the next ship just a week later, but this will require calls to importers pleading to return the containers fast, night shifts at the container depot for repairs, longer arrival windows at the port, etc. It can be done, but it's not a sustainable way to work. Any shipping company that tries to cut corners in this way will quickly find itself not receiving the favors (both small and large) that are needed to ensure smooth operations.

The latter situation (too much stock) caused the global offices to be upset with me, since containers are always in short supply somewhere in the world. There's nothing worse than asking for empty containers to be shipped to us, then sending them back empty four months later, with no paying shipment to cover the costs. In those cases we'd ask sales to call up their customers and offer below market rates to destinations X,Y,Z as a one-time deal, for big volumes only.

Shipping companies often rent large batches of containers on a long-term basis, with somewhat flexible conditions of pick up and return. This is a further tool used to balance the fleet. If bookings are lower than expected, the global office will simply return a few hundred containers in Asia to their owners instead of shipping them to us in Chile, while we use our excess stock to cover those future shipments. That's another source of non-fungibility, since different containers should preferentially be used on different routes, to ensure proximity to their eventual place of return. Again, there's no worse failure than having to ship an empty container halfway across the world with multiple transfers, only to return it to its owner.

I'll close this post with a funny anecdote. One of our depots once lost a container. Yes, they just lost an object measuring ~80 cubic meters. When it arrived, they entered it into their system, but the container was later not to be found in the stacks where it was supposed to be. They went and physically searched through the whole depot. There was a months long back and forth where we settled on them just having to buy the container from us, and doing whatever they wanted with it if it ever turned up. But then, just before finalizing this, I got a call from my contact at the depot. He was staring out his office window when he noticed that one of the containers that was visible in a stack just a few dozen meters away had a serial number that seemed strangely familiar... he looked up that number only to realize that it was in fact the long-lost container!

New Comment
22 comments, sorted by Click to highlight new comments since: Today at 2:26 PM

Curated. Some things I appreciated here:

  1. I generally think people with a lot of experience in a field writing up an introduction to that field is a type of LessWrong post I'd like to see more of on current margins.
  2. I especially like such posts when they're tied into understanding a potentially actionable problem or plan (such as how this post was a response to Zvi's proposal about identifying and acting on low-hanging-civilizational-adequacy-fruit).

Thanks to Elizabeth for encouraging me to write this, and for her helpful feedback!

Cool post with insights into an interesting industry!  

I've been in positions with executive authority in multiple locations in multiple industries and at my best guess 90% of quick fixes had maximum 10% positive impact (ranging to greatly negative impact) that they were supposed to have.

Much of what humanity does is too complicated to completely understand and formalize into structures that enable the type of analysis that allows you to figure out the right "quick fix"...particularly to outsiders!  (Not to discount the very real benefits outside eyes can bring to a problem.)

 

edit: To expand, I'm not talking about only quick fixes created and implemented by me.  There's always someone coming in with some thing to fix all our problems and we'll either see the shortcoming's of the plan up front or try them out and be disappointed.

 

edit2: Previously I said "quick fixes had 10% of the impact". I just changed that to something more accurate.

Do you mean that they had only 10% of the impact they were supposed to have? If they had 90% (i.e. almost all) of the planned impact, that's pretty good. There's always small details that were missed.

Ahh yes, 10% of the impact they were supposed to have.  Thanks for noting that.

Nice article.

I worked for a startup in Hampton Roads, VA a while back trying to develop a software program that could predict the location of empty containers so that truckers who delivered a full container more than just a few miles outside of the port areas could save time in locating an empty to bring back. It's been at least 5 - 6 years, and I don't remember all of the details, but I remember spending a lot of time involved with trying to understand this industry. 

One of the problems, as I recall, was the proprietary nature of some of the information. By that I mean, there was a brokerage or something that actually knew where all the containers were, but they were not going to release that information. So we had to rely on open source bill of lading information from U.S. Customs to develop our model, and even though we had a lot of data, it was still scant in the overall scheme of things. And this goes directly to your observation that all the actors are pretty much in it for themselves. 

On a separate but related note, a few years later my wife and I rode a contaier/RO-RO cargo ship for two weeks from Baltimore, MD to Hamburg, Germany. We had stops in Norfolk, VA . . . Halifax, Nova Scotia . . . and Liverpool, England along the way. It was fascinating watching port operations from that perspective. And if anyone's interested, I wrote a travelog about that journey, with links to two aspects of shipping that few people think about: the evolution of those 20-foot boxes, and the hidden role of the wooden pallet.

https://cargoshipvoyage.blogspot.com/2019/

I worked for Maersk Ops back office for a couple of years. This brought back memories of the seemingly endless hours I use to put in to prepare the Discharge & Load Coprar and the dreaded Stowage plan.

Out of curiosity, do you broadly agree with my depiction of the industry? Anything I missed or mischaracterized?

Vitor, allow me in this conversation. I also have been in the industry and you have done a great job describing overall operations. A piece of the container shipping puzzle you didn't cover was chassis, and these are a key ingredient to the operations. Since there are proprietary pools, third party pools, and grey pools, this adds another degree of complexity. Some trucking companies in LA claim that chassis availability is one of the primary issues:  no chassis, then no container move in/out of the port. Thanks for writing your article.

Can you expand on this? I imagine there's lots Vitor left out that is worth expanding on because that is the nature of writing these kinds of things. Since no piece can be comprehensive I'd rather people add what they think was missing rather than give another task to the original author (and I really want to know what's going on with chassis).

Elizabeth, every container that moves must be placed onto a chassis (wheels). When an import loaded arriving container is off-loaded from the ship, it is typically placed (without wheels) onto the dock yard stack of containers. The party receiving the container (consignee) is notified that the container is now available and they typically make arrangements with a local trucker/drayage company to pickup the available loaded container. The trucker usually must obtain a chassis from one of the pools (mentioned in my earlier comment) and go to the shipyard dock to pickup the available load where the shipyard places the loaded container onto the chassis the trucker brought into the yard for pickup.  The loaded container is then moved from the shipyard to the local consignee for delivery. After it is delivered and unloaded, the now empty container (still on the chassis) must be returned to the ship dock and then the chassis returned to the pool. However, empty containers are piling up in the ports (https://www.reuters.com/business/retail-consumer/port-los-angeles-import-backups-ease-empty-containers-pile-up-2021-11-16/) impeding the return of newly empty containers, and thus you see the trucking companies reporting, "Our chassis are sitting under these empties that have nowhere to go." and "Not because we have capacity issues but we cannot return the empties for days. Empties sit on our chassis in our yard(s) accruing charges." So chassis availability to pickup loaded containers from the ports is currently very unreliable.  It is a complicated issue and what I've described above is a generalized explanation. Hope this helps.

Yes, I deliberately left out detailed discussion of the present situation in Long Beach, instead focusing on what "normal" operations are like. Local conditions also vary a lot, for example I hadn't heard of these chassis pools you speak of.

Oh, I really enjoyed reading this, this is so LW-rationality-curiosity-boggle-at-things post. Thanks!

I'm wondering who, if anyone, keeps track of throughput at a port? Ideally there would be some kind of graph of containers shipped per day and we could see long-term shipping trends.

(This is making a bad assumption that containers are fungible, but we would at least have a rough idea of how bad the problem is.)

The Port of Long Beach, whose problems instigated the post the OP is responding to, publishes container movements here:

https://polb.com/business/port-statistics/#teus-archive-1995-to-present

They're up ~150,000 TEUs since early last year (just plotting the "total" column and eyeballing it).  IIRC, most containers are 40', so that's somewhere around 75,000 more containers per month.  Note that this it both inbound and outbound, full and empty.

There's enough uncertainty in both of those figures I wouldn't take it to the bank, but it shows that shipping volumes have increased at the port.

My story of this post:

  • Someone provided a model of the world that relied on specific beliefs about how container shipping and ports worked.
  • The beliefs about the gears of container shipping were wrong, in ways that meant the example couldn't support (or weaken) the larger claim.
  • This post spelled out details on container shipping so we could understand why the claim was nonsensical.

 

It was also generally interesting and grounded in a way I'd like to see more of on LW.

Full disclosure: I offered the writer money for fleshing out his original comment, although at the moment I can't remember if he actually took me up on it. 

I've got a friend who works in refrigeration. He fixes containers when they have issues. Occasionally, he isn't able to meet the deadline. When this happens he is told to "Chuck it onto the next ship", and then he just places the container on the queue for the next available ship. He's worked for years now, and this still blows his mind that he's able to do this. Like, containers are not assigned to ships, but to something else? I've spoken to a few others and there appear to be some sort of shipping container cycles or circuits that allow this to happen, but when I google for "shipping container cycle/circuit" I don't find what I intend to find. I'm not looking for the right keyword, clearly.

My question is: what guarantees that the container goes from A to B, and doesn't just go from A to B to C to D to ... back to A? What directs containers to their destination once they leave the starting port?

I'm a bit confused about the situation you're describing. The shipping company promised to deliver the container at B, so they arrange for the proper routing. Any transfer port along the way has a contract with the shipping company and transfers the containers as directed by them.

Delivery is not guaranteed to happen on the exact predicted schedule though, which is what you might be talking about. For various reasons, containers often end up missing their connection and waiting for the next available ship (of the same service going to the same destination). It also happens occasionally that a ship has to alter its route (e.g. skipping a port due to congestion), which leads to additional unplanned transfers. All of this is ok, because the contract between shipping company and customer is on a "best effort" basis, i.e., it's ok to deliver with a delay if it's unavoidable.

If a reefer container has issues while on board a ship, it will be unloaded at the next possible port, because this makes it possible to save the cargo by moving it to another container in the event of total failure. But we want to avoid this (because it involves high costs and breaking the container seal) so we'll try to repair the container while the cargo remains inside. If repaired successfully it can continue its journey on the next available ship.

Hope that makes everything clear.

Very nice post indeed.

How do you plan for future demand ? Do you use quantitative modelling with local economic indicators or is it more based on "best guess" & experience ?

It's more the latter. At the local level, salespeople are supposed to have a very good handle of their clients' future demand. A lot of the trade is also seasonal, and rises and falls in a correlated way (e.g. fruit exports will have good/bad years depending on climate)

When it comes to overall economic trends, I don't really know. That stuff was handled way above my paygrade by global HQ. But it definitely can happen that a certain route requests many empty boxes to be shipped to them, only to have them sitting there because projected demand did not materialize. These kind of imbalances can be corrected by letting them drain away over time; demand doesn't shift so much that net importer/exporter status of a region flips. This "passive" management ends up being cheaper most of the time.

Thanks for the write up Victor. It was an interesting read, though I won't say I read very closely or critically.

I am interested in your views on a question about routing and how it's currently accomplished. I'm putting the containers into a network metaphor so they can be viewed just as any network packet traversing the internet. Is the container routing  similar in that regard where the "packet" hits various hops on the way and some mechanism exists for calculating the current best path to the end point?

It wasn't clear to me from your post if there was anything like a defined path at the outset or what "next ship out" in the case of some container delay on the way meant next ship that was eventually going to the destination or next ship with the quickest expected delivery -- or even if the information for making such an assessment was easily available. 

It's not like a network packet, there is a planned route from the outset. This route is also used to set the correct price to charge.

The path might be changed when logistically required (by delays, congestion, capacity limits along the routes), but this is infrequent.