Depending on water conditions and type of anode, the average life expectancy is 4 or 5 years, less in soft water, even less if a water softener is used. Average life of tank is ten years. Ten year life is due to not replacing anode, with regular replacement tank can last 20 30 who knows how much longer. Water heater manufacturers recommend replacing the anode every two to four years depending on the hardness of the water and the quality of the heater lining.
Check anode by unscrewing and lifting part way out. New rods are 5/8" to 3/4" usually at smaller end of range. If 1/4" rplace it, certainly replace if inner wire core is exposed. If a relativly long piece should break off and fall in the force of incoming water could possibly cause it to bounce around chipping glass lining.
Once the anode is gone rust of iron tank starts immediatly even if lining is intact, there are gaps at connections. Three metals used in anodes, if tank has more than one anode replace all unless you are sure which metal is used. Mixing metals shortens tank life.
Aluminum is used in hard water locales, in soft water they last a year or two, water softeners use sodium, anode may not last a year;
magnesium is for softer water, magnesium is usually supplied with heater, in hard water it may not last a year or two,
zinc: actually aluminum with zinc added, used to combat sulfer smell
You really want to replace the anode B4 corrosion of tank starts, but later is better than never. "Spare the rod, corrode the heater." The thicker the rod the better.