10
votes
Accepted
Iterating through stacks and queues?
"Stack" and "queue" are terms which are sometimes used to mean two different things, logical and physical.
In a strict sense, they are logical concepts, and by definition, they are ...
9
votes
Accepted
How to name two functions that could be named the same?
Adding a prefix to the function that actually does the work, like doDoStuff
Don't do that. Or you'll end up with doStuff(), doDoStuff(), reallyDoStuff(), reallyReallyDoStuff() and ...
8
votes
Are there any use cases for List when Deques and Arrays are available?
A List is general and flexible.
Generalized structures are ideal for return values in business, web, and desktop applications. It's not optimal to return a Deque or an Array if your consumers will be ...
8
votes
Why would I use a queue to list all files and subfolders recursively
Because
Depth
First
Traversal
Is
A
Silly
Way
To
Display
Files
7
votes
Dealing with data arriving at a different times
Don't view the result as the outcome of a request, but as the followup of an event. The question doesn't specify much so I can only speak in abstract terms. I believe the following to be the best ...
4
votes
How can I represent with UML a process that involves queues?
Your modelling requirement strongly suggest to use UML activity diagram which:
allows to represent processes
can represent concurrency through fork and join nodes
can show object flows within the ...
4
votes
Accepted
Why would I use a queue to list all files and subfolders recursively
There are two options to traverse a tree what a filesystem traditionally is.
Traverse it using recursion.
Use loops and a stack or queue to keep track of the remaining nodes to process
Recursion often ...
4
votes
Are there any use cases for List when Deques and Arrays are available?
Is there a reason to use java.util.List instead of using java.util.Deque?
Yes.
java.util.List has methods to access elements by position. java.util.Deque does not. If you are implementing an ...
4
votes
Iterating through stacks and queues?
There are situations where it would make absolute sense to iterate through a queue. Let’s say there’s a queue of tasks, but the user cancelled one action, and now you want to delete all entries in the ...
4
votes
Accepted
Are self-written queues and linked lists really worth it (better than built-in arrays)?
Will a proper dynamic data structure be more efficient than simulating it with fixed-size arrays? Almost certainly yes. But is it a good idea to build one for your project? This depends on many other ...
3
votes
Accepted
Why are multiple backends in this system?
In many senses, the question seems too broad to me and it's going to be hard to give you an accurate answer to the question What each of these backends really does?. However, we can read the diagram ...
3
votes
Designing an efficient implementation of a random access queue based on a linkedlist
Sorry for the late answer but I think this will give O(1) insertion, removal and random access.
Store the linked list nodes in a pre-allocated array.
Addition involves adding the new node to the ...
3
votes
Accepted
Best Data Structure for ordered list of connected users
What you choose might depend on the particular load you anticipate.
But, I'd start with a simple Queue. Possibly extended with a naive O(n) complexity Remove(item). Or, use a Dictionary or Map to ...
3
votes
Best way to design a billing system for a SaaS
I solved a similar problem with a local copy of the account data on each node in the cluster. They only need a list of valid account identifiers and count of billable events processed on each node, so ...
2
votes
Priority Queue and Set in Java or general
You can certainly have an implementation of a set having priority behavior that conforms to some interface for a set. Nothing prevent you from doing that, other than possibly confusing those folks ...
2
votes
Modified priority queue (with "disabled" elements)
A priority queue is supposed to be kept sorted. If the elements go changing their priority (mutating) while in the queue they won't be resorted because the queue has no idea they changed.
I'm loath ...
2
votes
Accepted
Serving tasks for multiple users from one queue in parallel way
One edge case which is not covered by the Stack Exchange system is the situation where one user is still working on the review task but takes a long time to do it; another user will be offered the ...
2
votes
Accepted
Pull important messages from DLQ queue and save them in a relational database, to be analyzed and sent back later. Is it a good idea?
The proper term for the issue you are addressing is 'poison message processing'. Dead letter queues are typically used by messaging systems for undeliverable messages. A poison message is one that a ...
2
votes
Design question for handling large volumes of messages in multi-tenant queue
This sounds like a variation of the 'process events in order' problem.
You can solve the ordering by having a queue per tenant, but with multiple workers you will also need an extra system to 'lock' ...
2
votes
Accepted
What kind of queue should I use for processing large volume of data?
Queues do not offload tasks. Queues just... queue up tasks. Queue can be useful when you have one part of the system producing a burst of tasks or data and then another part can process the tasks/data ...
1
vote
Design question for handling large volumes of messages in multi-tenant queue
This approach may be viable in scenarios where the message volume is relatively stable for a tenant.
Create N number of queues, start with say 5 queues, and allocate multiple tenants to a queue based ...
1
vote
Accepted
Distributed processing of a large number of queues
How many simultaneous transactions per user do you receive? and how frequently? If it's a lot, then having a queue would not help anyway, your response times would take a hit.
Generally, there are not ...
1
vote
Accepted
why and when is queues used in backend architectures?
since instead of a lot of users should wait a bit for the user asking for the backend to do the syncrhonous task to be performed then the user asking for it would potentially wait a long time
No one ...
1
vote
Worker pool running tasks of the same kind serially
It's broadly fine, I've seen this design before and it works.
The only slight concerns are:
you're looking up each Runner twice: first in createRunnerIfNotExists_ and again immediately afterwards. ...
1
vote
Worker pool running tasks of the same kind serially
You can use a reactive library such as RxCpp.
Use the group_by operator to select on the tag for each piece of work. This gives you a collection of observables. Then perform each observable on its ...
1
vote
Accepted
Queue management project - Recommendations
Design issue
In reality you have two very different booking processes with different rules:
Online, it’s fixed hour
On site, it’s relative order (first arrived, first served)
Mixing both in a single ...
1
vote
Do I need a queue manager over the database generating execution requests?
I think since you are targetting a robust system and concern about performance, it is better to use a queue system for Job execution and set up priority.
I am not seeing any fault or problem storing ...
1
vote
Best design for a AMQP work queue
Depends on the duration of these long running tasks (validations) and desired client (producer) interaction.
If the tasks are not too time consuming and clients would prefer a result of the upload in ...
1
vote
Dealing with data arriving at a different times
One way to approach this and avoid the possibility of a race condition is to create a table structure something like this:
----------------------
| ID | user | queue |
----------------------
| 12 | ...
1
vote
Pull important messages from DLQ queue and save them in a relational database, to be analyzed and sent back later. Is it a good idea?
I understand your concerns about this, but I would say that yes, you do need to extract the dead messages from the queuing system.
My sole reason for saying this is this sentance:
maybe even reject ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
queue × 69design × 12
data-structures × 8
multithreading × 8
architecture × 7
message-queue × 7
java × 6
algorithms × 6
design-patterns × 5
api × 4
node.js × 4
scheduling × 4
c++11 × 3
list × 3
rabbitmq × 3
cron × 3
c# × 2
c++ × 2
database × 2
python × 2
web-services × 2
software × 2
distributed-system × 2
backend × 2
apache-kafka × 2