Strategies for Datacenters Participating in Demand Response by Two-Stage Decisions

Modern smart grids have proposed a series of demand response (DR) programs and encourage users to participate in them with the purpose of maintaining reliability and efficiency so as to respond to the sustainable development of demand-side management. As a large load of the smart grid, a datacenter could be regarded as a potential demand response participant. Encouraging datacenters to participate in demand response programs can help the grid to achieve better load balancing effect, while the datacenter can also reduce its own power consumption so as to save electricity costs. In this paper, we designed a demand response participation strategy based on two-stage decisions to reduce the total cost of the datacenter while considering the DR requirements of the grid. The first stage determines whether to participate in demand response by predicting real-time electricity prices of the power grid and incentive information will be sent to encourage users to participate in the program to help shave the peak load. In the second stage, the datacenter interacts with its users by allowing users to submit bid information by reverse auction. Then, the datacenter selects the tasks of the winning users to postpone processing them with awards. Experimental results show that the proposed strategy could help the datacenter to reduce its cost and effectively meet the demand response requirements of the smart grid at the same time.


Introduction
With the development of the world economy and the depletion of natural resources, energy crisis and environmental pollution have become serious issues of sustainable development. e Energy Development Corporation envisions the world powered by clean energy and calls on the energy sector to make the necessary shift to clean and low-carbon energy to alleviate the energy issues [1]. As a large energyconsuming country, China has proposed a series of corresponding energy utilization strategies. For example, Jiangsu province first experimented with a dynamic seasonal electricity pricing policy in 2015, using a potential way to encourage users to participate in demand response [2]. On the other hand, demand-side management as an important part of the smart grid is a critical way and an inevitable choice to achieve energy-saving and sustainable development of power enterprises. In order to meet various requests of the power users, the smart grid also needs to continuously deepen the power demand-side response and guidance mechanism to enhance the energy-saving and environmental protection effects [3]. e smart grid needs to propose a series of incentive mechanisms and effective demand response strategies to increase the flexibility of demand-side management to improve its sustainability. Smart grid programs should be carefully designed and can integrate the use of renewable energy, reduce electricity use, and lower CO 2 emissions. Hence, some research studies have turned to focus on the design of a new hybrid smart grid performance framework for evaluation from the perspective of sustainability [4].
Currently, an effective way for the smart grid to maintain sustainable development is to implement a more effective demand response strategy to realize the balance of power supply and demand. In order to improve the reliability, stability, and sustainability of the smart grid, power companies in some countries have initiated a series of demand response (DR) programs to encourage their users to participate in with the aim of reducing the peak load of the grid and thus improving the reliability of the power grid [5]. In general, there are two main types of demand response programs of the smart grids, including incentive-based and price-based programs. In particular, incentive-based demand response programs include direct load control and interruptible load control. Price-based demand response programs include time-of-use electricity prices, real-time electricity prices, peak electricity prices, and other pricerelated programs [6]. A great number of power companies are also trying to implement special demand response programs to achieve the goal of peak load shaving. Demand response programs also provide users with incentives to encourage user participation to adapt power consumption to demand response goals.
On the other hand, with the increasing complexity of computing services and storage services provided by datacenters, and with the development of technology and the advancement of communication technologies, datacenters are more and more widely used as the basic computing and storage infrastructure. In 2017, there were approximately 8 million datacenters around the world, which consumed 416.2 terawatt-hours of electricity [7]. Hence, the power requirements of the datacenters increase dramatically, and high energy consumption becomes increasingly serious, which can lead to high carbon emissions of datacenters, which are not conducive to environmental protection. e datacenter is a large power consumer in the smart grid environment, and its load is usually highly flexible and adjustable. Datacenter participating demand response is envisioned as a promising approach for alleviating operational instability faced by smart grids and on the one hand, the datacenter can also save energy in response to the increase of electricity costs. In this case, the datacenter can be regarded as a potential participant of demand response programs in the smart grid [8,9]. On the other hand, most datacenters support various types of workloads. Moreover, some workloads have the characteristic of high flexibility. For example, delay-tolerant tasks can be scheduled later as long as they could be completed before their deadlines [10].
is proves that datacenters can give a response by adjusting their own workloads when participating in demand response.
As an important part of the smart grid, demand-side management is a significant way for the sustainability of power companies. erefore, the power grid should conduct more plans to attract more users to participate in demand response projects. Demand response conducts economic incentives aimed at balancing energy demand during critical demand periods [11]. As a commodity, electricity has its own particularity. One is that electricity is not easily stored. Generally, electricity is consumed as much as it generates. e other is that the cost of electricity is relatively high during peak periods of electricity consumption. erefore, it is critical for power companies to propose kinds of demand response programs to alleviate the load pressure. Generally, consumers will be encouraged to shift their loads to off-peak hours in demand response process [12]. Real-time electricity prices track the price of the entire electricity market dynamically and guide users to avoid electricity consumption behaviors during peak periods, thereby reducing their electricity demand during peak periods [13]. However, datacenters are high demanders of electricity, making them potential participants in demand response. Datacenter participation in the demand response programs would bring many benefits, which could not only reduce the load pressure on the power grid but also reduce the power cost of the datacenter.
In this paper, we aim to reduce the total cost of the datacenter by involving the datacenter to participate in demand response program provided by the smart grid and in turn to improve the sustainability of the demand side of the grid. We proposed a two-stage decision process to figure out particular actions. In the first stage, the power grid sent the DR signals to the datacenter according to the variation of real-time electricity prices, while sending incentive information to the datacenter. e second stage was the bidding selection between the datacenter and its users based on a reverse auction mechanism. e user submitted bidding information firstly, including the number of tasks that could be postponed and the cost that the datacenter needed to pay due to the delayed execution of some tasks. en, the datacenter tried to find the optimal solution by stochastic searching, delayed the execution of the task of the winning users, and rewarded them. Using the two-stage strategy, the purpose of reducing the peak load pressure of the smart grid while reducing the power cost of the datacenter could be achieved.
is paper is an extended version of our prior work [14]. Based on the original version, we used the neural network for forecasting the real-time electricity price to judge the grid operation state in advance. In addition, we conducted a more detailed and comprehensive analysis of experiment results, including analyzing the impact of different forecasting accuracy on datacenter participants in DR, discussing the efficiency of the proposed method, and comparing the reward paid from the grid to the datacenter under different strategies. e remainder of this paper is organized as follows. Section 2 introduces some related works about datacenter participation in demand response programs. Section 3 shows the system architecture and the optimization problems defined in this paper. Section 4 describes the two-stage decision process and strategies we designed to solve the defined problem. Section 5 analyzes the experiment results by comparing three different strategies. At last, Section 6 concludes the whole paper and discusses the possible future work.

