  The critical need for clean and economical sources of energy is transforming
data centers that are primarily energy consumers to also energy producers. We
focus on minimizing the operating costs of next-generation data centers that
can jointly optimize the energy supply from on-site generators and the power
grid, and the energy demand from servers as well as power conditioning and
cooling systems. We formulate the cost minimization problem and present an
offline optimal algorithm. For "on-grid" data centers that use only the grid,
we devise a deterministic online algorithm that achieves the best possible
competitive ratio of $2-\alpha_{s}$, where $\alpha_{s}$ is a normalized
look-ahead window size. For "hybrid" data centers that have on-site power
generation in addition to the grid, we develop an online algorithm that
achieves a competitive ratio of at most \textmd{\normalsize {\small
$\frac{P_{\max} (2-\alpha_{s})}{c_{o}+c_{m}/L}
[1+2\frac{P_{\max}-c_{o}}{P_{\max}(1+\alpha_{g})}]$}}, where $\alpha_{s}$ and
$\alpha_{g}$ are normalized look-ahead window sizes, $P_{\max}$ is the maximum
grid power price, and $L$, $c_{o}$, and $c_{m}$ are parameters of an on-site
generator.
  Using extensive workload traces from Akamai with the corresponding grid power
prices, we simulate our offline and online algorithms in a realistic setting.
Our offline (resp., online) algorithm achieves a cost reduction of 25.8%
(resp., 20.7%) for a hybrid data center and 12.3% (resp., 7.3%) for an on-grid
data center. The cost reductions are quite significant and make a strong case
for a joint optimization of energy supply and energy demand in a data center. A
hybrid data center provides about 13% additional cost reduction over an on-grid
data center representing the additional cost benefits that on-site power
generation provides over using the grid alone.
