This article is from the Water for coffee FAQ, by Jim Schulman with numerous contributions by others.
When corrosion is a danger in hot water systems, as with
Gaggia home machine boilers, it is accelerated by acidic water and
heat, and retarded by a layering of limescale. Thus, the standard
recommendation is using water with an alkalinity high enough to ensure
the water never becomes acidic, i.e. 48 mg/l or higher, and enough
hardness to keep the Langelier Index above -0.5. At room temperature,
an LI of greater than -0.5 translates to an alkalinity above 75 mg/l
and a hardness above 150 mg/l.
The LI recommendation is somewhat contested for two reasons.
First, limescale layers only protect when they form a complete
coating. Second, in heated systems, the LI stays high when the system
is hot, and only drops to critical levels when the water is cold.
Since both lime formation and corrosion are slowed in cold water, the
benefit of a high cold water LI isn't all that great. However, keeping
the alkalinity above 48 mg/l is seen as a must by all experts.
The value of high alkalinity for corrosion protection, along
with the lesser value of scale, leads to a surprising conclusion:
hardness can worsen corrosion in hot water systems. When the heated
water drops scale, it loses alkalinity as well and can become
corrosive. This observation accounts for the frequent occurrence of
both scale and corrosion in Gaggia boilers. But if the bicarbonate
alkalinity is mainly coupled to sodium and potassium, it won't scale,
and will remain in the water even when heated. This means that water
with higher bicarbonate alkalinity, and lower calcium/magnesium
hardness is best for protecting hot water systems from corrosion.