I've also experienced severe cramping before. So I’ve been doing trial and error ever since. I don’t know if it is specific to my body, but maybe this can work for you too. I have learnt that a proper warm up and stretching before you start the race works wonders. Train in the heat. Take enough fluid. There is a product from “Hammer” called “Endurolites”. You pop a captule every 45min during a long endurance race. You can also chow a few Rennies before the race. Eat and drink enough during the race. If you are not fit enough, you will cramp. The last 2 months I’ve been very busy so I’ve only been doing weekend rides. Then I went and did a hard 60km race over the weekend. I cramped again, but not a lot luckily. It works to ride it out.