8000 Feature/new server infra by maierlars · Pull Request #7733 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Feature/new server infra #7733

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

Merged
merged 42 commits into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6f3593b
Decoupled IO handling from Scheduler.
Jul 23, 2018
1bd0db0
Fixed SSL start up bug.
Jul 24, 2018
0a3fe50
Replaced Scheduler with new worker farm implementation.
Jul 25, 2018
0400054
Added minimal statistics and info string for Scheduler.
Jul 25, 2018
bc0f94c
Added support for timed submissions.
Jul 27, 2018
fdd2033
Updated delayed submission api. Updated code that used timers.
Jul 31, 2018
3cb9b62
Extracted new Scheduler into a virtual parent class. The implementati…
Aug 1, 2018
bdc8d9b
Signal handler now working.
Aug 1, 2018
3796c3b
Changed threads names, `_stop` is atomic, check for failure during th…
Aug 2, 2018
5e6a3f2
Commented on source code and added TODOs.
Aug 3, 2018
e9ccd72
Merge branch 'devel' into feature/new-server-infra
Aug 3, 2018
0e99af6
Played around with start-stop-conditions
Aug 8, 2018
6fd7f26
Play around with start stop condition.
Aug 8, 2018
e65585c
start stop cond
Aug 8, 2018
c6ac00f
Sart Stop Conditions
Aug 8, 2018
a5516b2
Removed bad cv_status check.
Aug 9, 2018
3e12cb0
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
Aug 10, 2018
aa6672c
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
Aug 10, 2018
43fb2d9
Bug fix: now compare the actual objects instead of pointer values. Se…
Aug 10, 2018
c6a54c1
Moved most of the stuff now unrelated to the Scheduler to GeneralServ…
Aug 13, 2018
556f3e9
Instead of waiting for a thread to terminate, put it on a clean up li…
Aug 15, 2018
0ed5f82
Allow detaching long running threads.
Aug 15, 2018
20132a0
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
Dec 11, 2018
e2fc7e1
Fixed test mock.
Dec 12, 2018
ebcd63a
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
Dec 17, 2018
d186d14
Updated the WorkHandle logic. Removed post functions.
Dec 18, 2018
80c9f6a
Fixed crash when obtaining shared_ptr from this in destructor.
Dec 18, 2018
fdff089
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
Dec 18, 2018
a61a809
Added lost mutex.
Dec 18, 2018
8d4c003
Fixed memory leak.
Dec 18, 2018
3ff4806
Fixed merge bug.
Dec 18, 2018
e2fa338
Changed a lot of code to optimize the scheduler.
Dec 19, 2018
090e2cd
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
Dec 19, 2018
b37d5fd
Fixed bug of invalidated iterator. Dont remove task on shutdown at di…
Dec 19, 2018
2ccf743
Only by value calls to queue.
Dec 20, 2018
947fe2f
Added options again.
Dec 20, 2018
992e44c
Clean up of code.
Dec 20, 2018
b6bbc8c
UI Request Lane added.
Dec 20, 2018
1e8d3bd
Bug fixes in Scheduler.
Dec 21, 2018
4d6b0a0
Merge remote-tracking branch 'origin/devel' into feature/new-server-i…
Jan 7, 2019
83a775e
Applied reformat.
Jan 7, 2019
55e70a3
Use sigaction.
Jan 7, 2019
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
Prev Previous commit
Next Next commit
Bug fix: now compare the actual objects instead of pointer values. Se…
…tup t1 and t2 depending on the thread id.
  • Loading branch information
lamai93 committed Aug 10, 2018
commit 43fb2d9d62a2f08244b52b25d93a5717f318b3d2
11 changes: 8 additions & 3 deletions arangod/Scheduler/Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,16 @@ void Scheduler::shutdown () {

void Scheduler::runCron() {

std::unique_lock<std::mutex> guard(_priorityQueueMutex);

uint64_t tick = 0;

while (!isStopping()) {

tick++;

auto now = clock::now();

std::unique_lock<std::mutex> guard(_priorityQueueMutex);

clock::duration sleepTime = std::chrono::milliseconds(50);

Expand All @@ -127,7 +132,7 @@ void Scheduler::runCron() {
} else {
auto then = (top->_due - now);

sleepTime = sleepTime > then ? then : sleepTime;
sleepTime = (sleepTime > then ? then : sleepTime);
break ;
}
}
Expand All @@ -147,8 +152,8 @@ Scheduler::WorkHandle Scheduler::postDelay(clock::duration delay,
}

std::unique_lock<std::mutex> guard(_priorityQueueMutex);

auto handle = std::make_shared<Scheduler::DelayedWorkItem>(callback, delay);

_priorityQueue.push(handle);

if (delay < std::chrono::milliseconds(50)) {
Expand Down
14 changes: 9 additions & 5 deletions arangod/Scheduler/Scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ class Scheduler {
_handler(std::move(handler)), _due(clock::now() + delay), _cancelled(false) {}

void cancel() { _cancelled = true; };
bool operator <(const DelayedWorkItem & rhs) const
{
return _due < rhs._due;
}
};

class WorkGuard {
Expand Down Expand Up @@ -154,9 +150,17 @@ class Scheduler {
// For tasks above 50ms the Cron Thread is woken up to potentially update its sleep time, which
// could now be shorter than before.

struct compare {
bool operator()(std::shared_ptr<DelayedWorkItem> const &left,
std::shared_ptr<DelayedWorkItem> const &right) {
// Reverse order, because std::priority_queue is a max heap.
return right->_due < left->_due;
}
};

std::priority_queue<std::shared_ptr<DelayedWorkItem>,
std::vector<std::shared_ptr<DelayedWorkItem>>,
std::greater<std::shared_ptr<DelayedWorkItem>>> _priorityQueue;
compare> _priorityQueue;
std::mutex _priorityQueueMutex;
std::condition_variable _conditionCron;

Expand Down
14 changes: 8 additions & 6 deletions arangod/Scheduler/SupervisedScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,6 @@ void SupervisedScheduler::shutdown () {
Scheduler::shutdown();
}

SupervisedScheduler::WorkerState::WorkerState(SupervisedScheduler &scheduler) :
_queueRetryCount 8000 (100),
_sleepTimeout_ms(100),
_stop(false),
_thread(new SupervisedSchedulerWorkerThread(scheduler)) {}

void SupervisedScheduler::runWorker()
{
uint64_t id;
Expand All @@ -228,6 +222,9 @@ void SupervisedScheduler::runWorker()

auto &state = _workerStates[id];

state._sleepTimeout_ms = 20 * (id + 1);
state._queueRetryCount = (512 >> id) + 3;

while (true) {
std::unique_ptr<WorkItem> work = getWork(state);
if (work == nullptr) {
Expand Down Expand Up @@ -380,6 +377,11 @@ SupervisedScheduler::WorkerState::WorkerState(SupervisedScheduler::WorkerState &
_stop(that._stop.load()),
_thread(std::move(that._thread)) {}

SupervisedScheduler::WorkerState::WorkerState(SupervisedScheduler &scheduler) :
_queueRetryCount(100),
_sleepTimeout_ms(100),
_stop(false),
_thread(new SupervisedSchedulerWorkerThread(scheduler)) {}

bool SupervisedScheduler::WorkerState::start() {
return _thread->start();
Expand Down
0