Fastly (FSLY 4.43%) has taken investors on a roller-coaster ride since its IPO in May 2019. The content delivery network (CDN) provider went public at $16 per share, and its stock skyrocketed to a record high of $128.83 on Oct. 13, 2020.

But today, Fastly's stock trades at about $14. A $10,000 investment in its IPO would have blossomed to more than $80,500 before withering to less than $8,800 today. That's a dismal return compared with its larger CDN rival, Cloudflare (NET 1.44%), which went public at $15 in September 2019 and currently trades at about $100.

A couple watches a video on a tablet computer next to a river.

Image source: Getty Images.

Fastly underperformed Cloudflare because it was growing slower, had lower retention rates, and operated at lower margins. A service outage in 2021 and the resignation of its CEO Joshua Bixby in 2022 also rattled investors, while rising rates and other macro headwinds exacerbated that pressure by throttling its growth and compressing its valuations.

However, Fastly's business seems to be stabilizing under Bixby's successor, Todd Nightingale, and its stock looks historically cheap at three times this year's sales. By comparison, Cloudflare's stock still trades at 20 times this year's sales. So could Fastly mount a surprising comeback over the next decade and turn $10,000 into $1,000,000?

How fast is Fastly growing?

Fastly's CDN accelerates the delivery of images, videos, and other digital content for websites by storing cached copies on its edge servers, which are located closer to a website's visitors than the origin servers. It also blocks bot-based attacks. The CDN market is expanding as faster internet speeds drive businesses to launch more media-intensive websites.

From 2019 to 2023, Fastly's revenue grew at a compound annual growth rate (CAGR) of 26% from $201 million to $506 million, its total number of customers rose from 2,084 to 3,243, and its adjusted gross margin expanded from 56.6% to 56.9%. It also maintained an annual revenue retention rate of about 99%.

That top-line growth looks healthy, but Fastly's net loss still widened from $52 million in 2019 to $133 million in 2023 on the basis of generally accepted accounting principles (GAAP). Even on a non-GAAP basis, which excludes the stock-based compensation that consumed 27% of its revenue in 2023, its net loss still widened from $19 million to $22 million.

By comparison, Cloudflare ended 2023 with a much higher adjusted gross margin of 78.3% and remains profitable on a non-GAAP basis. Those comparisons suggest Fastly is struggling to keep pace with Cloudflare in the CDN race.

What will happen to Fastly over the next decade?

For 2024, Fastly expects its revenue to rise only 15%-17% as it narrows its adjusted operating loss from $37 million to a range of $14 million to $20 million. It also expects to narrow its adjusted net loss from $0.17 to a midpoint of $0.03 per share.

But that would still represent a deceleration from its 17% revenue growth in 2023 and 22% growth in 2022. From 2023 to 2026, analysts expect Fastly's revenue to grow at a CAGR of only 15% as it remains unprofitable on a GAAP basis.

However, they expect Cloudflare's revenue to rise at a CAGR of 28% -- and generate nearly four times as much revenue as Fastly by 2026. We should take those estimates with a grain of salt, but it's generally a red flag when the underdog is growing at a slower pace and generating a lower gross margin than the market leader.

The global CDN market could still expand at a CAGR of 16% from 2024 to 2034, according to Future Market Insights. If Fastly can simply keep pace with the market and grow its top line at a steady CAGR of 15% from 2023 to 2034, its annual revenue could rise from $506 million to $2.4 billion by the final year. Assuming its valuations hold steady, it could turn a $10,000 investment into about $47,000 in a decade -- but it would still fall woefully short of the millionaire mark.

But is Fastly a good long-term investment?

Fastly is still gaining large enterprise customers and gradually stabilizing its losses, but Cloudflare arguably looks like a much better play on the CDN market, even if it's trading at much higher valuations. There are also plenty of other tech companies that are generating mid-teens revenue growth with higher profits than Fastly. So investors should stick with those stocks instead of betting on this underdog's long-term recovery.