The recent years witnessed rapid emergence and proliferation of cloud computing. To fully utilize the compute resources, some cloud operators provide spot resources. Spot resources allow customers to bid on unused capacity. However, pricing policy of spot resources should be carefully designed and the impact on both present and future should be considered. For the present, the cloud provider can set a higher price to gain extra revenue. For the future, higher price will shift more requests with lower prices to later time and reduce the revenue of future. Meanwhile, the quality of service should be considered either since bad QoS will incur loss of potential users.In this paper, we present a demand curve to model the impact of pricing on the present and future revenue. Then we formulate the revenue maximization problem as a time-average optimization problem. Next, since this basic model fails to provide information of service delay, we extend it to a more generalized one that ensures the worst-case delay of user requests. While the future knowledge of arrival requests is unknown, it is necessary to design online algorithms for the optimization problems. We apply Lyapunov optimization framework and design an effi cient online algorithm which dose not require any future knowledge of requests arrival. Evaluations based on real-life datacenter workload and Amazon EC2 Spot Price illustrate effi ciency of our algorithms.