Fastly (FSLY -3.35%) and Cloudflare (NET -1.05%) both host content delivery networks (CDN), which accelerate the delivery of digital media to websites and apps by storing cached copies on "edge" servers. These are located physically closer to end users than the original "origin" servers.

This system, which resembles a digital spider web, reduces the strain on origin servers while delivering media to users at faster speeds. Both companies also integrate security and bot detection services into their CDNs, which shield website visitors and hosts from malicious attacks.

An IT professional works on a server in a data center.

Image source: Getty Images.

The global CDN market could grow at a compound annual growth rate (CAGR) of 26.8% between 2022 and 2026, according to Technavio, as the growing usage of cloud-based services, streaming media, and mobile apps drives more companies to store their content on edge networks.

That bullish forecast should make Fastly and Cloudflare attractive investments. However, Fastly's stock plunged nearly 80% over the past 12 months as Cloudflare's stock tumbled more than 50%.

Both stocks were hit hard by rising interest rates, which drove investors away from the market's pricier tech stocks. But are either of these beaten-down growth plays worth buying as a turnaround play?

What happened to Fastly?

Fastly's revenue rose 45% in 2020 (partly driven by its acquisition of Signal Sciences in October 2020), but grew just 22% to $354 million in 2021. Revenue rose 21% year over year in the first quarter of 2022, but Fastly expects revenue to increase just 14%-17% to $405 million-$410 million for the full year.

Fastly's growth stalled out in the second quarter of 2021 after a major service outage in June 2021 resulted in its loss of several large customers. Its growth gradually stabilized over the following three quarters, but its trailing-12-month net retention rate dropped from 137% in 2020 to 118% in 2021, then dipped again to 115% in the first quarter of 2022.

As Fastly's retention rates slipped, it struggled to gain more customers. Its total customer count rose 30% year over year to 2,880 in the first quarter of 2022, but that only represented 3% growth from the previous quarter.

Its average customer spend also fell 10% year over year as it generated more revenue from Signal Sciences' lower-value customers. Its dollar-based net expansion rate (DBNER), which gauges its year-over-year revenue growth per customer, fell from 143% in 2020 to 121% in 2021, then dropped to 118% in the first quarter of 2022.

Those sluggish growth rates suggested Fastly was losing ground in the fragmented CDN market, and the ongoing compression of its adjusted gross margins -- which fell both sequentially and year over year to 52.6% in the first quarter of 2022 -- indicate it's losing its pricing power.

Fastly isn't profitable by GAAP (generally accepted accounting principles) or non-GAAP metrics and it expects non-GAAP losses to widen for the full year. Another red flag went up when CEO Joshua Bixby -- who took the helm just over two years ago -- tendered his upcoming resignation in early May.

Cloudflare is generating more impressive growth

Cloudflare's revenue rose 50% in 2020 and increased 52% in 2021. Its revenue grew 54% year over year in the first quarter of 2022, and it expects revenue to increase 46% to about $957 million for the full year.

Cloudflare also suffered a few minor outages over the past year but didn't suffer a crippling service disruption like Fastly. Its total number of paying customers rose 32% in 2020, 26% in 2021, and 29% year over year to 154,109 in the first quarter of 2022. The company also continued to squeeze more revenue from those customers -- DBNER rose from 119% in 2020 to 125% in 2021, then increased to 127% in the first quarter of 2022.

As Cloudflare grew its customer base, its adjusted gross margins expanded. In the first quarter, the company's adjusted gross margin increased both sequentially and year over year to 78.7%. That expansion along with its growing customer count and rising DBNER indicate Cloudflare has a lot more pricing power in the CDN market than Fastly.

Cloudflare isn't profitable by GAAP measures yet, but it's gradually turning profitable on a non-GAAP basis. It expects to generate $10 million-$14 million in operating income in 2022, compared to an operating loss of $7 million in 2021, with a slim non-GAAP profit of $0.03 to $0.04 per share -- which would also be an improvement from its non-GAAP loss of $0.05 per share last year.

Cloudflare's co-founder and CEO Matthew Prince, who has held the top job since 2009, should also remain in charge for the foreseeable future.

Is Cloudflare the obvious winner?

Cloudflare certainly seems like a better investment than Fastly. It's growing a lot faster with higher margins, expansion rates, and non-GAAP profits.

However, Cloudflare's stock is more richly valued at 17 times this year's sales. Fastly trades at just four times this year's sales. That double-digit price-to-sales ratio could limit its upside potential in this challenging market.

I wouldn't rush to buy either of these stocks, but I believe Cloudflare's growth rates will support its higher valuation. It might stay stuck in neutral this year, but it's a more compelling long-term buy than Fastly.