Related Work
In recent years, the topic of how datacenter participates in demand response programs for the purpose of balancing the supply and demand for electricity has been discussed a lot. Different researchers keep different opinions and design diverse strategies to participate in demand response programs. Some of the researchers have focused on the benefits for both supply and demand sides by proposing a gametheoretic framework between the datacenter and the smart grid.
ere were also some researchers who realized the purpose of participating in demand response by transferring the load of the datacenter to other distributed datacenters for execution. In addition, some works proposed letting the datacenter actively participate in DR programs by reducing the load by shifting or delaying its own tasks.

Taking a Game-eoretic Approach to Participate in
Demand Response. Zhou et al. [15] used the real-time electricity price as a demand response signal in the deregulated electricity market and modeled the datacenter decisions on power company selection and workload scheduling as a many-to-one game model. is algorithm not only improves the revenue of power companies but also reduces the average contract cost of the datacenter. ey turned the game problem into an easy-to-solve mixed-integer linear programming problem for solving. In [16], the authors adopted time-varying rewards to motivate the willingness of users to participate in demand response projects. ey used a game theory framework to model the game between a single datacenter and its users. In addition, they extended the proposed strategy by combining two demand response strategies: server shutdown and local renewable energy generation. Zhou et al. [17] aimed at the two-way electricity flow between smart grids and datacenters with hybrid green energy generation capability and geodistributed nature of large cloud system; they proposed a pricing scheme designed for geo-distributed green datacenters from a multileader single-follower game point of view. At the cloud side, in quest for scalability, robustness, and performance, the energy cost minimization problem is solved in a distributed manner, based on the technique of alternating direction method of multipliers. Bahrami et al. [18] considered the real-time pricing (RTP) and modeled the decisions of datacenters select utility company and workload scheduling as a many-to-one matching game with externalities. ey developed a distributed algorithm that guarantees converging to a stable outcome.
rough the analysis of the above pieces of literature, these studies are basically to establish a game model between the datacenter and the power company. Finally, they proposed an effective algorithm and obtained an equilibrium solution.

