Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
227 views
in Technique[技术] by (71.8m points)

optimization - Find an algorithm to dynamically optimize the size of the queue

Current state of the world.

  • I have a fixed size Queue of items.
  • Consumers get items from the Queue at different rates. It changes overtime, I.e 10 request by minute , tomorrow it can be 20 request by minute and so on. It changes overtime.
  • Items are put on the Queue to keep up with the desired size of the Queue.
  • The rate of putting items into the queue is also not constant overtime. It can vary.

Problem:

  • find the a size of a queue that ensures that queue are not empty.

With a fixed size queue, we would need to keep a huge size of queue so that the changes to dry out the queue are reduced

So a better approach would be to dynamically change the size of the queue, so that based on the rate of consumers and the rate of producers we find an optimal size of a queue such as:

  • We avoid running out it items on the Queue
  • We avoid keeping a waste of items by keeping lot of items on the queue.
  • Maybe the ideal size is keeping the Queue 25% from getting empty.
question from:https://stackoverflow.com/questions/65861486/find-an-algorithm-to-dynamically-optimize-the-size-of-the-queue

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...