Skip to main content

New answers tagged

0 votes

In Flutter I have a number of same async function running whoose result can come at any time. But I want to process the results sequentially

It is not that difficult. Below is a simple example. The longer the text, the longer it takes to process. Playback occurs in the order the text is received. Text is received in alphabetical order, but ...
mezoni's user avatar
  • 11.3k
Best practices
0 votes
0 replies
0 views

How to adhere to abstraction and asynchrony

The await is redundant; nothing happens until one starts "retrieving" from the enumerable. And I wouldn't "to list" ... which is only needed if you intend to "index into" ...
Gerry Schmitz's user avatar
0 votes

Await future for a specific time

Say, we make a http post request and await for its response before we close the http request, but, we wait for only 3 secs, else we close the request. It is not that hard to interrupt your own ...
mezoni's user avatar
  • 11.3k
Best practices
0 votes
0 replies
0 views

How to adhere to abstraction and asynchrony

I think Task<IEnumerable<Patient>> is a controversal combination and should be avoid. If we have a single query with small data fetch then it can be Task<IReadOnlyList<Patient>&...
Dmitrii Bychenko's user avatar
Best practices
0 votes
0 replies
0 views

How to adhere to abstraction and asynchrony

What is your objective when introducing an abstraction around EF? If it is to facilitate unit testing, or to standardize an interface with commonly enforced rules, then I recommend having the ...
Steve Py's user avatar
  • 36.5k
Best practices
0 votes
0 replies
0 views

How to adhere to abstraction and asynchrony

TBH for quite some time I avoid abstracting over collections in the repository - i.e. I return arrays/List's. In my experience using IEnumerable in repositories (at least in ) is a very leaky ...
Guru Stron's user avatar
  • 152k
Best practices
0 votes
0 replies
0 views

How to adhere to abstraction and asynchrony

The interface must cater to the most restrictive implementation. If even one of your implementations requires async, your abstraction is now an asynchronous one. You cannot "hide" asynchrony ...
Max's user avatar
  • 1,068
Advice
0 votes
0 replies
0 views

How to perform asynchronous LLM inference on Kafka streams using Apache Spark, and handle high-throughput RAG ingestion?

Simple answer, do not use Kafka and Spark, use queue like ActiveMQ, Rust and DuckDB/Polars.
Franek's user avatar
  • 666
Advice
0 votes
0 replies
0 views

How to perform asynchronous LLM inference on Kafka streams using Apache Spark, and handle high-throughput RAG ingestion?

my ultimate goal is to capture these LLM response and store in Hive, in this situation microbatch process become sync setup.
Arpan's user avatar
  • 993
Advice
0 votes
0 replies
0 views

How to perform asynchronous LLM inference on Kafka streams using Apache Spark, and handle high-throughput RAG ingestion?

I've just updated my answer with a provider-agnostic Python snippet and more architectural details. Take a look
Fabiola Westfall's user avatar
Advice
0 votes
0 replies
0 views

How to perform asynchronous LLM inference on Kafka streams using Apache Spark, and handle high-throughput RAG ingestion?

Currently, we are using a self-hosted vLLM setup, but we may switch to OpenAI or Anthropic in the future depending on the use case. I agree with your point, but my goal is to design the system in a ...
Arpan's user avatar
  • 993
Advice
0 votes
0 replies
0 views

How to perform asynchronous LLM inference on Kafka streams using Apache Spark, and handle high-throughput RAG ingestion?

As of now we are using self hosted vLLM , but can change it to OpenAI or Anthropic based on the use case in future.
Arpan's user avatar
  • 993
Advice
0 votes
0 replies
0 views

How to perform asynchronous LLM inference on Kafka streams using Apache Spark, and handle high-throughput RAG ingestion?

As of now we are using self hosted vLLM , but can change it to OpenAI/Anthropic based on the use case in future.
Arpan's user avatar
  • 993
Advice
0 votes
0 replies
0 views

How to perform asynchronous LLM inference on Kafka streams using Apache Spark, and handle high-throughput RAG ingestion?

As of now we are using self hosted vLLM , but can change it to OpenAI/Anthropic based on the use case in future.
Arpan's user avatar
  • 993
Advice
0 votes
0 replies
0 views

How to perform asynchronous LLM inference on Kafka streams using Apache Spark, and handle high-throughput RAG ingestion?

As of now we are using self hosted vLLM , but can change it to OpenAI/Anthropic based on the use case
Arpan's user avatar
  • 993
Advice
0 votes
0 replies
0 views

How to perform asynchronous LLM inference on Kafka streams using Apache Spark, and handle high-throughput RAG ingestion?

Great question. Are you using a managed LLM service (like OpenAI/Anthropic) or self-hosted vLLM? The backpressure strategy differs significantly based on the API's rate limits. Architectural Patterns ...
Fabiola Westfall's user avatar
Advice
0 votes
0 replies
0 views

Multithreading Programs

"Async...doesn't refer to threads at all..." The "async" model of concurrent computing can be described without reference to the "threads" model, but many practical ...
Solomon Slow's user avatar
  • 27.7k