Participating in Demand Response by Geographic Load
Balancing. Wang et al. [19] proposed a price-based incentive method. In order to motivate users to participate in their demand response projects, power companies set different power prices in different datacenters, encouraging users to shift the load to datacenters with lower electricity prices. Wang and Ye [20] regarded the datacenter operations as a problem of minimizing energy costs. ey designed a distributed demand response algorithm. Administrators send optimized messages by broadcasting messages to each datacenter, and then each datacenter itself optimizes towards its own objective. Tran et al. [21] studied the distributed datacenter demand response method and proposed a twostage pricing scheme based on the Stackelberg game. Each power company maximizes its profit by setting real-time prices in the first stage. In the second phase, the datacenter service provider uses workload shifting and dynamic server allocation to minimize its costs according to the electricity price. Liu et al. [22] thought predicted-based pricing is an appealing market design and showed that it outperforms more traditional supply function bidding mechanisms in situations where market power is an issue. ese researches started with electricity prices from power companies and proposed incentive methods or other demand response methods for achieving the objective of reducing electricity costs in datacenters. Chau and Yang [23] took the advantage of the electricity price varying by region; they proposed a competitive online algorithm to achieve the load balance that can be applied to a limited time range and small-tomedium-scale energy storage. Liu et al. [24] explored the feasibility of using fully renewable energy to power Internetscale systems. ey conducted a trace-based study to assess three issues related to achieving this goal: the impact of geographic load balancing, the role of storage, and the optimal combination of renewable energy. Rao et al. [25] aimed at the location and time diversity of the electricity prices; they studied the issue of minimizing the total electricity cost in multiple electricity market environments while ensuring service quality. ey modeled the problem as a constrained mixed-integer programming to solve.

Combining Multiple Methods to Participate in Demand
Response. Guo et al. [26] aimed at the problem of a serious carbon footprint that resulted from using a backup diesel generator to supply power when datacenter participates in demand response. ey focused on the effective and environment-friendly demand response of the datacenter. By designing economic incentives, they encourage tenants to reduce the load of the emergency demand response (EDR) in emergency situations and use the Nash equilibrium theory to analyze the relationship between datacenter operators and tenants. Chen et al. [27] argued that datacenters had the ability to provide large capacity reserves to emerging smart grid programs and, thus, provided opportunities for sustainable datacenter growth and cost savings as well as more flexibility for the grid. erefore, they proposed policies to deliver datacenter demand response for peak shaving, regulation services, and frequency control programs. Cupelli et al. [28] combined the datacenter heating, ventilation, and air-conditioning equipment and delayed IT load and battery storage systems to coadjust the demand response projects. ey proposed an optimization framework based on MPC (Model Predictive Control) forecasting to ensure the reliable operation of the datacenter and also analyzed the cost reduction in the case of incentives and prices. Paul et al. [29] considered that different types of jobs are distributed in different layers of the datacenter server, and, in particular, some of them can be delayed. ey proposed rolling scheduling based on Receding Horizon Control (RHC). Based on the discrete-time model, they used two different Mathematical Problems in Engineering methods to formulate and solve the optimal server configuration problem: minimizing operating costs and jointly minimizing capital and operating costs between service configurations at different layers. In [30], they took into account the risk of energy demand and core business processes of the datacenter in participating in demand response process, and they used a genetic heuristic algorithm for energy consumption prediction. Guo et al. [31] proposed a coordinated management method and model for datacenter computing and cooling load. In the datacenter energy supply system with distributed photovoltaic power generation, they established a datacenter energy supply system under the time-of-use electricity price environment to respond to demand with the goal of minimizing the cost of electricity consumption. In response to the economic demand response of the custodian, they [32] proposed a reward-reduction incentive mechanism, which reflects the interaction between the DRP (demand response provider) of custodian compensation to the custodian and the colocation operator reward to tenants. Chen et al. [33] proposed a pricing mechanism for mandatory and voluntary EDR (emergency demand response) projects, which is a parameterized supply function based on bidding, both when tenants are price-taking and when they are priceanticipating.
Overall, some of the previous works only considered the power adjustment of the datacenter as a holistic entity to participate in demand response, and a lot of them were realized by the mutual transfer of load between geographically distributed datacenters. In addition, some researchers designed game-theoretic models between the datacenter and the power grid and sought to find an equilibrium solution between them. Considering the emergency of sending demand response signals, we adopt forecasting methods to obtain demand response signals in advance in order to schedule the tasks of the datacenter in time. In this paper, we design a two-stage decision strategy to make the datacenter participate in demand response. Compared with prior research work, the main contributions of this paper include the following: Establishing interactions between the smart grid, the datacenter, and the users and designing a two-stage decision process to participate in DR Predicting DR requirements by following real-time electricity price variation in the first interaction stage and designing a corresponding incentive mechanism Designing the second stage of the datacenter interaction mechanism with the users by reverse auction, in which users submit bid information to the datacenter voluntarily and the datacenter selects some users by analyzing the optimal choice

