Ideally, every two to three months. That’s about as often as you remember to rotate your tires, but way easier.
If you live in a hard-water area, you might need to do it monthly. Trust me, your pipes won’t complain.
If you see slime? Drop everything and clean it today. That stuff is not your friend.