A cardiac rhythm management system (100) comprising:a pulse output circuit (214) to deliver electrical stimulation pulsesa sensing circuit (212) to sense a cardiac signala heart rate variability (HRV) measurement circuit (220), coupled to the sensing circuit, to measure an HRV being a variance in cardiac cycle lengths over a predetermined period of time based on the sensed cardiac signal and to produce an HRV parameter based on the HRV measurement anda stimulation control circuit (730), coupled to the pulse output circuit, the sensing circuit, and the HRV measurement circuit, the stimulation control circuit including a stimulation parameter optimization module (731) adapted to adjust at least one stimulation parameter to an approximately optimal value based on the HRV parameter, the stimulation parameter optimization module including:a stimulation parameter generator (738) adapted to produce a plurality of parameter values for the at least one stimulation parametera pulse output controller (740) adapted to control the delivery of the electrical stimulation pulses using the plurality of parameter values during a stimulation parameter optimization period anda stimulation parameter selector (742) adapted to select the approximately optimal value for the at least one stimulation parameter from the plurality of parameter values, the approximately optimal parameter value corresponding to a maximum value of the HRV parameter measured for the stimulation parameter optimization period.