System Architecture and Problem Modeling
In this section, we mainly introduce the interaction between the grid, the datacenter, and the users. We aim at the problem of datacenter participating in demand response to establish the optimization problem. Figure 1 shows the interaction between the smart grid, the datacenter, and the users. e grid sends demand signals and incentive information at some unspecific moments. en, the datacenter selects users according to their bidding information and postpones tasks of selected users after receiving the demand response signals from the smart grid. Assume that the datacenter consists of N hosts, denoted as host 1 to host N. We also assume the electricity price at time t is σ(t)($/Wh) and the revenue brought by executing a task is c($).
3.1. Grid Side. As shown in Figure 1, the operations of the grid side include sending DR signals, incentive information, and charging electricity bills to datacenters. In this paper, we use the variation of real-time electricity prices to determine the moment of demand response.
Generally, smart grids propose incentive methods in order to attract more users to participate in demand response programs for balancing the supply and demand for electricity. Considering that the datacenter (DC) participates in demand response, the grid side should give the datacenter a certain reward based on the behavior of DC. In general, the rewards given to users participating in demand response by the power grid are calculated according to the execution rate of power reduction. We define a parameter of execution rate to reflect the degree of datacenter participation in DR. Here, we use the average value of the power consumption of the datacenter at each time slot in the past 5 days as the reference value p base . If the actual power consumption reduction after the DC participates in the demand response is p red , then the execution rate is defined as r e � (p red /p base ). We refer to the reward method proposed in [34] and define the reward at time t as equation (1), denoted as θ (t), wherein the baseline is a constant which is a base value preset for rewards: 3.2. User Side. From the perspective of datacenter users, they can voluntarily decide whether to participate in the demand response or not. Here we consider two types of tasks, including interactive workloads and batch workloads, respectively. At each time slot, users submit tasks to the datacenter, including the tasks that need to be responded immediately (interactive tasks) and the tasks that can be postponed to process (batch-type tasks). Denote I u (t) and B u (t) as the number of interactive-type tasks and batch-type tasks, respectively, which are submitted at time slot t by user u. Furthermore, we divided batch-type tasks into two categories, including delay-sensitive and delay-insensitive tasks according to the time that can be delayed. Specifically, delaysensitive tasks can be postponed for 4 time intervals, and delay-insensitive tasks can be postponed for 8 time intervals. If the user decides to participate in the demand response, he/she can submit the bid information defined as a tuple consisting of the number of task candidates and the corresponding charge, denoted as <ϕ u (t, t ′ ), α u (t)>. Specifically, the first element ϕ u (t, t ′ ) denotes the number of tasks that can be delayed to process from time t to t ′ and the second element α u (t) denotes the expected charge resulting from postponing these tasks of user u. We use a binary variable x u,t to record whether the user u wins the bid at the current time slot, which indicates that user u is selected or not.

