This year has been a strong one for the S&P 500, rising over 25% year to date. While the broad indexes have been pulled forward by mega-cap tech stocks, the small- and mid-cap tech stocks haven't had such a lucrative year. 

Roku (ROKU 0.15%) shares have fallen over 50% off their all-time highs, and Confluent (CFLT 1.23%) has fallen over 30% off its all-time high. Even though these stocks are down, the businesses have only gotten stronger. I think 2022 could be a year when small- and mid-cap tech stocks come roaring back to life, and shares of these two stocks have the potential to appreciate greatly in the new year. 

1. Roku: Investments could pay off

Roku has become a mainstay in many homes across the world, providing a platform for over 56 million users to stream all of the shows they desire. The company was originally known for its hardware streaming sticks, but the business has shifted drastically to software and it now thrives on advertising revenue. Roku is even planning to add original content to its platform. 

Family watching TV together.

Image source: Getty Images.

The company's streaming service hosting platform has had incredible success in its niche market, gaining over 30% market share, according to I/O Fund analyst Beth Kindig. Because of this broad dominance, the company has gained a strong brand name and thus pricing power, and Roku hopes to use these competitive advantages internationally. The company already operates across the world, yet most of its revenue in 2021 came from the U.S., and it is looking to change that.

Management has said that it hopes to have international accounts resemble a greater share of active accounts in the future. The company has already taken steps to reach this by expanding into Germany and launching its Roku TVs in Brazil and other parts of Latin America. Although Roku will face competition in these areas as it tries to expand, its brand power will likely allow for the company to gain some traction. 

The company has proven it can effectively balance top-line growth with investment back into the business. In Q3, the company grew revenue 51% year over year while ramping up its marketing spending and its research and development costs, probably to fuel international growth. This resulted in 45% year-over-year operating expense growth, but the company still brought in $69 million in net income for the quarter.

Roku shares have sunk 33% this year, resulting in a valuation of just 11 times sales. This is allowing investors to get a nice discount on a market leader that is maintaining rapid growth. This growth could continue with Roku's international efforts, which could pay off not only in 2022 but for the next five years. The bottom line: Its low price is leaving an immense opportunity for investors to capitalize today. 

2. Confluent: Leading a fast-growing market

Confluent is helping businesses set data in motion by offering a managed Kafka service. Apache Kafka is an open-source software platform that focuses on managing real-time data feeds. Over 80% of Fortune 100 companies use Apache Kafka, but this mission-critical service is complicated for businesses to run on their own. Many businesses want to offload this complexity, and Confluent is there to help.

The real edge for Confluent is not its position as the top Kafka service, but rather its leadership. The three founders of Confluent were also the developers of Kafka, providing unmatched trust and reliability compared to other Kafka services. 

Apache Kafka has been broadly accepted by some of the largest enterprises in the world, but Confluent's growth is just getting started. Confluent has been adopted by big names like Walmart and Block, and it is experiencing fast revenue growth. In its third quarter, the company brought in $103 million in revenue, which grew 67% year over year. This rapid adoption could indicate that while Confluent isn't being used by all the major enterprises like Kafka currently is, that could change over the next few years.

Management thinks that this is a likely scenario. The company is expecting its addressable opportunity to nearly double by 2025 to $91 billion. As a result of this rapid growth, the company has been investing heavily into gaining market share now in hopes that it will retain and expand its relationships with its customers as the industry grows. 

The company spent $324 million so far this year on marketing and research expenses to gain this market share and brand recognition, and if it is successful, it will probably be able to scale these expenses back as revenue soars. Therefore, while Confluent is unprofitable today, this could change in the future. 

Confluent's opportunity is massive, and with its top-notch management team, it would be hard for any competitor to overtake it as the primary managed Kafka service. Accordingly, the company mainly competes with businesses managing this in-house. As streams of data become larger and more complicated, many more enterprises may decide to offload this complexity, leaving Confluent to reap the benefits. The amount of data that businesses need to handle will only grow during 2022, which is why I think Confluent could see speedy adoption next year. This makes it one of my top tech stocks to buy for 2022.