Questions tagged [asynchronous-programming]
The asynchronous-programming tag has no summary.
185 questions
2
votes
2
answers
244
views
Best way to add asynchronous execution for already implemented synchronous process
I have a complex process implemented in Java Spring microservice.
Currently this process is triggered on user request and it is synchronously executed.
This often results in a gateway timeout.
...
8
votes
5
answers
4k
views
Expensive constructors. Should they exist? Should they be replaced?
Suppose I have a constructor that performs an expensive IO operation that takes a noticeable amount of time. I don't like it for a few reasons (first of all, it's simply wrong, but there are practical ...
4
votes
3
answers
2k
views
Not await an asynchronous method because it is like an endless loop - good practice?
I inherited a piece of software. This program is connected to an external hardware, which is a measurement device. Every 100 milliseconds, a value is read from this device and displayed to the user. ...
1
vote
5
answers
336
views
Purpose of async/await in web servers when stuck with legacy I/O
A couple days ago I asked about the Purpose of async/await in web servers, and got in-depth answers explaining how in fully asynchronous code, it frees up the CPU completely while also releasing the ...
0
votes
1
answer
142
views
In Java's Fork/Join is the operation for combining results limited to addition?
As I understand it, the join() method merge/composes/combines the results from all subtasks. A simple example I saw was summing the numbers from 1 to N and the subtasks would simply sum a range of ...
1
vote
1
answer
134
views
Return function after kicking off background process
I have a process in golang that I want to kickoff through a RPC call but then have the function return early whilst the process continues in the background. Specifically it’s just a basic db transfer ...
0
votes
0
answers
56
views
How to handle multi-region writes for a joint user registration?
UserA and UserB are signing up for some joint service together. They both have to independently agree to T&Cs before sign-up is complete. Once complete they both receive an email to sign-in.
A 1 ...
0
votes
1
answer
123
views
How are asynchoronous problems handled with imperative programming?
Context
To level set, I've been working with OOP and FP for my whole career, so my experience with the imperative paradigm is limited. The team I joined is made up of very senior (20+ years xp) ...
-2
votes
1
answer
166
views
What is a right way to handle requests?
A social network has API, but also it has some limitations like the amount of requests that can be done in one second (let's say API will give an error, if it accepts more than 3 requests per second)
...
10
votes
8
answers
4k
views
Why is there a shift towards asynchronous and event driven programming?
My question will be mostly about Linux and contemporary X86 hardware.
Clarifying the terms
async event based programming: spawning fixed amount of threads and using some user space scheduling ...
-4
votes
1
answer
447
views
Does native async implementation in languages like Python and C# Solve the "Free Lunch is Over" problem? [closed]
A while ago Herb Sutter wrote The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software which I basically interpret to mean that, in order to improve performance, software engineers ...
2
votes
3
answers
2k
views
How can message queues improve scalability?
I have read in a DDD book that using message queues between communicating services can make the whole architecture more scalable, amazon's documentation mentions that queues provide granular ...
0
votes
3
answers
238
views
Is it better (or preferred) to initialize allocate and free structures used by a thread, "inside the thread"
Let's say we are building a threaded program in C, for example a message queue system where a thread is spawned to manage one end of the queue, and (re)connect sockets.
This can roughly be set up in ...
-1
votes
3
answers
942
views
What happens in terms of call stacks when 10000 setTimeouts are called?
Say we call 10000 setTimeouts, each with a random time, each with a few nested timeouts too. What happens in terms of the 1 call stack, or are there multiple call stacks? How does that work?
So for ...
0
votes
1
answer
343
views
How do Asynchronous Webserver (FastApi, Quart etc.) handle many Requests better than synchronous Webservers
I started using Pythons async features and want to fully understand their use cases. I see webserver like FastApi or Quart which use async features. How are they working different from webservers like ...
2
votes
1
answer
799
views
In an MVC-patterned app, how should one build the interface between model and user interface layers to work nicely with threading?
I am wondering about this. This is a sort of follow-up to my last question here:
In the MVC pattern, what has the responsibility for creating the view?
because now I've run into the question of how to ...
3
votes
1
answer
390
views
How to design asynchronous communication in microservices?
Intro
Hey, my question is kind of hard to explain so I apologize in advance.
Question
I'm trying to implement microservices for our ecommerce and I'm having issues on how to respond to a request when ...
1
vote
1
answer
570
views
std::future everywhere? Why or why not? [closed]
I recently had a discussion with colleagues about the use of futures (std::future in C++) or asynchronous calls in server applications.
On one hand, if you have server logic that needs to access an ...
1
vote
1
answer
347
views
What is the name of this kind of (intra-process, inter-thread, queue-based) event system?
Context
Espressif's embedded development libraries for the ESP32 microcontroller contain an event system based on FreeRTOS.
The event system handles connectivity, interrupts and other IO activity, but ...
1
vote
1
answer
149
views
How could I optimize an AJAX-based site by avoiding unnecessary/duplicate file-reads for each AJAX call?
I'm an IT guy (read: not a professional programmer) and have made an internal monitoring webtool which allows users to search for printers on our print servers. Based on the filtering criteria given, ...
3
votes
1
answer
11k
views
How to approach a large number of multiple, parallel HttpClient requests?
I have a website which offers pages in the format of https://www.example.com/X where X is a sequential, unique number increasing by one every time a page is created by the users and never reused even ...
4
votes
1
answer
846
views
Is this a good design for wrapping asynchronous API calls into a RESTful interface?
I'm working with an API that has many asynchronous calls and handlers. I'd like to extend these with a RESTful interface and endpoints in spring. I'm imagining the usual Controller and Service layers, ...
-1
votes
2
answers
145
views
How to GET multiple values from a database while keeping the request asynchronous?
This is a very small-scale project that I am coding myself, so I am able to build all of the resources however I like. I've done research on this site for help on this issue and can't find anything ...
2
votes
2
answers
922
views
Design tips for waiting for a user input while working on another thread
I am working on an application with multiple threads (using Qt, C++). One of this threads is designed to execute a batch of operations like reading/writing from/to files as well as creating new ones. ...
2
votes
2
answers
157
views
Name of locking approach
I've seen this approach several times, both in async and multithreaded code. A counter is used to track asynchronous behavior or thread behavior - whenever a new action is started, the counter is ...