Germany's biggest bank is taking the knife to costs after posting a massive 6 billion euro ($6.6 billion) loss in the third quarter.

Deutsche Bank will cut 9,000 full time jobs and reduce the number of technology contractors it uses by 6,000. The bank said another 20,000 jobs will be shed over the next two years as it sells businesses and withdraws from certain markets.

Taken together, that represents a 27% fall in the number of people employed at the bank.

The sweeping overhaul is part of efforts by new CEO John Cryan to help Deutsche compete with its global peers by reducing the cost and complexity of operations.

Related: Deutsche Bank warns of $7 billion loss

The bank will close 200 branches in Germany -- with the loss of 4,000 jobs -- and pull out of 10 countries altogether, including Argentina, Chile, Mexico, Peru, Denmark, Finland and Norway.

Deutsche Bank (DB) is paying a heavy price for years of management, business and technology failings.

"We know exactly where we want to go, but for many years Deutsche Bank has had a serious problem with executing the strategy," Cryan told reporters.

Litigation costs alone have totaled 11 billion euros since 2012 -- including a hefty Libor-rigging fine earlier this year -- and tougher regulation has forced it to write down the value of investment and retail banking.

Related: Russia is getting too hot for Deutsche Bank

Deutsche will completely rethink the way it uses technology. It will work with startups, innovation labs and others to look at new technologies, and defend its business from potential disruptors.

"We have a traditional business in transaction banking... and we may have an 'Uber' moment and find that there's a new way of doing it. We need to protect that business," Cryan said.

In addition to slashing costs by 3.8 billion euros by 2018, the bank is also likely to scrap its dividend this year and next to preserve cash.

Shares in the bank fell more than 6% Thursday. They've gained just 3% this year compared to a jump of 10% on Germany's DAX index.

Cryan said settling outstanding legal and regulatory investigations will continue to weigh on the bank's performance through 2017.