maksim2112
maksim2112

Reputation: 421

System congestion by verticles

There is an application. It consists of many Verticles. They run one after another in a chain. Each following is a consequence of the successful implementation of the previous one. A lot of them. They make several requests to external systems. The main session starts at a time interval.

My question is what will happen if the running session does not have time to complete? Will it stop? Or will it work in parallel with the next? And if both are not fulfilled and the third session starts? Could this all lead to excessive system overload?

Upvotes: 0

Views: 59

Answers (1)

Alexey Soshin
Alexey Soshin

Reputation: 17701

That's a very theoretic question, but I'll try to explain.

Say you have task chain A1->A2->A3->A4, which take 4 seconds, and your new "session" starts after 3 seconds. Next chain will be B1->B2->B3->B4

The way Vert.x operates is by having a task queue. So at the start of the second cycle your queue will become B4, B3, B2, B1, A4

Once cycle after that it will be C4, C3, C2, C1, B4, B3

And so on. Tasks in the queue don't consume CPU, but they consume some memory, so eventually, you'll run out of it.

Note than in real life, and especially when external systems are considered, your tasks won't get out of the queue in the exactly same order. And there's a notion of Vert.x using multireactor pattern, so you have multiple queues. But the idea is the same.

Now you won't experience "excessive system load", since most of those tasks will be idle, and their memory footprint is relatively slow. What you'll experience will me more of a memory leak. But this is still a situation which is best avoided.

Upvotes: 1

Related Questions