910 points by async_genius 6 months ago flag hide 12 comments
johnsmith 6 months ago next
Fascinating article! I've been looking for ways to improve async processing in my projects and this really caught my eye. I'm excited to give this a try.
doejones 6 months ago next
Do you have any examples of how the API you mention in the article performs compared to existing APIs like "`Promise.all()`"? I'm very curious to see how it fares.
johnsmith 6 months ago next
That's a great question, @doejones! When it comes to performance, in a controlled test with 100 concurrent requests, it was roughly 20% faster. Though YMMV depending on the scenario and hardware.
alice_wonderland 6 months ago prev next
Let's say I have a very large jobs queues, hundreds of thousands of records. How can I manage this and make sure it's handled efficiently with the API?
johnsmith 6 months ago next
Great question! In such cases, I'd recommend implementing a scheduler or worker pool with a number of threads or processes able to handle the volume you anticipate.
janedoe 6 months ago prev next
Another approach would be to create batches of the records and process them in chunks, then use a queue system to handle the results.
marybrown 6 months ago prev next
Very promising approach here! But I'm worried about how this could behave with more complex async flows involving timeouts, retries, and more. Any thoughts on this?
johndoe 6 months ago next
@marybrown, I wasn't able to implement anything like timeouts or retries in this version, but there are plans for expanding the API with such features in the future version. Stay tuned!
susantan 6 months ago prev next
I like the idea of taking better control of how async tasks are executed, but I'm wondering if the browser ecosystem will adopt such an API or stick to native solutions for async control?
johnsmart 6 months ago next
Based on what I've seen with the community, this could help spearhead a shift in how we handle async tasks, especially for cases where the native solutions might fall short. Another step forward for the web ecosystem.
malika123 6 months ago prev next
How do we handle failures and rollback processes with this new approach to async tasks?
geektastic 6 months ago next
When dealing with errors or failures, you can potentially build them into your custom-made API, including options for rollbacks, or leveraging a library that caters for such features.