Datacenter Side.
As stated previously, the datacenter can be regarded as a large load of the smart grid and could participate in demand response programs provided by the grid. From the perspective of the datacenter, effectively scheduling tasks submitted by its users could be a useful means to help it adjust its own power consumption. is can also help the datacenter owner to reduce the electricity cost.
In general, datacenter should guarantee the QoS (quality of service) of users when datacenter processes the requests of users. In this section, we define a penalty model for the datacenter if it proactively postponed the execution of the user tasks. In other words, if tasks submitted by users are postponed due to the datacenter participation in the DR programs, the datacenter should pay the users for the delay. We adopted the penalty model adopted in [35], using t sub and t exec to represent the submission time and the actual execution time of the task, respectively. en, the penalty for delaying task i can be defined as follows: where β is a constant factor used to reflect the penalty. Hence, denote π(t) and r user (t) as the number of tasks that violate the QoS restriction and the total fee paid to users by the datacenter, respectively. erefore, r user (t) consists of the penalty due to the postponed tasks in order to respond to the DR signal and it can be calculated as In addition, in the process of the datacenter interacting with its users, the datacenter needs to pay the users who actively bid the cost and are willing to participate in demand response.
en, the total charge ω(t) of datacenter that needs to pay for the users can be calculated as In general, computing power consumption is the dominant part of the total datacenter power consumption [36], which is mainly related to the utilization ratio of the computing devices. Denote P t n as the computing power consumption of host n in the t th slot. Here, we use a linear calculation method to calculate power consumption [37], as shown in the following equation: where P max n is the maximum power consumption of the server, c is the percentage of static power consumption, and u n,t is the CPU utilization of the server n at time t. Hence, the total power consumption of datacenter at time t can be calculated as

Establishment of the Optimization Problem.
Hence, the total cost of datacenter consists of the penalty due to the postponed tasks in order to respond to the DR signal, the cost paid to some users who actively bid, the revenue from performing tasks, and the energy charge. erefore, the total cost of the datacenter at time slot t can be calculated as follows: where λ(t) and E t represent the total amount of tasks that need to be executed at time t and energy consumption of datacenter at time slot t, respectively. Overall, the target optimization problem is to minimize the cost of datacenter under certain constraints, as shown in equations (9) and (10), wherein equation (9)   Mathematical Problems in Engineering total reward asked by the users for postponing their tasks should be less than the revenue brought by finishing these tasks and equation (10) limits the valid range of the variables.
e notations used throughout this paper are listed in Table 1.

Strategies and Methods
To address the issue mentioned in Section 3, we proposed a twostage decision process to participate in DR for cost reduction of datacenter and peak load shaving of the power grid and also implemented two other methods for comparison.

Two-Stage Decision Process (OP).
In this subsection, we will show in detail the issues involved in the proposed twostage approach.

Stage I: e Interaction between the Grid and the Datacenter.
e main goal of this stage is to improve grid reliability and reduce peak load pressure. At this stage, the grid will send DR signals based on the price of electricity. In order to allow grid users to have sufficient preparation time to adjust their own loads to participate in demand response, we adopt the method of predicting real-time electricity prices to send DR signals. e grid will send incentive information to electricity users according to equation (1) so as to attract more entities to participate in demand response.
Since the datacenter might not know the accurate time when the DR request will arrive, forecasting techniques were used here to predict the coming of DR signals according to the real-time electricity price of the smart grid. Here, we use the neural network of long short-term memory (LSTM) network model to learn the characteristics of the real-time electricity price [38]. e model is a recurrent neural network trained using back-propagation time, and it can overcome the problem of gradient disappearance of traditional neural networks [39]. Moreover, LSTM uses four neural network layers and interacts with each other by a special method. Specifically, we use the historical real-time electricity price data of the previous k days to predict the data on the k + 1 day.

