Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Filestore] Implement a tool which replays filestore-vhost's profile log - GRPC player #2328

Open
wants to merge 119 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
cde1052
[Filestore] Implement a tool which replays filestore-vhost's profile …
proller Sep 20, 2024
c57e0b5
upload dirty
proller Sep 20, 2024
f79ae3b
clean
proller Sep 23, 2024
21221af
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Sep 23, 2024
83339bd
clean
proller Sep 23, 2024
b503a1e
clean
proller Sep 24, 2024
99c051b
wip
proller Sep 24, 2024
a1f564b
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Sep 24, 2024
2b76fdc
wip (listnodes,...)
proller Sep 24, 2024
a79bd29
correct structure
proller Sep 24, 2024
a297662
merge to loadtest
proller Sep 25, 2024
7b4c62b
move fix
proller Sep 25, 2024
86c763b
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Sep 25, 2024
ff0574b
better
proller Sep 25, 2024
823e1b7
grpc fix
proller Sep 26, 2024
e3da729
wip
proller Sep 27, 2024
a0c0eff
fix resize
proller Sep 27, 2024
d3d1f67
Test scripts
proller Sep 27, 2024
472f048
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Sep 30, 2024
1af310a
support links
proller Sep 30, 2024
c2e7c5c
Better
proller Sep 30, 2024
db3be77
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Oct 1, 2024
42fa690
deduplicate code
proller Oct 1, 2024
8f45bfd
clean
proller Oct 1, 2024
2d3a2d1
Fix dirs
proller Oct 2, 2024
ec9b25b
better names
proller Oct 3, 2024
944b952
temporary remove grpc
proller Oct 3, 2024
940f7b1
clean
proller Oct 3, 2024
ed9f9d5
clean
proller Oct 3, 2024
64d954c
Clean
proller Oct 3, 2024
4d9f9f7
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Oct 3, 2024
9919e94
clean
proller Oct 3, 2024
65e298d
better
proller Oct 4, 2024
f0979bd
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Oct 4, 2024
8c445e0
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Oct 9, 2024
1e27a1e
Some fixes
proller Oct 9, 2024
4929286
Describe vars
proller Oct 9, 2024
d9e9b8d
Fixes
proller Oct 9, 2024
a9f6818
Fixing
proller Oct 9, 2024
262932c
fmt
proller Oct 10, 2024
82ce83c
Some fixes
proller Oct 10, 2024
a6ad099
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Oct 10, 2024
7d53ad9
fixes
proller Oct 11, 2024
6071e1c
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Oct 11, 2024
277106b
fixes
proller Oct 11, 2024
bd9b7de
No stop result
proller Oct 12, 2024
369246d
comment
proller Oct 12, 2024
8fb5141
remoove TargetFilesystemId <- return me!
proller Oct 12, 2024
8a6c2bc
clean
proller Oct 12, 2024
6a5aa09
clean
proller Oct 12, 2024
134d730
read write
proller Oct 12, 2024
a2b4ab0
enum
proller Oct 13, 2024
12b6349
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Oct 13, 2024
80f5609
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Oct 16, 2024
14f1941
[Filestore] Implement a tool which replays filestore-vhost's profile …
proller Oct 17, 2024
1d41d3e
use fspath
proller Oct 17, 2024
a4b51b0
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Oct 17, 2024
7a02c7e
fixes
proller Oct 18, 2024
8d6c955
Fix
proller Oct 21, 2024
a3882d0
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Oct 21, 2024
d96d469
Merge remote-tracking branch 'origin/issues-1733-replay' into issues-…
proller Oct 21, 2024
b9716db
Style
proller Oct 21, 2024
2804fa9
add AccessNode
proller Oct 22, 2024
57cf18f
clean
proller Oct 23, 2024
e704b7e
clean
proller Oct 24, 2024
63243f3
clean
proller Oct 24, 2024
d9584ab
Fix some lost files
proller Oct 24, 2024
2431509
process links
proller Oct 25, 2024
7574491
better errors
proller Oct 28, 2024
b534439
Dont create session
proller Oct 31, 2024
c185c2c
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Oct 31, 2024
9019354
work without session
proller Oct 31, 2024
3724b5f
fix
proller Oct 31, 2024
e4de2a7
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Oct 31, 2024
cede3d6
add flush
proller Nov 1, 2024
fee0279
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Nov 1, 2024
5b2a69f
better create on read
proller Nov 2, 2024
67f4dc6
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Nov 2, 2024
39d6716
wip
proller Nov 5, 2024
6ba589a
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Nov 6, 2024
bf994ba
Fixes
proller Nov 7, 2024
2bbc4bc
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Nov 7, 2024
742a4db
fix
proller Nov 8, 2024
3a611f9
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Nov 8, 2024
eb2336f
flush
proller Nov 9, 2024
e2101a6
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Nov 9, 2024
bc92193
fix
proller Nov 9, 2024
f596100
clean
proller Nov 12, 2024
c70c01f
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Nov 12, 2024
8640837
clean
proller Nov 13, 2024
5c21ee6
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Nov 13, 2024
a552ec1
clean
proller Nov 13, 2024
2131ab8
clean
proller Nov 13, 2024
c188af7
describe comments
proller Nov 14, 2024
273c5d1
Merge remote-tracking branch 'upstream/main' into issues-1733-replay
proller Nov 14, 2024
bb514ea
Fix stop without no session
proller Nov 14, 2024
07e4abe
Merge branch 'issues-1733-replay' into issues-1733-replay-grpc
proller Nov 18, 2024
91de0fd
Merge remote-tracking branch 'upstream/main' into issues-1733-replay-…
proller Nov 18, 2024
689e01d
Periodic status print
proller Nov 19, 2024
6ced9b9
Merge remote-tracking branch 'upstream/main' into issues-1733-replay-…
proller Nov 19, 2024
a5ee756
Merge remote-tracking branch 'upstream/main' into issues-1733-replay-…
proller Nov 20, 2024
fab2ec3
Better getnodeattr
proller Nov 20, 2024
99d10ca
Merge remote-tracking branch 'upstream/main' into issues-1733-replay-…
proller Nov 20, 2024
61d2932
Configurable MaxSleepMcs
proller Nov 21, 2024
8bb357e
Merge remote-tracking branch 'upstream/main' into issues-1733-replay-…
proller Nov 21, 2024
42affde
less warnings
proller Nov 28, 2024
a759eb7
Merge remote-tracking branch 'upstream/main' into issues-1733-replay-…
proller Nov 28, 2024
e5b8e91
Merge remote-tracking branch 'upstream/main' into issues-1733-replay-…
proller Dec 2, 2024
549d401
Greedy create file
proller Dec 9, 2024
28737b4
Merge remote-tracking branch 'upstream/main' into issues-1733-replay-…
proller Dec 11, 2024
d1bd97e
fix
proller Dec 12, 2024
9b98c1d
Merge remote-tracking branch 'upstream/main' into issues-1733-replay-…
proller Dec 12, 2024
dee550e
Merge remote-tracking branch 'upstream/main' into issues-1733-replay-…
proller Dec 20, 2024
bfed6d8
fixes
proller Dec 22, 2024
96f2622
Merge remote-tracking branch 'upstream/main' into issues-1733-replay-…
proller Dec 22, 2024
445e897
Merge remote-tracking branch 'upstream/main' into issues-1733-replay-…
proller Dec 31, 2024
c843ee7
Merge remote-tracking branch 'upstream/main' into issues-1733-replay-…
proller Jan 2, 2025
a86c8eb
Better greedy
proller Jan 8, 2025
adacf4d
Merge remote-tracking branch 'upstream/main' into issues-1733-replay-…
proller Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cloud/filestore/tools/testing/loadtest/lib/request.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,11 @@ IRequestGeneratorPtr CreateReplayRequestGeneratorFs(
TString filesystemId,
NProto::THeaders headers);

