You know a traffic jam is bad when it has a second chapter, which is exactly what Kevin McKenna discovered Monday morning when he left the Cape just after 9, believing he could slyly avoid the nightmarish backups of Sunday afternoon’s exodus from Cape Cod.

“I was absolutely shocked,” said McKenna. “It was brutal.” It took him well over an hour to get from Harwich to the mainland.

Still, Monday’s slowdown was nowhere near as bad as the epic tie-up of Sunday afternoon, a day that has already become part of traffic legend: a 25-mile backup, with some reporting an eight-hour journey from the Outer Cape to Boston, an infuriating crawl in stifling summer heat.

It was so bad that drivers desperate for any movement battled to get off the highway, making matters worse.

Even in the infamous annals of Cape Cod traffic, it was cruel and unusual.

“It’s usually bad,” said Sandy Rabb, whose trip from Provincetown to Boston took six hours, five of them on Route 6. “But this was insane.”

LEAH JACOB

A Route 6 sign told the bad news.

State Police said the backup was three times as long as a usual summer Sunday, and longtime Cape-goers said delays were far worse than usual on Fourth of July weekends.

The timing of the Thursday holiday, giving many people a four-day weekend, combined with the sweltering weather, sent people streaming toward Cape beaches, observers said.

Then, as temperatures again topped 90 degrees Sunday, people did not rush to leave.

“We had that right mix,” said Jay Zavala, president of the Falmouth Chamber of Commerce. “It was a holiday weekend, and it was a stifling weekend. We did not have one vacancy from Thursday afternoon to this morning. We’ve had a full town.”

While the weather caused more cars than usual to overheat, the massive delays were almost entirely a product of a longtime Cape reality: legions of cars making their way to essentially the same place.

“There were no crashes, no inclement weather,” said Michael Verseckes, a spokesman for the state Transportation Department. “Nothing other than volume alone.”

The snarled traffic did not subside for hours. At 9:45 a.m., the line of cars stretched 5 miles from the Sagamore. At 2 p.m., the backup was some 22 miles, and around 5 p.m. it was still 13, according to state figures.

The Transportation Department issued a traffic advisory July 2, warning that road congestion would probably be heavy Sunday afternoon.

In May, the department released a new smartphone application that provides real-time traffic information on several major roads, including Route 6 on the Cape.

Verseckes said officials have long encouraged drivers to leave the Cape either early or late.

“The best we can do is offer advice to people,” he said. “And in yesterday’s case, unfortunately that’s not enough.”

In 2006, the state replaced the Sagamore rotary with a straight stretch of highway known as the flyover, a $60 million project that significantly improved the flow of traffic.

Weekend train service between Boston and Hyannis began this spring, and between Wednesday and Sunday it drew more than 2,300 riders.

There are no other plans to improve traffic flow under consideration, Verseckes said.

Kristina Egan — who directs Transportation for Massachusetts, an advocacy group — said the Cape traffic problem requires a “nonroad answer” and said fast, well-marketed train service could provide a viable alternative.

While removing the rotary improved traffic, it also encouraged more cars to come, Egan said.

The extent of Sunday’s traffic caught even regular visitors by surprise.

Rabb, a 58-year-old who often travels to Provincetown, said she usually leaves early Sunday mornings and gets home in about three hours.

When Sunday dawned sunny and hot, she figured she had extra time — surely people would want a bit more beach time.

Then she hit the Orleans rotary and barely moved for the next two hours. Making matters worse, frustrated drivers were crowding the exits to escape the gridlock on side roads.

Rabb recalled one driver in a Maserati pushing his way to the exit. She saw him again on the bridge, having gained not even a mile of ground.

Rabb arrived at her South End home at 4 p.m., six hours after leaving. For 15 minutes, she sat in her parking space, trying to decompress. When she got out of the car, her legs were so tight she could barely walk.

“I will not do that again,” she vowed.

After a long holiday weekend in the calm of the Outer Cape, Hayley Manin packed up the car Sunday morning to head home.

But before long, the sand dunes and salt marshes gave way to the real world: the grinding gridlock of Route 6 west.

Manin had hoped the holiday crowd might leave in shifts.

But when she checked the traffic on her phone, it showed red all the way to the Sagamore Bridge; she would not see the landmark span for well over three hours.

“It was a perfect trip in every way,” said Manin, a 31-year-old who lives in Brookline, “until the end.”