S
S
Sergey Sokolov2014-10-18 11:07:38
Algorithms
Sergey Sokolov, 2014-10-18 11:07:38

How to select tasks to complete depending on their size and age?

There is a growing service, the essence of which is to read certain objects several times a day. Number of objects N . They are constantly added and removed by users a little bit, in general, the trend is growing.
Each object has two properties: the mass M and the timestamp T when it was last read.
Every X minutes, another batch of objects is collected by the cron for execution, which will update them T . In a pack, the total mass of objects is limited - no more than the limit L .
I'm trying to figure out how to solve three problems:

  1. algorithm for selecting objects in the next pack;
  2. introduce different classes of objects: ordinary , priority (at least they fall into every n-th batch) and frequent - they definitely go into each batch;
  3. approximately predict when the current system will exhaust its capacity - and it will be necessary to launch another server or increase the limit L
What model describes such a system?
I see several strategies:
A. "pedal to the floor" - stuff as much as possible into each pack. As N grows, each of the objects will be updated less and less;
B. aim for a constant average update interval for any object. The efficiency is lower. As N grows , the load of each batch will tend to 100% - which means it's time to increase the power.
C.- ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question