What do you when you face Goliath and the path ahead looks tough? You make peace with your rivals, and that is precisely what Kroger and Target seem to be doing.

As Amazon increases its share of the grocery industry, big names that once led the grocery wars are struggling. The only ones who have deftly used resources to keep ahead of the curve are Walmart and Costco.

Things are looking rather bleak for the rest, but that doesn't mean they are throwing in the towel. Target and Kroger, for example, are discussing a possible merger to beat this Amazonian storm.

Their talks have made headlines recently, but the conversation began in 2017, when the two companies first met to discuss possible partnership options. There is great opportunity for both to benefit as Kroger could improve Target's grocery business, while Target offers Kroger customers access to merchandise and robust e-commerce.

Talks are continuing, and both sides are trying to comprehend whether a merger is the best path forward. Whatever they decide, the very fact that they have started a conversation on the merger is a sign of things to come.

A closer look at the possible merger

The combined annual revenue of Target and Kroger is close to $195 billion with 4,600 stores between them nationwide. They can now merge their resources to fight the competition, something that seemed difficult even before Amazon's foray into the online grocery business and then its takeover of Whole Foods.

Amazon's bold move has put tremendous pressure on retailers in the food industry. Target and Kroger have faced severe competition from Walmart over the years. Now with the digital juggernaut Amazon, the partnership seems to be the smartest way to survival.

The merger valued at more than $35 billion would marry the mass discount chain that only does 20 percent of its business in food and beverage with the nation's largest supermarket chain. Target also brings with it the same-day delivery service Shipt, which it acquired for $550 million.

This could enhance Kroger's own delivery service, while Target enjoys a wider grocery selection, something it is not quite known for. Kroger is currently partnering with Instacart and ClickList to support home delivery service for some of its stores. This service needs a boost, and the merger could make that happen.

Industry analysts, however, urge caution. While the merger would give both retailers enhanced scale, they need to tackle their underlying weaknesses to make the new partnership work.

How is Walmart faring?

While others are struggling, Walmart has aggressively pushed further into the online space. Just as one can order groceries on Amazon via Alexa, Walmart shoppers can do so via Google Home now.

Walmart is still the leader in the space as it commands the largest share of the $800 billion U.S. grocery market. One of the key reasons for its success is adaptability, the ability to innovate and change and leverage its resources well.

It is the first retailer to create a specific millennial-focused grocery brand on Jet.com, justifying its $485.9 billion in revenue. This year, the retail grocery giant is also set to make its grocery delivery service available to 40 percent of U.S. households.

Unless other retailers come up with more innovative solutions, it will be difficult for them to keep up with the dual onslaught from Walmart and Amazon.