IRequestGeneratorPtr CreateReplayRequestGeneratorGRPC(
NProto::TReplaySpec spec,
ILoggingServicePtr logging,
NClient::ISessionPtr session,
TString filesystemId,
NProto::THeaders headers);

} // namespace NCloud::NFileStore::NLoadTest
66 changes: 51 additions & 15 deletions cloud/filestore/tools/testing/loadtest/lib/request_replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ IReplayRequestGenerator::IReplayRequestGenerator(
NProto::TReplaySpec spec,
ILoggingServicePtr logging,
NClient::ISessionPtr session,
TString /*filesystemId*/,
TString filesystemId,
NProto::THeaders headers)
: Spec(std::move(spec))
, TargetFilesystemId(std::move(filesystemId))
, Headers(std::move(headers))
, Session(std::move(session))
{
Expand All @@ -29,8 +30,10 @@ IReplayRequestGenerator::IReplayRequestGenerator(
NEventLog::TOptions options;
options.FileName = Spec.GetFileName();

// Sort eventlog items by timestamp
options.SetForceStrongOrdering(true);
if (const auto sleep = Spec.GetMaxSleepMcs()) {
MaxSleepMcs = sleep;
}

CurrentEvent = CreateIterator(options);
}

Expand All @@ -54,9 +57,8 @@ bool IReplayRequestGenerator::ShouldFailOnError()

void IReplayRequestGenerator::Advance()
{
for (EventPtr = CurrentEvent->Next(); EventPtr;
EventPtr = CurrentEvent->Next())
{
while (EventPtr = CurrentEvent->Next()) {
++EventsProcessed;
MessagePtr = dynamic_cast<const NProto::TProfileLogRecord*>(
EventPtr->GetProto());

Expand All @@ -68,12 +70,23 @@ void IReplayRequestGenerator::Advance()
if (!Spec.GetFileSystemIdFilter().empty() &&
fileSystemId != Spec.GetFileSystemIdFilter())
{
++EventsSkipped;
STORAGE_DEBUG(
"Skipped event with FileSystemId=%s",
fileSystemId.c_str());
"Skipped events=%zu FileSystemId=%s Filter=%s",
EventsSkipped,
fileSystemId.c_str(),
Spec.GetFileSystemIdFilter().c_str());
continue;
}


if (TargetFilesystemId.empty() && !fileSystemId.empty()) {
TargetFilesystemId = fileSystemId;
STORAGE_INFO(
"Using FileSystemId from profile log %s",
TargetFilesystemId.c_str());
}

EventMessageNumber = MessagePtr->GetRequests().size();
return;
}
Expand All @@ -87,7 +100,7 @@ TFuture<TCompletedRequest> IReplayRequestGenerator::ProcessRequest(
case EFileStoreRequest::ReadData:
return DoReadData(request);
case EFileStoreRequest::WriteData:
return DoWrite(request);
return DoWriteData(request);
case EFileStoreRequest::CreateNode:
return DoCreateNode(request);
case EFileStoreRequest::RenameNode:
Expand All @@ -114,6 +127,7 @@ TFuture<TCompletedRequest> IReplayRequestGenerator::ProcessRequest(
case EFileStoreRequest::GenerateBlobIds:
case EFileStoreRequest::PingSession:
case EFileStoreRequest::Ping:
case EFileStoreRequest::DescribeData:
return {};

default:
Expand All @@ -128,7 +142,7 @@ TFuture<TCompletedRequest> IReplayRequestGenerator::ProcessRequest(
break;
}

STORAGE_INFO(
STORAGE_DEBUG(
"Uninmplemented action=%u %s",
action,
RequestName(request.GetRequestType()).c_str());
Expand All @@ -148,37 +162,59 @@ IReplayRequestGenerator::ExecuteNextRequest()
continue;
}

for (; EventMessageNumber > 0;) {
while (EventMessageNumber > 0) {
NProto::TProfileLogRequestInfo request =
MessagePtr->GetRequests()[--EventMessageNumber];
{
auto timediff = (request.GetTimestampMcs() - TimestampMcs) *
++MessagesProcessed;
ui64 timediff = (request.GetTimestampMcs() - TimestampMcs) *
Spec.GetTimeScale();
TimestampMcs = request.GetTimestampMcs();
if (timediff > MaxSleepMcs) {
STORAGE_DEBUG(
"Ignore too long timediff=%lu MaxSleepMcs=%lu ",
timediff,
MaxSleepMcs);

timediff = 0;
}

const auto current = TInstant::Now();

if (NextStatusAt <= current) {
NextStatusAt = current + StatusEverySeconds;
STORAGE_INFO(
"Current event=%zu skipped=%zu Msg=%zd TotalMsg=%zu "
"Sleeps=%f",
EventsProcessed,
EventsSkipped,
EventMessageNumber,
MessagesProcessed,
Sleeps)
}

auto diff = current - Started;

if (timediff > diff.MicroSeconds()) {
auto sleep =
TDuration::MicroSeconds(timediff - diff.MicroSeconds());
STORAGE_DEBUG(
"Sleep=%lu timediff=%f diff=%lu",
"Sleep=%lu timediff=%lu diff=%lu",
sleep.MicroSeconds(),
timediff,
diff.MicroSeconds());

Sleep(sleep);
Sleeps += sleep.SecondsFloat();
}

Started = current;
}

STORAGE_DEBUG(
"Processing message n=%d typename=%s type=%d name=%s data=%s",
"Event=%zu Msg=%zd: Processing typename=%s type=%d name=%s "
"data=%s",
EventsProcessed,
EventMessageNumber,
request.GetTypeName().c_str(),
request.GetRequestType(),
Expand All @@ -193,7 +229,7 @@ IReplayRequestGenerator::ExecuteNextRequest()
}

STORAGE_INFO(
"Profile log finished n=%d hasPtr=%d",
"Profile log finished n=%zd hasPtr=%d",
EventMessageNumber,
!!EventPtr);

Expand Down
15 changes: 11 additions & 4 deletions cloud/filestore/tools/testing/loadtest/lib/request_replay.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,28 @@ class IReplayRequestGenerator: public IRequestGenerator
protected:
const ::NCloud::NFileStore::NProto::TReplaySpec Spec;
TLog Log;
TString TargetFilesystemId; // Only for GRPC
TString FileSystemIdFilter;
const ::NCloud::NFileStore::NProto::THeaders Headers;
NClient::ISessionPtr Session;

ssize_t EventMessageNumber = 0;
ui64 TimestampMcs = 0;
TInstant Started;

// Do not sleep too much if timestamps in log are broken
constexpr static auto MaxSleepMcs = 1000000;
ui64 MaxSleepMcs = 1000000;

private:
THolder<NEventLog::IIterator> CurrentEvent;
TConstEventPtr EventPtr;
int EventMessageNumber = 0;
const NProto::TProfileLogRecord* MessagePtr{};
size_t EventsProcessed = 0;
size_t EventsSkipped = 0;
double Sleeps = 0;
size_t MessagesProcessed = 0;
static constexpr TDuration StatusEverySeconds = TDuration::Seconds(10);
TInstant NextStatusAt = TInstant::Now() + StatusEverySeconds;

TFuture<TCompletedRequest> ProcessRequest(
const NProto::TProfileLogRequestInfo& request);

Expand All @@ -58,7 +65,7 @@ class IReplayRequestGenerator: public IRequestGenerator
virtual TFuture<TCompletedRequest> DoReadData(
const NCloud::NFileStore::NProto::
TProfileLogRequestInfo& /*unused*/) = 0;
virtual TFuture<TCompletedRequest> DoWrite(
virtual TFuture<TCompletedRequest> DoWriteData(
const NCloud::NFileStore::NProto::
TProfileLogRequestInfo& /*unused*/) = 0;
virtual TFuture<TCompletedRequest> DoCreateNode(
Expand Down
Loading
Loading