0 votes

How to make a delayed future cancelable in Dart?

It can be done like this. And, of course, this is just an example. It can be simplified (by omitting the youStillWantThisToExecute variable). Task.sleep() == Future.delayed() import 'dart:async'; ...
mezoni's user avatar
  • 11.3k
0 votes

Why does Future.timeout not work in dart?

This can be done like this (for example, using Isolate to perform short calculations). While a separate isolate is doing calculations, the current isolate is idle (or performing other tasks). import '...
mezoni's user avatar
  • 11.3k
0 votes

Dart timeout on await Future

I need it because in some networking operation, the connection is sometimes producing silent error. These silent errors are documented for the http package in the close() method: Resources are always ...
mezoni's user avatar
  • 11.3k
0 votes

Flutter multiple async methods for parrallel execution

If you are familiar with the basics of asynchronous programming, then you can do anything the way what you need. For example, like this. import 'dart:async'; import 'dart:math'; import 'package:...
mezoni's user avatar
  • 11.3k
0 votes

Pause an async function until a condition is met in dart

If you need a truly asynchronous solution (based on your own queue, not an internal one), working in a concurrent environment, then you can use an asynchronous monitor (lock + condition variable). ...
mezoni's user avatar
  • 11.3k
5 votes
Accepted

Why does python 3.13.8 raise an IndentationError when running in asyncio mode on the terminal

I am unable to replicate the error under normal conditions: % uv run -p 3.13.0 python3 -m asyncio # asyncio REPL 3.13.0 (main, Oct 16 2024, 08:05:40) [Clang 18.1.8 ] on darwin # Use "await" ...
jqurious's user avatar
  • 24.7k
Advice
1 vote
0 replies
0 views

ESP Watchdog vs AsyncWebServer with expensive handler

AsynWebServer for ESP32 is built on top of AsynTCP, which is the async com callback that executed in the context of tcp network callbacks. Code executing within these callbacks should be fast. While ...
hcheung's user avatar
  • 4,445
0 votes

NG 21 + Vitest + Non-standalone component with async pipe

It's an issue with Angular AOT compilation, non standalone component dependencies are not properly handle during compilation, disable AOT and use JIT instead (AOT is the default behavior with vitest): ...
Niaina Fredson Dorel Ratsima's user avatar
0 votes

Flutter: Prevent deadlocks in a task queue when tasks enqueue other tasks

Maybe this code can handle it? It simply blocks the execution of the next (in the queue) code until current code releases the lock. import 'dart:async'; import 'package:multitasking/synchronization/...
mezoni's user avatar
  • 11.3k
Advice
0 votes
0 replies
0 views

Multithreading Programs

Async/await uses cooperative suspension points within a single thread, while OS threads are scheduled pre-emptively by the kernel. Async does not disable pre-emption; it simply controls where ...
Jim Rogers's user avatar
Advice
0 votes
0 replies
0 views

Multithreading Programs

May be one day async IO will be implemented as a language feature, but not yet. A quick search for async file IO on Linux revealed: 1. POSIX AIO - runs thread pools on your behalf - poor performance 2....
jhnlmn's user avatar
  • 401
Advice
0 votes
0 replies
0 views

Multithreading Programs

All forms of parallelism are still relevant, since each has its own strengths and weaknesses.
ikegami's user avatar
  • 393k
Advice
2 votes
0 replies
0 views

Multithreading Programs

Async in general doesn't refer to threads at all (e.g. async I/O). And when it does (e.g. the async and await keywords in multiple languages), it usually refers co-operative multithreading, which is ...
ikegami's user avatar
  • 393k
Advice
1 vote
0 replies
0 views

Multithreading Programs

“Async” operations are just a more modern and hopefully easier method to control multiple threads. Under the hood it is all multithreading.
gnasher729's user avatar
  • 53.1k
-1 votes

Difference between calling an async method and Task.Run an async method

you should not call method with -Async postfix with Task.Run()!! - thus you create async method twice in ThreadPool, that is unnecessary. - e.g. in var users = await _dbContext.Users.ToListAsync(); ...
JeeyCi's user avatar
  • 652
0 votes

How to limit the maximum number of parallel tasks in C#

Use Polly Rate Limiter, with Concurrency Limiter configuration you can create separate thread pools per use case you can add new tasks into the pool at runtime, during execution, not just at pool ...
Tomasz Modelski's user avatar
0 votes

How to limit the amount of concurrent async I/O operations?

Use Polly Rate Limiter, with Concurrency Limiter configuration you can create separate thread pools per use case you can add new tasks into the pool at runtime, during execution, not just at pool ...
Tomasz Modelski's user avatar
0 votes

How to implement an async task queue with multiple concurrent workers (async) in dart

A counting semaphore is a synchronization primitive that maintains a counter that represents the number of available permits. Example with a limit of no more than 3 simultaneously executed operations. ...
mezoni's user avatar
  • 11.3k

Top 50 recent answers are included