mirror of
https://github.com/ceph/ceph
synced 2025-04-09 03:04:22 +00:00
Merge pull request #34 from TaewoongKim/anticipate
Add anticipation duration that keeps from resetting tag values to the current time
This commit is contained in:
commit
165a02542d
@ -130,6 +130,8 @@ int crimson::qos_simulation::parse_config_file(const std::string &fname, sim_con
|
|||||||
g_conf.server_random_selection = stobool(val);
|
g_conf.server_random_selection = stobool(val);
|
||||||
if (!cf.read("global", "server_soft_limit", val))
|
if (!cf.read("global", "server_soft_limit", val))
|
||||||
g_conf.server_soft_limit = stobool(val);
|
g_conf.server_soft_limit = stobool(val);
|
||||||
|
if (!cf.read("global", "anticipation_timeout", val))
|
||||||
|
g_conf.anticipation_timeout = stod(val);
|
||||||
|
|
||||||
for (uint i = 0; i < g_conf.server_groups; i++) {
|
for (uint i = 0; i < g_conf.server_groups; i++) {
|
||||||
srv_group_t st;
|
srv_group_t st;
|
||||||
|
@ -100,6 +100,7 @@ namespace crimson {
|
|||||||
uint client_groups;
|
uint client_groups;
|
||||||
bool server_random_selection;
|
bool server_random_selection;
|
||||||
bool server_soft_limit;
|
bool server_soft_limit;
|
||||||
|
double anticipation_timeout;
|
||||||
|
|
||||||
std::vector<cli_group_t> cli_group;
|
std::vector<cli_group_t> cli_group;
|
||||||
std::vector<srv_group_t> srv_group;
|
std::vector<srv_group_t> srv_group;
|
||||||
@ -107,11 +108,13 @@ namespace crimson {
|
|||||||
sim_config_t(uint _server_groups = 1,
|
sim_config_t(uint _server_groups = 1,
|
||||||
uint _client_groups = 1,
|
uint _client_groups = 1,
|
||||||
bool _server_random_selection = false,
|
bool _server_random_selection = false,
|
||||||
bool _server_soft_limit = true) :
|
bool _server_soft_limit = true,
|
||||||
|
double _anticipation_timeout = 0.0) :
|
||||||
server_groups(_server_groups),
|
server_groups(_server_groups),
|
||||||
client_groups(_client_groups),
|
client_groups(_client_groups),
|
||||||
server_random_selection(_server_random_selection),
|
server_random_selection(_server_random_selection),
|
||||||
server_soft_limit(_server_soft_limit)
|
server_soft_limit(_server_soft_limit),
|
||||||
|
anticipation_timeout(_anticipation_timeout)
|
||||||
{
|
{
|
||||||
srv_group.reserve(server_groups);
|
srv_group.reserve(server_groups);
|
||||||
cli_group.reserve(client_groups);
|
cli_group.reserve(client_groups);
|
||||||
@ -123,7 +126,9 @@ namespace crimson {
|
|||||||
"server_groups = " << sim_config.server_groups << "\n" <<
|
"server_groups = " << sim_config.server_groups << "\n" <<
|
||||||
"client_groups = " << sim_config.client_groups << "\n" <<
|
"client_groups = " << sim_config.client_groups << "\n" <<
|
||||||
"server_random_selection = " << sim_config.server_random_selection << "\n" <<
|
"server_random_selection = " << sim_config.server_random_selection << "\n" <<
|
||||||
"server_soft_limit = " << sim_config.server_soft_limit;
|
"server_soft_limit = " << sim_config.server_soft_limit << "\n" <<
|
||||||
|
std::fixed << std::setprecision(3) <<
|
||||||
|
"anticipation_timeout = " << sim_config.anticipation_timeout;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
}; // class sim_config_t
|
}; // class sim_config_t
|
||||||
|
@ -74,6 +74,7 @@ int main(int argc, char* argv[]) {
|
|||||||
const uint client_groups = g_conf.client_groups;
|
const uint client_groups = g_conf.client_groups;
|
||||||
const bool server_random_selection = g_conf.server_random_selection;
|
const bool server_random_selection = g_conf.server_random_selection;
|
||||||
const bool server_soft_limit = g_conf.server_soft_limit;
|
const bool server_soft_limit = g_conf.server_soft_limit;
|
||||||
|
const double anticipation_timeout = g_conf.anticipation_timeout;
|
||||||
uint server_total_count = 0;
|
uint server_total_count = 0;
|
||||||
uint client_total_count = 0;
|
uint client_total_count = 0;
|
||||||
|
|
||||||
@ -176,7 +177,11 @@ int main(int argc, char* argv[]) {
|
|||||||
test::CreateQueueF create_queue_f =
|
test::CreateQueueF create_queue_f =
|
||||||
[&](test::DmcQueue::CanHandleRequestFunc can_f,
|
[&](test::DmcQueue::CanHandleRequestFunc can_f,
|
||||||
test::DmcQueue::HandleRequestFunc handle_f) -> test::DmcQueue* {
|
test::DmcQueue::HandleRequestFunc handle_f) -> test::DmcQueue* {
|
||||||
return new test::DmcQueue(client_info_f, can_f, handle_f, server_soft_limit);
|
return new test::DmcQueue(client_info_f,
|
||||||
|
can_f,
|
||||||
|
handle_f,
|
||||||
|
server_soft_limit,
|
||||||
|
anticipation_timeout);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,36 +109,38 @@ namespace crimson {
|
|||||||
double proportion;
|
double proportion;
|
||||||
double limit;
|
double limit;
|
||||||
bool ready; // true when within limit
|
bool ready; // true when within limit
|
||||||
#ifndef DO_NOT_DELAY_TAG_CALC
|
|
||||||
Time arrival;
|
Time arrival;
|
||||||
#endif
|
|
||||||
|
|
||||||
RequestTag(const RequestTag& prev_tag,
|
RequestTag(const RequestTag& prev_tag,
|
||||||
const ClientInfo& client,
|
const ClientInfo& client,
|
||||||
const uint32_t delta,
|
const uint32_t delta,
|
||||||
const uint32_t rho,
|
const uint32_t rho,
|
||||||
const Time time,
|
const Time time,
|
||||||
const double cost = 0.0) :
|
const double cost = 0.0,
|
||||||
reservation(cost + tag_calc(time,
|
const double anticipation_timeout = 0.0) :
|
||||||
prev_tag.reservation,
|
ready(false),
|
||||||
client.reservation_inv,
|
arrival(time)
|
||||||
rho,
|
|
||||||
true)),
|
|
||||||
proportion(tag_calc(time,
|
|
||||||
prev_tag.proportion,
|
|
||||||
client.weight_inv,
|
|
||||||
delta,
|
|
||||||
true)),
|
|
||||||
limit(tag_calc(time,
|
|
||||||
prev_tag.limit,
|
|
||||||
client.limit_inv,
|
|
||||||
delta,
|
|
||||||
false)),
|
|
||||||
ready(false)
|
|
||||||
#ifndef DO_NOT_DELAY_TAG_CALC
|
|
||||||
, arrival(time)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
Time max_time = time;
|
||||||
|
if (time - anticipation_timeout < prev_tag.arrival)
|
||||||
|
max_time -= anticipation_timeout;
|
||||||
|
|
||||||
|
reservation = cost + tag_calc(max_time,
|
||||||
|
prev_tag.reservation,
|
||||||
|
client.reservation_inv,
|
||||||
|
rho,
|
||||||
|
true);
|
||||||
|
proportion = tag_calc(max_time,
|
||||||
|
prev_tag.proportion,
|
||||||
|
client.weight_inv,
|
||||||
|
delta,
|
||||||
|
true);
|
||||||
|
limit = tag_calc(max_time,
|
||||||
|
prev_tag.limit,
|
||||||
|
client.limit_inv,
|
||||||
|
delta,
|
||||||
|
false);
|
||||||
|
|
||||||
assert(reservation < max_tag || proportion < max_tag);
|
assert(reservation < max_tag || proportion < max_tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,18 +148,18 @@ namespace crimson {
|
|||||||
const ClientInfo& client,
|
const ClientInfo& client,
|
||||||
const ReqParams req_params,
|
const ReqParams req_params,
|
||||||
const Time time,
|
const Time time,
|
||||||
const double cost = 0.0) :
|
const double cost = 0.0,
|
||||||
RequestTag(prev_tag, client, req_params.delta, req_params.rho, time, cost)
|
const double anticipation_timeout = 0.0) :
|
||||||
|
RequestTag(prev_tag, client, req_params.delta, req_params.rho, time,
|
||||||
|
cost, anticipation_timeout)
|
||||||
{ /* empty */ }
|
{ /* empty */ }
|
||||||
|
|
||||||
RequestTag(double _res, double _prop, double _lim, const Time _arrival) :
|
RequestTag(double _res, double _prop, double _lim, const Time _arrival) :
|
||||||
reservation(_res),
|
reservation(_res),
|
||||||
proportion(_prop),
|
proportion(_prop),
|
||||||
limit(_lim),
|
limit(_lim),
|
||||||
ready(false)
|
ready(false),
|
||||||
#ifndef DO_NOT_DELAY_TAG_CALC
|
arrival(_arrival)
|
||||||
, arrival(_arrival)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
assert(reservation < max_tag || proportion < max_tag);
|
assert(reservation < max_tag || proportion < max_tag);
|
||||||
}
|
}
|
||||||
@ -166,10 +168,8 @@ namespace crimson {
|
|||||||
reservation(other.reservation),
|
reservation(other.reservation),
|
||||||
proportion(other.proportion),
|
proportion(other.proportion),
|
||||||
limit(other.limit),
|
limit(other.limit),
|
||||||
ready(other.ready)
|
ready(other.ready),
|
||||||
#ifndef DO_NOT_DELAY_TAG_CALC
|
arrival(other.arrival)
|
||||||
, arrival(other.arrival)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
@ -340,6 +340,7 @@ namespace crimson {
|
|||||||
assign_unpinned_tag(prev_tag.reservation, _prev.reservation);
|
assign_unpinned_tag(prev_tag.reservation, _prev.reservation);
|
||||||
assign_unpinned_tag(prev_tag.limit, _prev.limit);
|
assign_unpinned_tag(prev_tag.limit, _prev.limit);
|
||||||
assign_unpinned_tag(prev_tag.proportion, _prev.proportion);
|
assign_unpinned_tag(prev_tag.proportion, _prev.proportion);
|
||||||
|
prev_tag.arrival = _prev.arrival;
|
||||||
last_tick = _tick;
|
last_tick = _tick;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -714,6 +715,7 @@ namespace crimson {
|
|||||||
// limit, this will allow the request next in terms of
|
// limit, this will allow the request next in terms of
|
||||||
// proportion to still get issued
|
// proportion to still get issued
|
||||||
bool allow_limit_break;
|
bool allow_limit_break;
|
||||||
|
double anticipation_timeout;
|
||||||
|
|
||||||
std::atomic_bool finishing;
|
std::atomic_bool finishing;
|
||||||
|
|
||||||
@ -742,9 +744,11 @@ namespace crimson {
|
|||||||
std::chrono::duration<Rep,Per> _idle_age,
|
std::chrono::duration<Rep,Per> _idle_age,
|
||||||
std::chrono::duration<Rep,Per> _erase_age,
|
std::chrono::duration<Rep,Per> _erase_age,
|
||||||
std::chrono::duration<Rep,Per> _check_time,
|
std::chrono::duration<Rep,Per> _check_time,
|
||||||
bool _allow_limit_break) :
|
bool _allow_limit_break,
|
||||||
|
double _anticipation_timeout) :
|
||||||
client_info_f(_client_info_f),
|
client_info_f(_client_info_f),
|
||||||
allow_limit_break(_allow_limit_break),
|
allow_limit_break(_allow_limit_break),
|
||||||
|
anticipation_timeout(_anticipation_timeout),
|
||||||
finishing(false),
|
finishing(false),
|
||||||
idle_age(std::chrono::duration_cast<Duration>(_idle_age)),
|
idle_age(std::chrono::duration_cast<Duration>(_idle_age)),
|
||||||
erase_age(std::chrono::duration_cast<Duration>(_erase_age)),
|
erase_age(std::chrono::duration_cast<Duration>(_erase_age)),
|
||||||
@ -862,13 +866,20 @@ namespace crimson {
|
|||||||
get_cli_info(client),
|
get_cli_info(client),
|
||||||
req_params,
|
req_params,
|
||||||
time,
|
time,
|
||||||
cost);
|
cost,
|
||||||
|
anticipation_timeout);
|
||||||
|
|
||||||
// copy tag to previous tag for client
|
// copy tag to previous tag for client
|
||||||
client.update_req_tag(tag, tick);
|
client.update_req_tag(tag, tick);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
RequestTag tag(client.get_req_tag(), get_cli_info(client), req_params, time, cost);
|
RequestTag tag(client.get_req_tag(),
|
||||||
|
get_cli_info(client),
|
||||||
|
req_params,
|
||||||
|
time,
|
||||||
|
cost,
|
||||||
|
anticipation_timeout);
|
||||||
|
|
||||||
// copy tag to previous tag for client
|
// copy tag to previous tag for client
|
||||||
client.update_req_tag(tag, tick);
|
client.update_req_tag(tag, tick);
|
||||||
#endif
|
#endif
|
||||||
@ -920,7 +931,8 @@ namespace crimson {
|
|||||||
ClientReq& next_first = top.next_request();
|
ClientReq& next_first = top.next_request();
|
||||||
next_first.tag = RequestTag(tag, get_cli_info(top),
|
next_first.tag = RequestTag(tag, get_cli_info(top),
|
||||||
top.cur_delta, top.cur_rho,
|
top.cur_delta, top.cur_rho,
|
||||||
next_first.tag.arrival);
|
next_first.tag.arrival,
|
||||||
|
0.0, anticipation_timeout);
|
||||||
|
|
||||||
// copy tag to previous tag for client
|
// copy tag to previous tag for client
|
||||||
top.update_req_tag(next_first.tag, tick);
|
top.update_req_tag(next_first.tag, tick);
|
||||||
@ -1169,10 +1181,11 @@ namespace crimson {
|
|||||||
std::chrono::duration<Rep,Per> _idle_age,
|
std::chrono::duration<Rep,Per> _idle_age,
|
||||||
std::chrono::duration<Rep,Per> _erase_age,
|
std::chrono::duration<Rep,Per> _erase_age,
|
||||||
std::chrono::duration<Rep,Per> _check_time,
|
std::chrono::duration<Rep,Per> _check_time,
|
||||||
bool _allow_limit_break = false) :
|
bool _allow_limit_break = false,
|
||||||
|
double _anticipation_timeout = 0.0) :
|
||||||
super(_client_info_f,
|
super(_client_info_f,
|
||||||
_idle_age, _erase_age, _check_time,
|
_idle_age, _erase_age, _check_time,
|
||||||
_allow_limit_break)
|
_allow_limit_break, _anticipation_timeout)
|
||||||
{
|
{
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
@ -1393,10 +1406,11 @@ namespace crimson {
|
|||||||
std::chrono::duration<Rep,Per> _idle_age,
|
std::chrono::duration<Rep,Per> _idle_age,
|
||||||
std::chrono::duration<Rep,Per> _erase_age,
|
std::chrono::duration<Rep,Per> _erase_age,
|
||||||
std::chrono::duration<Rep,Per> _check_time,
|
std::chrono::duration<Rep,Per> _check_time,
|
||||||
bool _allow_limit_break = false) :
|
bool _allow_limit_break = false,
|
||||||
|
double anticipation_timeout = 0.0) :
|
||||||
super(_client_info_f,
|
super(_client_info_f,
|
||||||
_idle_age, _erase_age, _check_time,
|
_idle_age, _erase_age, _check_time,
|
||||||
_allow_limit_break)
|
_allow_limit_break, anticipation_timeout)
|
||||||
{
|
{
|
||||||
can_handle_f = _can_handle_f;
|
can_handle_f = _can_handle_f;
|
||||||
handle_f = _handle_f;
|
handle_f = _handle_f;
|
||||||
@ -1408,14 +1422,16 @@ namespace crimson {
|
|||||||
PushPriorityQueue(typename super::ClientInfoFunc _client_info_f,
|
PushPriorityQueue(typename super::ClientInfoFunc _client_info_f,
|
||||||
CanHandleRequestFunc _can_handle_f,
|
CanHandleRequestFunc _can_handle_f,
|
||||||
HandleRequestFunc _handle_f,
|
HandleRequestFunc _handle_f,
|
||||||
bool _allow_limit_break = false) :
|
bool _allow_limit_break = false,
|
||||||
|
double _anticipation_timeout = 0.0) :
|
||||||
PushPriorityQueue(_client_info_f,
|
PushPriorityQueue(_client_info_f,
|
||||||
_can_handle_f,
|
_can_handle_f,
|
||||||
_handle_f,
|
_handle_f,
|
||||||
std::chrono::minutes(10),
|
std::chrono::minutes(10),
|
||||||
std::chrono::minutes(15),
|
std::chrono::minutes(15),
|
||||||
std::chrono::minutes(6),
|
std::chrono::minutes(6),
|
||||||
_allow_limit_break)
|
_allow_limit_break,
|
||||||
|
_anticipation_timeout)
|
||||||
{
|
{
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user