Issue 1:
Checklist

I have checked the issues list

for similar or identical bug reports.

I have checked the pull requests list

for existing proposed fixes.

I have checked the commit log

to find out if the bug was already fixed in the master branch.

I have included all related issues and possible duplicate issues in this issue

(If there are none, check this box anyway).

Related Issues and Possible Duplicates

Related Issues

None

Possible Duplicates

None

Description

I was going through the scalable architecture of celery and I find this document Link to Post

It stated

Turns out, celery has a very un-optimised implementation for scheduled tasks. It picks a set of tasks from the message broker, iterates over them to check if it time for them to execute or not. We found out, queues that were scheduled for about 36hrs later took 100–1000 times longer to execute completely as compared to the queue with the same task but set to execute instantly 🤯.

Suggestions

For the better clarity can you please tell the implementation behind it

Issue 2:
Checklist

I have read the relevant section in the

contribution guide

on reporting bugs.

I have checked the issues list

for similar or identical bug reports.

I have checked the pull requests list

for existing proposed fixes.

I have checked the commit log

to find out if the bug was already fixed in the master branch.

I have included all related issues and possible duplicate issues

in this issue (If there are none, check this box anyway).

Mandatory Debugging Information

I have included the output of celery -A proj report in the issue.

(if you are not able to do this, then at least specify the Celery

version affected).

I have verified that the issue exists against the master branch of Celery.

I have included the contents of pip freeze in the issue.

I have included all the versions of all the external dependencies required

to reproduce this bug.

Optional Debugging Information

I have tried reproducing the issue on more than one Python version

and/or implementation.

I have tried reproducing the issue on more than one message broker and/or

result backend.

I have tried reproducing the issue on more than one version of the message

broker and/or result backend.

I have tried reproducing the issue on more than one operating system.

I have tried reproducing the issue on more than one workers pool.

I have tried reproducing the issue with autoscaling, retries,

ETA/Countdown & rate limits disabled.

I have tried reproducing the issue after downgrading

and/or upgrading Celery and its dependencies.

Related Issues and Possible Duplicates

Related Issues

None

Possible Duplicates

None

Environment & Settings

celery report Output:

software -> celery:4.3.0 (rhubarb) kombu:4.5.0 py:3.7.3
billiard:3.6.0.0 py-amqp:2.4.2
platform -> system:Darwin arch:64bit
kernel version:17.4.0 imp:CPython
loader -> celery.loaders.app.AppLoader
settings -> transport:amqp results:disabled

redis_max_connections: 30
task_ignore_result: True
worker_send_task_events: True
task_send_sent_event: True
task_compression: 'gzip'
result_compression: 'gzip'
broker_transport_options: {
'visibility_timeout': 691200}

Steps to Reproduce

Start a celery worker with the --prefetch-multiplier=1 flag:

celery -A <project> worker --prefetch-multiplier=1

Check the celery worker's configuration with celery inspect conf True --broker=<broker>.

Note that the `worker_prefetch_multiplier" is still set to the default value:

...
"worker_prefetch_multiplier": 4,
...

Required Dependencies

Minimal Python Version: N/A or Unknown

Minimal Celery Version: N/A or Unknown

Minimal Kombu Version: N/A or Unknown

Minimal Broker Version: N/A or Unknown

Minimal Result Backend Version: N/A or Unknown

Minimal OS and/or Kernel Version: N/A or Unknown

Minimal Broker Client Version: N/A or Unknown

Minimal Result Backend Client Version: N/A or Unknown

Python Packages

pip freeze Output:

Other Dependencies

N/A

Minimally Reproducible Test Case

Expected Behavior

The `worker_prefetch_multiplier" is set to the specified value:

...
"worker_prefetch_multiplier": 1,
...

Actual Behavior

The `worker_prefetch_multiplier" is still set to the default value:

...
"worker_prefetch_multiplier": 4,
...