  Cloud computing is becoming an essential component of modern computer and
communication systems. The available resources at the cloud such as computing
nodes, storage, databases, etc. are often packaged in the form of virtual
machines (VMs) to be used by remotely located client applications for
computational tasks. However, the cloud has a limited number of VMs available,
which have to be efficiently utilized to generate higher productivity and
subsequently generate maximum revenue. Client applications generate requests
with computational tasks at random times with random complexity to be processed
by the cloud. The cloud service provider (CSP) has to decide whether to
allocate a VM to a task at hand or to wait for a higher complexity task in the
future. We propose a threshold-based mechanism to optimally decide the
allocation and pricing of VMs to sequentially arriving requests in order to
maximize the revenue of the CSP over a finite time horizon. Moreover, we
develop an adaptive and resilient framework based that can counter the effect
of realtime changes in the number of available VMs at the cloud server, the
frequency and nature of arriving tasks on the revenue of the CSP.