Stage II: e Interaction between the Datacenter and Its
Users. At this stage, a reverse auction mechanism is employed for the interaction between the users and the datacenter. Users perform competitive bidding to the datacenter when the datacenter receives demand response signals. After the bidding process, the datacenter selects the winning users, pays the required fee to them, and reallocates the tasks of these users according to the auction results.
(1) Reverse auction model. In this process, we regard the datacenter as the buyer and the users as the sellers. Each user u voluntarily submits bid information represented as a tuple < ϕ u (t, t ′ ), α u (t) > . en, the datacenter selects the winning users according to the objective function as shown in equation (8) while meeting the constraints shown in equation (9) and equation (10).
After the auction between users and the datacenter, the tasks performed at DR periods will be rescheduled. e tasks can be shifted in the time dimension to reduce the electricity cost of datacenter. Denote m as the number of users who submit tasks to the datacenter at time t. Denote δ(t) as the number of batch-type tasks executed at time t, including both the batch-type tasks submitted at time t and the batchtype tasks postponed from previous time slots, which can be calculated as where t ′ > t, t b < t.
Denote λ(t) as the total amount of tasks that the datacenter needs to process at the time slot t, which can be calculated as (2) Solution. We adopt a stochastic searching algorithm based on the concept of the Genetic Algorithm (GA) to solve the optimization problem as defined in Section 3. GA is a kind of random parallel search algorithm based on the principles of natural selection and genetic genetics. It starts with randomly initializing the population, and after multiple iterations, it constantly generates individuals with higher fitness and finally obtains the optimal individual. We use binary encoding, where an example of chromosome representation is shown in Table 2. If a user wins the bid, the corresponding coding value is 1; otherwise it is 0. In the example shown in the table, u1 did not win the bidding but u2 won it. In this method, the datacenter not only participates in the demand response at the first stage but also uses the reverse auction mechanism to reschedule tasks of users in the second stage. Users submit bidding information to the datacenter in a bidding manner, and then the datacenter selects the winning user by stochastic searching to find the close-to-optimal solution. At last, the datacenter can effectively participate in DR programs by actively interacting with the users and reschedule the workloads. e pseudocode of the datacenter decision in the user bidding process is shown as follows (Algorithm 1).
In Algorithm 1, M is the population size, p c represents the crossover probability, p m is the mutation probability, I represents the iteration times and i is the evolutionary generation counter, P 0 is the original population, ind_best is used to record the best individual, and newPop is the current population updated with new generated individuals during each round. f(x) is a function for calculating the fitness value, which is the opposite of the optimization objective as defined in equation (7). Line 5 evaluates the fitness value of each individual ind j in population P i and line 10 selects two individuals from the current population P i according to roulette selection operation to generate two new individuals.
Here we give on example to demonstrate the working process of the two-stage strategy. Assume that currently a DR moment is predicted through the decision in the first stage and 5 users (denoted as u1∼u5) have submitted their bidding information at this moment. en, the datacenter will select winning users according to the bidding information submitted by the users based on Algorithm 1. In the selection process, assume that u1, u3, and u4 won, while u2 and u5 failed. In this case, the datacenter will postpone some deferrable tasks based on the task information submitted by u1, u3, and u4 with awards, while the tasks of u2 and u5 are still processed at the current time slot.

Best Effort (BS).
In this strategy, the datacenter makes its best effort to participate in DR programs of the grid by selectively delaying some tasks according to the needs of the datacenter. No auction or bidding mechanisms are employed here. erefore, the datacenter might violate the QoS of the users and thus a certain penalty would be charged for delaying the execution of some user tasks arbitrarily regardless of the task characteristics. In other words, this strategy does not consider the active participation potential of the users and their other requirements.

Static Method (ST).
In this strategy, the datacenter does not participate in the demand response programs and just manages the workload as usual. For the datacenter, no particular actions will be performed after receiving DR signals.

Experimental Results and Analysis
In order to verify the effectiveness of the proposed method, we used the CloudSim Plus tool [40] to simulate the interaction between the datacenter and its users. e datacenter used in our experiment consists of 2000 hosts, and we assume that the number of users is 10. e detailed parameters settings are shown in Table 3. In the experiment, we simulate a whole day (24 hours) and divide it into 24 slots. e data of real-time electricity price is derived from the website [41].
In the experiment, we adopt the Google-trace workload for simulation [42], and we assigned tasks to 10 users. During data processing, we use the Pandas [43] library of the Python [44] language to process and statistics of the workload data of Google-trace in the taskusage file. Tasks contain two categories, interactive-type and batch-type tasks, with a ratio of 1 : 1.5 [45].

Symbol
Description N e number of hosts in datacenters τ e number of time slots σ(t) e electricity price at time slot t c e revenue of a task executed by the datacenter p base Basic power consumption p red e actual power consumption reduction r e e execution rate when participating in DR θ(t) e reward is given to datacenters by the grid at time slot t μ(i) e penalty of violating the QoS of task i t exec e execution time of a task t sub e submission time of a task β e penalty factor P t n e power consumption of host n at time slot t P max n e maximum power consumption of host n c e percentage of static power consumption U n,t e CPU utilization of host n at time slot t P t e total power consumption of datacenter at time slot t E t e total energy consumption of datacenter at time slot t I u (t) e number of interactive tasks submitted at time slot t by user u B u (t) e number of batch-type tasks submitted at time slot t by user u ϕ u (t, t′) e number of tasks from user u that can be delayed to process from time t to t′ α u (t) e charge resulted from postponing the execution of some tasks from user u at time slot t x u,t A binary variable indicating user u is selected or not at time slot t δ(t) e number of batch-type tasks executed at time t λ(t) e total number of tasks needed to be processed at time slot t π(t) e number of tasks that violate QoS at time slot t r user (t) e reward given to the users by the datacenter at time slot t

