Questions tagged [concurrent-processing]

[CONCURRENT] processing, in sharp contrast to a [PARALLEL] processing, has no specific requirements on when to start, where & in what particular order to execute and when or how to finish a set of tasks, that got a chance to be executed in a free flowing, uncoordinated fashion on a subset of available resources.

In a "just"-[CONCURRENT] process orchestration, the code-units (be it tasks, threads, programmes... ) may but, need not, appear to get executed in some non-[SERIAL], overlapped in time, fashion or simultaneously (just by coincidence), all that by using more than one CPU or processor core and other shared resources to execute a program or multiple computational units.

A "just"-[CONCURRENT] process orchestration does not warrant any mutual coordination, the less a synchronicity a True-[PARALLEL] warrants by definition.

A "just"-[CONCURRENT] process orchestration enables more things to happen con-currently, the process-scheduler and other constraints participate in evaluating, who gets "elected" for such a con-current processing and who not.

68 questions
34
votes
2 answers

FastAPI runs api-calls in serial instead of parallel fashion

I have the following code: import time from fastapi import FastAPI, Request app = FastAPI() @app.get("/ping") async def ping(request: Request): print("Hello") time.sleep(5) print("bye") return {"ping":…
11
votes
3 answers

How to evenly balance processing many simultaneous tasks?

PROBLEM Our PROCESSING SERVICE is serving UI, API, and internal clients and listening for commands from Kafka. Few API clients might create a lot of generation tasks (one task is N messages) in a short time. With Kafka, we can't control commands…
10
votes
2 answers

How to make a lot of concurrent web requests using async and await?

I read the how to by Microsoft at How to: Make Multiple Web Requests in Parallel by Using async and await (C#) and found: private async Task CreateMultipleTasksAsync() { // Declare an HttpClient object, and increase the buffer size. The …
Buyo
  • 173
  • 1
  • 1
  • 10
4
votes
1 answer

How to cancel a future action if another future did failed?

I have 2 futures (2 actions on db tables) and I want that before saving modifications to check if both futures have finished successfully. Right now, I start second future inside the first (as a dependency), but I know is not the best option. I know…
4
votes
1 answer

How to avoid running out of RAM, during a concurrent data proccessing?

I have an issue with data concurrent processing. My PC is running out of RAM quickly. Any advices on how to fix my concurrent implementation? Common class: public class CalculationResult { public int Count { get; set; } public decimal[]…
Alex
  • 4,607
  • 9
  • 61
  • 99
3
votes
0 answers

Is it better to increase process niceness or limit number of cores used on a shared system?

I've often worked in settings where several users have access to the same machine for computationally intensive tasks. The machines in question are standard linux machines (no docker/kubernetes or similar). In some cases, there has been a policy to…
3
votes
1 answer

How to improve code performance ( using Google Translate API )

import time start = time.time() import pandas as pd from deep_translator import GoogleTranslator data = pd.read_excel(r"latestdata.xlsx") translatedata = data['column']. fillna('novalue') list = [] for i in translatedata: finaldata =…
Anna
  • 33
  • 5
3
votes
2 answers

Python multi-threading method

I've heard that Python multi-threading is a bit tricky, and I am not sure what is the best way to go about implementing what I need. Let's say I have a function called IO_intensive_function that does some API call which may take a while to get a…
Baiqing
  • 1,223
  • 2
  • 9
  • 21
3
votes
4 answers

running two scripts simultaneously from a master script when each script has multiple threads within it in python

I want to run two or more python scripts simultaneously from a master script. Each of these scripts already have threads within them which are running in parallel. For example I run script1.py if __name__ == '__main__': pid_vav = PID_VAV('B2') …
2
votes
1 answer

How to concurrently run blocking and non blocking code?

I need to be able to run some code that is going to be blocking and some other code that will then, when blocked, start some other actions. The use-case is the follows: I have a file, called index.ts, running an express and socket server I have a…
2
votes
2 answers

running list of bash commands in a file in parallel

I have a simple text file (command_script.txt) that I am executing as a bash script. The content of command_script.txt is something like this: #!/bin/bash some_command -flags input1 output1 some_command -flags input2 output2 some_command -flags…
2
votes
1 answer

Performance measure on data sizes and identical resources

I have systems that have a large number of cores as well as a cluster. For a particular task for which no serial implementation is available, I can only benchmark w.r.t. time taken for tasks running on different input sizes. I see that even when…
2
votes
1 answer

Using ray to parallelize simulator python

I'm new to ray and I'm trying to parallelize the simulator that I have developed. Here an example of my simulator obviously its more complex. import some_library import sim_library_with_global_object class Model(object): def…
Lorenzo Bottaccioli
  • 441
  • 1
  • 7
  • 20
2
votes
2 answers

How to enforce a sequence of ordered execution in parallel.for?

I have a simple parallel loop doing stuff, and afterwards I save the results to a file. object[] items; // array with all items object[] resultArray = new object[numItems]; Parallel.For(0, numItems, (i) => { object res = doStuff(items[i], i); …
user3696412
  • 1,321
  • 3
  • 15
  • 33
2
votes
1 answer

Writing files concurrently with other cpu-bound tasks with multiprocessing or ray

I have a workstation with 72 cores (actually 36 multithreaded CPUs, showing as 72 cores by multiprocessing.cpu_count()). I tried both multiprocessing and ray for a concurrent processing, in batches of millions of small files, and I would like to…
1
2 3 4 5