aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorva-kuznecov <va-kuznecov@ydb.tech>2022-12-01 18:52:19 +0300
committerva-kuznecov <va-kuznecov@ydb.tech>2022-12-01 18:52:19 +0300
commitc46dab1cfb5a099445f9c7ec0c63922ddb735660 (patch)
tree4d3f6f497073f7937899cd0065de1b256cc34d3c
parentb5bb624b894c68c2228cc59c98494b68fa90d4f4 (diff)
downloadydb-c46dab1cfb5a099445f9c7ec0c63922ddb735660.tar.gz
Improve load actors
-rw-r--r--ydb/core/blobstorage/testload/test_load_actor.cpp52
-rw-r--r--ydb/core/blobstorage/testload/test_load_kqp.cpp18
2 files changed, 50 insertions, 20 deletions
diff --git a/ydb/core/blobstorage/testload/test_load_actor.cpp b/ydb/core/blobstorage/testload/test_load_actor.cpp
index 00d015573ed..b173d1113be 100644
--- a/ydb/core/blobstorage/testload/test_load_actor.cpp
+++ b/ydb/core/blobstorage/testload/test_load_actor.cpp
@@ -333,14 +333,16 @@ public:
"received protobuf: " << params.Get("protobuf") << " | "
"proto parse status: " << std::to_string(status)
);
+ ui64 tag = 0;
if (status) {
- if (params.Has("run_all") && params.Get("run_all") == "true") {
+ if (params.Has("run_all") && params.Get("run_all") == "on") {
LOG_NOTICE_S(ctx, NKikimrServices::BS_LOAD_TEST, "running on all nodes");
RunRecordOnAllNodes(record, ctx);
+ tag = NextTag; // may be datarace here
} else {
try {
LOG_NOTICE_S(ctx, NKikimrServices::BS_LOAD_TEST, "running on node: " << SelfId().NodeId());
- ProcessCmd(record, ctx);
+ tag = ProcessCmd(record, ctx);
} catch (const TLoadActorException& ex) {
info.ErrorMessage = ex.what();
}
@@ -349,19 +351,21 @@ public:
info.ErrorMessage = "bad protobuf";
}
- GenerateHttpInfoRes(ctx, id);
+ GenerateJsonTagInfoRes(ctx, id, tag);
return;
} else if (params.Has("stop_request")) {
LOG_DEBUG_S(ctx, NKikimrServices::BS_LOAD_TEST, "received stop request");
NKikimrBlobStorage::TEvTestLoadRequest record;
record.MutableLoadStop()->SetRemoveAllTags(true);
- if (params.Has("stop_all_nodes") && params.Get("stop_all_nodes") == "true") {
+ if (params.Has("stop_all_nodes") && params.Get("stop_all_nodes") == "on") {
LOG_DEBUG_S(ctx, NKikimrServices::BS_LOAD_TEST, "stop load on all nodes");
RunRecordOnAllNodes(record, ctx);
} else {
LOG_DEBUG_S(ctx, NKikimrServices::BS_LOAD_TEST, "stop load on node: " << SelfId().NodeId());
ProcessCmd(record, ctx);
}
+ GenerateJsonTagInfoRes(ctx, id, 0);
+ return;
} else if (params.Has("json_results")) {
GenerateJsonInfoRes(ctx, id);
return;
@@ -426,6 +430,25 @@ public:
}
}
+ void GenerateJsonTagInfoRes(const TActorContext& ctx, ui32 id, ui64 tag) {
+ auto it = InfoRequests.find(id);
+ Y_VERIFY(it != InfoRequests.end());
+ THttpInfoRequest& info = it->second;
+
+ TStringStream str;
+ str << NMonitoring::HTTPOKJSON;
+ NJson::TJsonValue value;
+ value["tag"] = tag;
+ value["status"] = "OK";
+ NJson::WriteJson(&str, &value);
+
+ auto result = std::make_unique<NMon::TEvHttpInfoRes>(str.Str(), info.SubRequestId,
+ NMon::IEvHttpInfoRes::EContentType::Custom);
+ ctx.Send(info.Origin, result.release());
+
+ InfoRequests.erase(it);
+ }
+
void GenerateJsonInfoRes(const TActorContext& ctx, ui32 id) {
auto it = InfoRequests.find(id);
Y_VERIFY(it != InfoRequests.end());
@@ -470,17 +493,19 @@ public:
COLLAPSED_BUTTON_CONTENT("start_load_info", "Start load") {
str << R"___(
<script>
- function sendStartRequest() {
+ function sendStartRequest(button) {
$.ajax({
url: "",
data: {
- protobuf: document.querySelector('textarea[name=protobuf]').value,
- run_all: document.querySelector('input[id=runAllNodes]').checked
+ protobuf: $('#protobuf').val(),
+ run_all: $('#runAllNodes:checked').val()
},
method: "GET",
dataType: "html",
success: function(result) {
- $("html").html(result);
+ $(button).prop('disabled', true);
+ $(button).text("started");
+ $("#protobuf").text(result);
}
});
}
@@ -491,23 +516,24 @@ public:
str << "</textarea><br>";
str << R"(<input type="checkbox" id="runAllNodes" name="runAll"> )";
str << R"(<label for="runAllNodes"> Run on all nodes</label>)" << "<br><br>";
- str << R"(<button onClick='sendStartRequest()' name='startNewLoad' class='btn btn-default'>Start new load</button>)" << "<br><br>";
+ str << R"(<button onClick='sendStartRequest(this)' name='startNewLoad' class='btn btn-default'>Start new load</button>)" << "<br><br>";
}
COLLAPSED_BUTTON_CONTENT("stop_load_info", "Stop load") {
str << R"___(
<script>
- function sendStopRequest() {
+ function sendStopRequest(button) {
$.ajax({
url: "",
data: {
stop_request: true,
- stop_all_nodes: document.querySelector('input[id=stopAllNodes]').checked
+ stop_all_nodes: $('#stopAllNodes:checked').val()
},
method: "GET",
dataType: "html",
success: function(result) {
- $("html").html(result);
+ $(button).prop('disabled', true);
+ $(button).text("stopped");
}
});
}
@@ -515,7 +541,7 @@ public:
)___";
str << R"(<input type="checkbox" id="stopAllNodes" name="stopAll"> )";
str << R"(<label for="stopAllNodes"> Stop load on all nodes</label>)" << "<br><br>";
- str << R"(<button onClick='sendStopRequest()' name='stopNewLoad' class='btn btn-default'>Stop load</button>)" << "<br><br>";
+ str << R"(<button onClick='sendStopRequest(this)' name='stopNewLoad' class='btn btn-default'>Stop load</button>)" << "<br><br>";
}
for (const auto& pair : info.ActorMap) {
diff --git a/ydb/core/blobstorage/testload/test_load_kqp.cpp b/ydb/core/blobstorage/testload/test_load_kqp.cpp
index 28d1380457f..12566c2c22c 100644
--- a/ydb/core/blobstorage/testload/test_load_kqp.cpp
+++ b/ydb/core/blobstorage/testload/test_load_kqp.cpp
@@ -307,7 +307,7 @@ public:
Y_UNUSED(index);
VERIFY_PARAM(DurationSeconds);
- google::protobuf::TextFormat::PrintToString(cmd, &ConfingString);
+ google::protobuf::TextFormat::PrintToString(cmd, &ConfigString);
UniformPartitionsCount = cmd.GetUniformPartitionsCount();
DeleteTableOnFinish = cmd.GetDeleteTableOnFinish();
@@ -486,10 +486,14 @@ private:
value["duration_s"] = DurationSeconds;
value["tx/s"] = Total->WindowHist.GetTotalCount() / (WindowDuration * std::max(ui64(1), Phase) * 1.0);
value["errors"] = Total->WindowErrors;
- value["p50_ms"] = Total->WindowHist.GetValueAtPercentile(50.0) / 1000.0;
- value["p95_ms"] = Total->WindowHist.GetValueAtPercentile(95.0) / 1000.0;
- value["p99_ms"] = Total->WindowHist.GetValueAtPercentile(99.0) / 1000.0;
- value["p100_ms"] = Total->WindowHist.GetMax() / 1000.0;
+ {
+ auto& p = value["percentile"];
+ p["50"] = Total->WindowHist.GetValueAtPercentile(50.0) / 1000.0;
+ p["95"] = Total->WindowHist.GetValueAtPercentile(95.0) / 1000.0;
+ p["99"] = Total->WindowHist.GetValueAtPercentile(99.0) / 1000.0;
+ p["100"] = Total->WindowHist.GetMax() / 1000.0;
+ }
+ value["config"] = ConfigString;
return value;
}
@@ -703,7 +707,7 @@ private:
}
}
COLLAPSED_BUTTON_CONTENT(Sprintf("configProtobuf%" PRIu64, Tag), "Config") {
- str << "<pre>" << ConfingString << "</pre>";
+ str << "<pre>" << ConfigString << "</pre>";
}
}
return str.Str();
@@ -754,7 +758,7 @@ private:
ui64 WindowCount;
ui64 WindowDuration;
std::vector<TActorId> Workers;
- TString ConfingString;
+ TString ConfigString;
ui64 UniformPartitionsCount;
bool DeleteTableOnFinish;
ui32 NumOfSessions;