A major challenge in the design of rf cavities for the acceleration of medium-energy charged ions is the need to rapidly sweep the radio frequency over a large range. From low-power medical synchrotrons to high-power accelerator driven subcritical reactor systems, and from fixed focus alternating gradient accelerators to rapid cycling synchrotrons, there is a strong need for more efficient, and faster, acceleration of protons and light ions in the semirelativistic range of hundreds of MeV/u. A conventional way to achieve a large, rapid frequency sweep (perhaps over a range of a factor of 6) is to use custom-designed ferrite-loaded cavities. Ferrite rings enable the precise tuning of the resonant frequency of a cavity, through the control of the incremental permeability that is possible by introducing a pseudoconstant azimuthal magnetic field. However, rapid changes over large permeability ranges incur anomalous behavior such as the ``Q-loss'' and ``f-dot'' loss phenomena that limit performance while requiring high bias currents. Notwithstanding the incomplete understanding of these phenomena, they can be ameliorated by introducing a ``harmonic ratcheting'' acceleration scheme in which two or more rf cavities take turns accelerating the beam---one turns on when the other turns off, at different harmonics---so that the radio frequency can be constrained to remain in a smaller range. Harmonic ratcheting also has straightforward performance advantages, depending on the particular parameter set at hand. In some typical cases it is possible to halve the length of the cavities, or to double the effective gap voltage, or to double the repetition rate. This paper discusses and quantifies the advantages of harmonic ratcheting in general. Simulation results for the particular case of a rapid cycling medical synchrotron ratcheting from harmonic number 9 to 2 show that stability and performance criteria are met even when realistic engineering details are taken into consideration.