I find that the more tired my leg muscles get while cycling, the more likely I am to get leg cramps. To keep from cramping I sometimes try to dial back my intensity before I fatigue my legs. One way to do this is to judge my physical exertion by how I feel. Here is a simple guide I use based on the Mayo Clinic’s article Exercise intensity: How to measure it
Light exertion – There is no noticeable change in breathing patterns. Don’t break a sweat unless it’s a hot, humid day.
Moderate exertion – Breathing becomes deeper and more frequent. Will break a sweat after performing the activity for about 10 minutes.
High exertion – Will break a sweat after 3-5 minutes. Breathing is deep and rapid. Can only talk in short phrases.
Unfortunately, I’ve found that I can’t always judge my physical exertion by how I feel while I’m cycling. With other types of physical exertion, this method works fairly well for me, but not cycling. Many times, I don’t breathe deeply or rapidly although my body is working harder. While my exertion is the same, my heart rate tends to creep up without me knowing. This has become a real problem while touring because if my heart rate gets too high for a sustained period of time, I fatigue and I get leg cramps.