1. My tenure lengths used to be longer (3.X years), and then became shorter recently, so this signal is not that strong. It looks like: uni - 3.X - 1.X - 3.X (my startup) - 3.X - 1.X (FAANG) - 1.X (current). There are 2 positions that I leave off my CV: during my startup I did some parallel work in Academia, and there was a failed aqui-hire at the end of my startup, where technically I was an employee at a big NASDAQ company for 3 months, but then the deal exploded. Both are 6-10 years in the past and were during my rollercoaster startup years, so I just compress it into the startup entry, it's not worth detailing (not to mention NDAs). In my experience, both as a hiring manager and when interviewing, things more than 5 years in the past don't matter anyway.
2. My shorter gigs were in different countries, and people understand you're only going to stay in a foreign place if everything is really awesome (city AND company is a good fit).
3. I have FAANG on there, which esp. outside the US moves you past issues like this.
I think it's worth pointing out, I'm not saying you should job-hop for the money. That's why I put money as #4. I'm just saying you should maximize your learning (good for you) your mental well-being (good for you and your team, nobody likes to work with burnt out ppl) and your impact (good for the company). If you can find a place where this is possible for 5-10 years, jackpot, don't leave!
Not OP, but - I graduated in '95 and started working right away. Back then, the market and demand for developers was insane, and I ended up switching jobs - for 10-20% more every time - four times in four years. Then, right around 2000, the market crashed and I started interviewing again, and suddenly I had a really tough time finding anything: they brought up my short tenure at all my past jobs very negatively. I did finally find something, and have slowed down my job-hopping a bit (averaging 5 years per job now), but the "four jobs in four years, back in the late 90's" thing came up just last year during an interview - for a job that I didn't end up getting. In short - be careful, they're watching.
Personally I feel like an employer who is overly concerned with something like that (especially when it was so long ago) is a huge red flag.
People evaluate others based on their own experiences and ideas of success. If they feel that staying at one job for a long time is the utmost important factor above all else, what does that tell me about the kind of person they are and the kind of company they’re running? It tells me it’s probably a run of the mill mediocrity-factory full of people mostly just punching the clock every day. I’ve ignored these signs in the past and learned the hard way.
IMO places that have strong engineering cultures that are run by smart and driven people understand that your technical skill is what matters and aren’t going to hold it against you if you’ve hopped jobs to maintain your career growth, because they’ve most likely done the same thing themselves. Ambition recognizes ambition, and ambitious people HATE to stagnate.
2 years in one place raising flags? Hahah. No. Good places where you want to work are more than glad to get strong engineers working for them, even just for a couple of years. In the age of the cloud 2 years is an eternity.
Be careful not to burn any bridges thought. Even in suboptimal situations take the high road and cultivate relationships with the people there that you want to work with again. In the long run this is going to pay dividends.
No one blinks at multiple 2-year stints, especially if they were spent at smallish companies (< 500 employees). Spending 2 years usually means you went through at least 2 performance review cycles, accomplished or delivered something and are looking for something new to work on. At smaller companies it's not always possible to change group, so it's logical that you might look to change your job instead.
My own work history so far has been similar - 3 jobs lasting between 1.5 and 2.5 years, and I'm now currently on my 4th. It's never been brought up as an issue in interviews.