Skip to main content

Posts

How to scale your Node.js server using clustering

Scalability is a hot topic in tech, and every programming language or framework provides its own way of handling high loads of traffic. Today, we’re going to see an easy and straightforward example about Node.js clustering. This is a programming technique which will help you parallelize your code and speed up performance. “A single instance of Node.js runs in a single thread. To take advantage of multi-core systems, the user will sometimes want to launch a cluster of Node.js processes to handle the load.” -  Node.js Documentation We’re gonna create a simple web server using  Koa , which is really similar to  Express  in terms of use. The complete example is available in  this Github repository . What we’re gonna build We’ll build a simple web server which will act as follows: Our server will receive a  POST  request, we’ll pretend that user is sending us a picture. We’ll copy an image from the filesystem into a temporary di...

Reduce Change Detection Cycles with Event Coalescing in Angular

In this article, I want to talk about a new feature introduced in the latest Angular release (v9) —  ngZoneEventCoalescing . First, we need to understand the problem it is meant to solve. Let’s say we have the following component’s template: @ Component ({      template:   `       <div (click)="parent()">         <button (click)="child()">Submit</button>       </div>     ` ,      changeDetection:   ChangeDetectionStrategy . OnPush   })    export   class   MyComponent  {      parent () {        console . log ( 'parent' );     }         child () {        console ....