Skip to content
Open
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
15 changes: 8 additions & 7 deletions src/libsyncengine/jobs/network/networkjobsparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
#include <cstdint>

namespace KDC {
static const int threadPoolMaxCapacity = 10;
static const int threadPoolMinCapacity = 3;
static const uint64_t chunkMaxSize = 100 * 1024 * 1024; // 100MB
static const uint64_t chunkMinSize = 10 * 1024 * 1024; // 10MB
static const int64_t bigFileThreshold = 100 * 1024 * 1024; // if file size > 100MB -> start upload session
static const uint64_t optimalTotalChunks = 200;
static const uint64_t maxTotalChunks = 10000; // Theoretical max. file size 10'000 * 100MB = 1TB
static constexpr int threadPoolMaxCapacity = 10;
static constexpr int threadPoolMinCapacity = 3;
static constexpr uint64_t chunkMaxSize = 100 * 1024 * 1024; // 100MB
static constexpr uint64_t chunkMinSize = 10 * 1024 * 1024; // 10MB
static constexpr int64_t bigFileThreshold = 100 * 1024 * 1024; // if file size > 100MB -> start upload session
static constexpr uint64_t optimalTotalChunks = 200;
static constexpr uint64_t maxTotalChunks = 10000; // Theoretical max. file size 10'000 * 100MB = 1TB
static constexpr uint64_t maxNumberParallelBigDownloads = 3; // Download max. 3 big files in parallel

/*
* Static string
Expand Down
2 changes: 1 addition & 1 deletion src/libsyncengine/jobs/syncjobmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ bool SyncJobManager::canRunJob(const std::shared_ptr<AbstractJob> job) const {
if (currentJobIsBigFileDownloadJob && isBigFileDownloadJob(getJob(runningJobId))) {
// Another big download job is running.
bigDownloadCounter++;
if (bigDownloadCounter >= 3) {
if (bigDownloadCounter >= maxNumberParallelBigDownloads) {
// Allow max 3 big file download jobs in parallel.
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/libsyncengine/reconciliation/syncoperation.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ class SyncOperationList : public SharedObject {
[[nodiscard]] const std::list<UniqueId> &opSortedList() const { return _opSortedList; }
const std::unordered_set<UniqueId> &opListIdByType(const OperationType type) { return _opListByType[type]; }
/**
* @brief Get the list of operation IDs related to the given node. The side must also be provided to handle cases where the
* same ID exists on both the local and remote replicas.
* @brief Get the list of operation IDs related to the given node. The side must also be provided to handle cases where
* the same ID exists on both the local and remote replicas.
* @param nodeId The ID of the object whose operations we want to retrieve.
* @param side The side of the object designated by `nodeId`.
* @return A list of operation IDs.
Expand Down
10 changes: 5 additions & 5 deletions test/libsyncengine/jobs/testsyncjobmanagersingleton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ void TestSyncJobManagerSingleton::testCancelJobs() {
job->setAdditionalCallback(std::bind_front(&TestSyncJobManagerSingleton::callback, this));
SyncJobManagerSingleton::instance()->queueAsyncJob(job, Poco::Thread::PRIO_NORMAL);
const std::scoped_lock lock(_mutex);
(void) _ongoingJobs.try_emplace(static_cast<UniqueId>(job->jobId()), job);
(void) _ongoingJobs.try_emplace(job->jobId(), job);
}
while (_ongoingJobs.size() == localFileCounter) {
Utility::msleep(1); // Wait 1ms
}

cancelAllOngoingJobs();

int retry = 1000; // Wait max 10sec
uint32_t retry = 1000; // Wait max 10sec
while ((!SyncJobManagerSingleton::instance()->_data._managedJobs.empty() ||
!SyncJobManagerSingleton::instance()->_data._queuedJobs.empty() ||
!SyncJobManagerSingleton::instance()->_data._runningJobs.empty() ||
Expand Down Expand Up @@ -394,7 +394,7 @@ void TestSyncJobManagerSingleton::testCanRunjob() {
Utility::msleep(100);
}
CPPUNIT_ASSERT_EQUAL(true, noMoreRun);
CPPUNIT_ASSERT_EQUAL(uint64_t{3}, counter);
CPPUNIT_ASSERT_EQUAL(maxNumberParallelBigDownloads, counter);

while (!SyncJobManagerSingleton::instance()->_data._managedJobs.empty()) {
Utility::msleep(100);
Expand Down Expand Up @@ -466,7 +466,7 @@ void TestSyncJobManagerSingleton::testWithCallbackBigFiles(const SyncPath &dirPa

// Reset upload session max parallel jobs & SyncJobManagerSingleton pool capacity
ParametersCache::instance()->setUploadSessionParallelThreads(10);
SyncJobManagerSingleton::instance()->setPoolCapacity(4 * (int) std::thread::hardware_concurrency());
SyncJobManagerSingleton::instance()->setPoolCapacity(4 * static_cast<int>(std::thread::hardware_concurrency()));
const int useUploadSessionThreshold = 2; // MBs

// Create temp remote directory
Expand Down Expand Up @@ -506,7 +506,7 @@ void TestSyncJobManagerSingleton::testWithCallbackBigFiles(const SyncPath &dirPa
counter++;
}

int waitCountMax = 6000; // Wait max 10 minutes.
uint32_t waitCountMax = 6000; // Wait max 10 minutes.
while (ongoingJobsCount() > 0 && waitCountMax > 0 && !_jobErrorSocketsDefuncted && !_jobErrorOther) {
--waitCountMax;
Utility::msleep(100);
Expand Down