Mathematical Problems in Engineering
Moreover, batch-type tasks are further divided into two types, delay-sensitive and delayed-insensitive tasks, respectively, which are delay-tolerant if being postponed for 4 time slots and 8 time slots. Figure 2 shows the detail of tasks used in the experiment, wherein the blue part represents interactive tasks, and the green part and yellow part represent delay-sensitive tasks and delayinsensitive tasks, respectively. In our work, as stated in Section 3.1, the method of calculating the execution rate defined in this paper is based on the historical power consumption of the datacenter. Hence, we use the average power value of the 5-day historical data in Google-trace as the base value used for calculating the execution rate. Figure 3 shows the detailed average power consumption.

Forecasting Electricity Prices.
Since the DR signal is usually sent from the smart grid according to the variation of the electricity loads, in order to proactively participate in demand response, we attempted to predict the electricity price ahead to prepare for better scheduling. Here, the electricity price data used in the following experiments derives from power companies [41]. We use the historical data of January 2018 as a training set to predict the real-time electricity price situation on 1 February and use the LSTM time series prediction model for forecasting. We use the AdaDelta optimizer; the number of iterations is 100. We also combined machine learning scikit-learn library for data normalization and training. e forecasting result is shown in Figure 4, and the error rate is basically kept within 10%. It can be clearly found that there are six peak electricity price moments, which are 6: 00, 7: 00, 17: 00, 18: 00, 19: 00, and 20: 00, respectively. In the experiment, DR signals are sent during these six moments. Figure 5 shows the task scheduling conditions under the three strategies. As mentioned, under ST strategy, the datacenter just ignored the DR signals and did not perform any particular task-scheduling actions. Compared with the ST method, under BS and OP, there were fewer tasks processed during DR moments, including 6 : 00-7:00 and 17 : 00-20 : 00. is is because the datacenter actively reacted to the DR signals in the first stage and conducted task scheduling. Although the BS strategy can Input: I u (t), B u (t), p base , α u (t), ϕ u (t, t′) Output: the best individual ind_best Begin (1) Initialization (2) Initialize M; p c ; p m ; I; newPop; P 0 ; ind_best; i ← 1; j ← 1;
Here, in order to prove that the OP strategy can indeed give a better response at the peak electricity price, we define a parameter PTA (peak average tasks to average tasks of all time slots) to measure the response situation of the three methods. Here, in our experiments, PTA is calculated as the average load at the moment of demand response periods divided by the average load of the entire day. Figure 6 shows the PTA value of the three strategies. Compared to the BS strategy, the PTA under the OP strategy is the lowest, which can show that the proposed OP strategy can achieve a better goal of participating in demand response and reduce load pressure during peak hours of the grid. Figure 7 shows the detailed power consumption of the datacenter at each moment. e red-dashed line represents the variation of the real-time electricity price from the grid. ere are two peak electricity price periods. It can be seen from the figure that the power consumption has been reduced under the BS and OP strategies during the time period of peak electricity prices, including 6 : 00-7:00 and 17 : 00-20 : 00. Results also showed that OP could lead to the largest reduction of power consumption compared with the other two strategies.

