To keep sediment from building up in your water heater you should flush your water heater at least once per year.
I flush my water heater out every 6 months although I could likely wait and do it once per year in the spring.
However it doesn't take much to flush out a water heater and it's worth doing at least least twice per year or every 6 months to make your water heater last longer.
Waiting too long to flush out the sediment from your water heater causes more sediment to buildup and then it makes it harder to flush all the sediment out of the water heater.
When flushing the water heater out you should turn off the electric or gas to the water heater and then open the relief valve and hook a hose to the drain of the water heater.
Then leave the cold water on to help flush the sediment out.
Then fill the water heater back up and then turn the water heater back on.