As many magazines as you want/can afford is a good rule of thumb
I usually like to have 5-6 per serious use gun. Magazines don't have any particular life expectancy. With spring maintenance the tubes can sometimes last a VERY long time. Basically, if you have a mag that causes malfunctions where others don't, and a old/weak/damaged spring or a damaged follower isn't to blame, replace it. there's other factors, too, of course, and sometimes a problem mag can be fixed, but often replacement is the most expedient option in these cases.
My goal is to have 16 for my 1911. My IDPA club shoots 4 stages each time, so I need 12 mags to be able to go to each match and never have to load a mag at the match. Plus I need one mag for topping off, so that's 13 mags to take to every match, loaded the night before. Plus I need a total of three for the ideal carry situation, to leave loaded up with my carry ammo, bringing me to 16.
I would never be able to do that with my Glock at $25 a mag for 10 rounders, but with CMC powermags being like $16 from Brownells, why the hell not right?