This paper presents a new real-time optimal mileage based dispatch (OMD) algorithm for a generating company (GenCo) responding to the automatic generation control (AGC) dispatch signals in real time in context of a performance-based frequency regulation market. Distinguished from traditional methods, the proposed method innovatively incorporates the mileage based regulation service compensation criterion in dispatching multiple units to maximize the Genco's total profit. In addition, the proposed method adopts the model predictive control (MPC) framework to effectively address the real-time OMD given dynamic variations of AGC signals between adjacent dispatch intervals to further improve GenCo's profit. The effectiveness of the proposed method is thoroughly tested using the Hainan power grid as part of China Southern Power Grid (CSG) considering various operation scenarios, where a performance-based frequency regulation market is under implementation.