Palo Alto Networks (PANW 0.91%) and Rapid7 (RPD 0.17%) represent two very different ways to invest in the growing cybersecurity market. Palo Alto, one of the world's largest cybersecurity companies, provides its services through three ecosystems -- Strata for its on-site network security appliances, Prisma for its cloud-based services, and Cortex for its artificial intelligence-powered threat detection tools. The synergies between those platforms lock more customers into its subscription plans.

Rapid7 takes a drastically different approach to reducing cyberattacks. Instead of reacting to threats like Palo Alto, Rapid7's Insight platform proactively scans and prods an organization's infrastructure and individual applications for potential weaknesses. It then tries to harden those soft spots with its tools to prevent future attacks.

An IT professional checks a tablet computer.

Image source: Getty Images.

Palo Alto generated about eight times as much revenue as Rapid7 in their latest fiscal years. It might initially seem smarter for growth-oriented investors to place their bets on the smaller company, but Rapid7's stock actually declined more than 35% over the past 12 months as Palo Alto's stock soared nearly 50%. Let's see why this cybersecurity market leader outperformed the underdog by such a wide margin -- and if it's still the better buy.

Palo Alto Networks is still firing on all cylinders

Palo Alto went public 11 years ago, but it still grew its annual revenue at a compound annual growth rate (CAGR) of 24% between fiscal 2019 and 2022, which ended last July.

It attributes most of its recent growth to Prisma and Cortex -- which it collectively calls its next-gen security (NGS) services -- instead of Strata. In its most recent quarter, its annual recurring revenue (ARR) from its NGS services grew 60% year over year to $2.6 billion and accounted for 40% of its trailing-12-month revenue.

Palo Alto also finally turned profitable on a generally accepted accounting principles (GAAP) basis for the past four consecutive quarters as it reined in its spending and stock-based compensation expenses. Those rising profits offset the compression of its gross margin -- which was largely caused by the expansion of its higher-growth NGS services -- and silenced the bears who had claimed it would never generate stable GAAP profits.

Palo Alto already serves more than 80,000 enterprise customers, including nearly all of the Fortune 100 and most of the Global 2000. Nevertheless, it still expects its revenue to rise 25%-26% in fiscal 2023 as its adjusted EPS grows 69%-70%. Analysts expect its revenue and adjusted EPS to rise another 22% and 17%, respectively, in fiscal 2024 -- which suggests it will buck the broader macro-induced slowdown in cybersecurity spending.

Palo Alto's stock recently dipped amid concerns about Microsoft's expansion into the network security space, but I believe its market dominance and sticky ecosystem should shield it from those competitive headwinds. Its stock might not seem cheap at 51 times forward earnings, but its aforementioned strengths should justify its higher valuation.

Rapid7 faces tougher competitive and macro headwinds

From 2019 to 2022, Rapid7's revenue grew at a CAGR of 28%, its total number of customers expanded from 9,022 to 10,929, and its average annual recurring revenue (ARR) per customer increased from $37,500 to $65,400. Those growth rates are robust, but Rapid7 faces tougher competitive and macro headwinds than Palo Alto Networks.

On the competitive front, Rapid7 isn't the only cybersecurity company that scans an organization's infrastructure for soft spots. Tenable also offers those tools on its Nessus platform, Qualys provides similar cloud-based services, and bigger tech and telecom companies like IBM and AT&T already integrate comparable services into their ecosystems.

All of that direct and indirect competition, along with Rapid7's relatively small size, gives it less pricing power and visibility during economic downturns. That's why it expects its revenue to only rise 13%-14% in 2023. It also reportedly tried to sell itself earlier this year -- but those talks eventually fizzled out over disagreements regarding its final price.

Rapid7 is only profitable on a non-GAAP basis. But by that measure, it expects its adjusted earnings to grow 137%-154% this year as it reins in its spending. Based on that forecast, Rapid7's stock also trades at 51 times forward earnings.

The clear winner: Palo Alto Networks

Considering that Palo Alto and Rapid7 are trading at similar forward multiples, it makes much more sense to buy the former than the latter for three simple reasons.

First, Palo Alto's business is larger, better diversified, and more resistant to the macro headwinds. Second, Palo Alto's GAAP profitability should limit its downside potential if interest rates stay elevated and punish its unprofitable peers like Rapid7. Lastly, Palo Alto didn't scramble to sell itself the moment its revenue growth cooled off. Instead, it shrewdly expanded through acquisitions and scaled up its business to drive out its smaller competitors and lock in more customers.