Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions Framework/Core/src/ArrowSupport.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "Framework/ServiceRegistryRef.h"
#include "Framework/ServiceRegistryHelpers.h"
#include "Framework/Signpost.h"
#include "Framework/DefaultsHelpers.h"

#include "CommonMessageBackendsHelpers.h"
#include <Monitoring/Monitoring.h>
Expand Down Expand Up @@ -65,7 +66,7 @@ enum struct RateLimitingState {

struct RateLimitConfig {
int64_t maxMemory = 2000;
int64_t maxTimeframes = 1;
int64_t maxTimeframes = 1000;
};

struct MetricIndices {
Expand Down Expand Up @@ -524,7 +525,7 @@ o2::framework::ServiceSpec ArrowSupport::arrowBackendSpec()
if (dc.options.count("timeframes-rate-limit") && dc.options["timeframes-rate-limit"].defaulted() == false) {
config->maxTimeframes = std::stoll(dc.options["timeframes-rate-limit"].as<std::string>());
} else {
config->maxTimeframes = readers;
config->maxTimeframes = readers * DefaultsHelpers::pipelineLength();
}
static bool once = false;
// Until we guarantee this is called only once...
Expand Down
10 changes: 7 additions & 3 deletions Framework/Core/src/CommonDataProcessors.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,16 @@ AlgorithmSpec CommonDataProcessors::wrapWithRateLimiting(AlgorithmSpec spec)
return PluginManager::wrapAlgorithm(spec, [](AlgorithmSpec::ProcessCallback& original, ProcessingContext& pcx) -> void {
auto& raw = pcx.services().get<RawDeviceService>();
static RateLimiter limiter;
O2_SIGNPOST_ID_FROM_POINTER(sid, rate_limiting, &pcx);
auto limit = std::stoi(raw.device()->fConfig->GetValue<std::string>("timeframes-rate-limit"));
LOG(detail) << "Rate limiting to " << limit << " timeframes in flight";
O2_SIGNPOST_EVENT_EMIT_DETAIL(rate_limiting, sid, "rate limiting callback",
"Rate limiting to %d timeframes in flight", limit);
limiter.check(pcx, limit, 2000);
LOG(detail) << "Rate limiting passed. Invoking old callback";
O2_SIGNPOST_EVENT_EMIT_DETAIL(rate_limiting, sid, "rate limiting callback",
"Rate limiting passed. Invoking old callback.");
original(pcx);
LOG(detail) << "Rate limited callback done";
O2_SIGNPOST_EVENT_EMIT_DETAIL(rate_limiting, sid, "rate limiting callback",
"Rate limited callback done.");
});
}

Expand Down