Revenues and Costs of the Datacenter.
We also examined the detailed situation of the revenues and costs during the two-stage demand response actions conducted by the datacenter. As shown in Figure 8(a), the red pillar represents the fee paid by the datacenter to the users who win the bidding in reverse auctions under the OP strategy. In comparison, the blue pillars are the penalty in the BS strategy due to the postponed tasks submitted by the users, which resulted from the datacenter DR decisions. In other words, the datacenter delayed some of the interactive tasks so that their QoS was violated. erefore, the datacenter could pay the users less money using the OP strategy than the BS strategy, since the penalties were reduced by means of the second-stage auction mechanism. Figure 8(b) shows the rewards given to the datacenter from the smart grid during the periods of demand response. It can be obviously seen that the rewards under the OP strategy are higher than the BS strategy, which means that under the OP strategy the DR execution rate is higher. Figure 9 shows the costs and rewards paid between the smart grid and the datacenter. As shown in Figure 9(a), from the results of the electricity cost under the three strategies, it can be seen that ST leads to the highest electricity cost, while the OP strategy leads to the lowest cost. is is because the OP strategy actively participates in the demand response at the moments when the electricity price is relatively high. In particular some tasks are postponed until the time when the electricity price is low, so the OP strategy leads to the lowest electricity costs. Figure 9(b) shows the rewards paid to the datacenter from the smart grid due to its participation in the demand response. It can be observed that the OP strategy has the highest reward. is is because the execution rate of the OP strategy was relatively high, which indicates that the demand response participation was effective and could bring revenue for the datacenter.
Furthermore, Figure 10 shows the total cost reduction of BS and OP compared to the ST strategy. It can be observed that they both reduced the total cost than ST, while OP brings much more reduction than BS. is is because the datacenter participated in the demand response, and some tasks were postponed for later execution during DR periods, thereby reducing the cost of electricity included in the total cost. Compared with the BS strategy, since the OP strategy used the reverse auction mechanism to negotiate with users, the penalty became less and the rewards obtained from the  grid side could be higher. In contrast, the BS strategy resulted in higher penalties because the datacenter delayed the tasks without considering the requirements of users and thus violated their QoS. Overall, employing the OP strategy could minimize the total cost of the datacenter according to the above results and analysis.
In addition, we also analyzed the impact of the real-time electricity price forecasting results on datacenter participation in demand response when the training dataset size is in different settings. Figures 11(a) and 11(b) show the forecasting results when the size k of the training set is 31 and 15, respectively, in which the average error in Figure 11(a) is within 10% and that in Figure 11(b) is within 25%. e DR moments can be accurately predicted when the size k of the training set is 31, so the datacenter can respond at the correct DR moments. However, when the training set size k is 15 and the iteration time is 20, the forecasting results are not very accurate. Under this setting, not all of the DR periods were predicted in advance. For example, the datacenter should respond to the demand response of the power grid at the two moments of 6 : 00 and 17 : 00, but it did not actually perform any actions because of the wrong judgment. is resulted in the datacenter not fully participating in DR program and being unable to effectively reduce its own electricity costs. From the results shown in Figure 11(c), we can obviously obtain that the total cost of the datacenter is the highest when there is no forecasting, while it is the least when the forecasting is accurate. is can prove that improving the accuracy of the DR signal prediction can reduce the total cost of the datacenter more. Figure 12 shows the relationship between the iteration times and the convergence of the algorithm. In general, the faster the convergence speed of the algorithm is, the better the algorithm is considered, which can save the calculation execution time and in turn achieve high efficiency. From Figure 12, we can obtain that when the iteration times reach about 50 times, the optimal function value tends to be stable and get to the minimum. is illustrates that the method proposed in this paper is efficient for finding close-to-optimal solutions. As we know, datacenters usually have a very large number of processing requests at each moment. erefore, using the proposed method to solve the problem is more efficient when the amount of requests becomes large.

Conclusions and Future Work
In this paper, we proposed a two-stage datacenter demand response strategy towards the smart grid environment. e first stage is the interaction between the smart grid and the datacenter, which mainly includes the grid sending DR signals to the datacenter according to real-time electricity load. In the second stage, the datacenter interacts with its users by employing the reverse auction mechanism. Users submit bidding information to the datacenter, including the number of tasks that can be postponed and the corresponding charge for postponing these tasks. en, the datacenter delays the execution of tasks of the winning users and pays the relevant fee after the bid selection. Simulation experiments illustrated that the strategy proposed in this paper could help the datacenter to reduce its total operational cost by effectively participating in demand response while facilitating the smart grid to shave the peak load and keep itself stable. Overall, the strategy proposed in this paper can adjust the power demand according to the DR signals to a certain extent. erefore, the method can provide a way to help the sustainable development of power enterprises and also facilitate the decarbonization of the datacenters.
As a next step in the future, we are planning to study the formulation of the smart grid incentive mechanism and demand response items for the datacenter load characteristics, so that datacenters can better participate in demand response while ensuring that datacenter users have a higher service quality. We also plan to develop a datacenter charging agreement for users based on demand response signals on the grid side. In this way, the datacenter and the grid benefit at the same time.
Data Availability e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare that they have no conflicts of interest.