JS

Node.js Worker Threads vs Cluster: When to Use Which

Introduction We had one API endpoint that generated a PDF report. It worked fine in testing. Then a customer ran it on a big dataset, and for about four seconds every other request to the server just hung. Health checks timed out, and the load balancer pulled the instance out of rotation. The database was […]

Java/JVM

Why not CompletableFuture? Reactive Programming is the Rescue!

For many use cases, when you have to perform compute-intensive work, make network calls, or execute some parallel processing, we tend to go with multi-threading. Some temporary threads are spawned to process smaller tasks and merged back to the main request thread post-processing. CompletableFutures CompletableFutures were introduced in Java 8 (2014). The CompletableFuture API is a […]

AWSDevOps

Concurrency and Parallelism using Python

As we know Python supports multiple approaches for concurrent programming with threads, sub-processes and some other ways which could help achieving solutions built on multiple CPUs or multi-core CPU.   I tried implementing something similar on my existing use case for AWS Security Re-Check where I was running a check on AWS for my responsibilities […]

Grails

Groovy Goodness – ReadWriteLocks

We often use synchronization. Imagine you have a use case in which there is some resource upon which writing is not done as much as compared to reading. So multiple threads should be able to read concurrently same resource without any problems. But if a single thread wants to write to the resource, for that all new […]