Bacancy Bacancy
  • Customers

      Fortune 500 Clients

      Verizon
      Verizon
      Franklin Templeton
      Franklin Templeton
      The Container Store
      The Container Store
      KPMG
      KPMG
      AdviceWorks
      AdviceWorks
      Bridgestone
      Bridgestone
      NatWest Markets
      NatWest Markets
      Shell
      Shell
      Bangkok Bank Ltd
      Bangkok Bank Ltd
      The Children's Place
      The Children's Place
      Edward Jones
      Edward Jones
      United Parcel Service
      United Parcel Service
      Academy Sports & Outdoors
      Academy Sports & Outdoors

      Case Studies

      React JS VueJS Angular JS React Native Flutter Full Stack
      Ruby on Rails Node JS Golang AI & ML Data Science Java
      Python Salesforce DevOps Block Chain Mobile App Embedded & Hardware

      Industries

      Information Technology BFSI Education Marketing & Advertising Manufacturing Retail Logistics & Transportation
      Healthcare eCommerce Public Services Travel & Hospitality Cloud Telecommunications Real Estate
      Explore All
      skype-icon

      Skype ID

      bacancy
      gmail-icon

      Email Us

      [email protected]
      call-yellow-icon

      USA

      +1 347 441 4161
      wp-icon

      UK

      +44 127 479 2316
  • what we do

      Experience

      Digital Workplace Services Product Enhancement

      Insights

      AI & Automation Data Analytics

      SAP Solutions

      SAP Consultation

      Innovate

      Robotic Process Automation Software Engineering Services Internet of Things (IoT) Data Science Artificial Intelligence Machine Learning

      Accelerate

      Cloud - Bacancy Combat Digital Process Automation Open Source Microsoft Dynamics Salesforce

      Assure

      Quality Assurance IT Staff Augmentation

      Embedded & Hardware

      Product Engineering Analog Design Services FPGA Engineering Service Wireless Design Embedded Software Design

      not list

      Hardware Engineering Power Engineering IoT Hardware
      skype-icon

      Skype ID

      bacancy
      gmail-icon

      Email Us

      [email protected]
      call-yellow-icon

      USA

      +1 347 441 4161
      wp-icon

      UK

      +44 127 479 2316
  • who we work with

      Industries

      Banking Financial services & Insurance Startups Oil & Gas

      not list

      Healthcare Life Science Real Estate & Construction Logistics
      bacancy

      Let’s grow together Partner with us

      get quote
      skype-icon

      Skype ID

      bacancy
      gmail-icon

      Email Us

      [email protected]
      call-yellow-icon

      USA

      +1 347 441 4161
      wp-icon

      UK

      +44 127 479 2316
  • about us

      Culture

      Agile Mindset Bacancy Values Bacancy Culture

      About Company

      About Us Leadership Team Awards & Recognition Infrastructure

      not list

      Customer Reviews Our Locations Partnership Media Coverage

      WE ARE

      GREAT PLACE TO WORK - CERTIFIEDTM

      Building and sustaining High-Trust, High-Performance CultureTM

      Bacancy Great Place to Work
      skype-icon

      Skype ID

      bacancy
      gmail-icon

      Email Us

      [email protected]
      call-yellow-icon

      USA

      +1 347 441 4161
      wp-icon

      UK

      +44 127 479 2316
  • technology

      Front End

      Angular Reactjs Vue.js UI/UX

      Platforms

      MS Dynamics Salesforce

      Back End

      Ruby on Rails Node.js Golang Laravel .NET Java Python

      Mobile

      React Native Flutter Android iOS

      Cloud

      AWS DevOps

      QA

      Automation Testing Software Testing

      Embedded & Hardware

      Embedded
      bacancy

      World-class expertise,Delivered

      get quote
      Explore All
      skype-icon

      Skype ID

      bacancy
      gmail-icon

      Email Us

      [email protected]
      call-yellow-icon

      USA

      +1 347 441 4161
      wp-icon

      UK

      +44 127 479 2316
  • PRODUCTS

      EV Products

      Battery Management System Motor Controller AC Charger Explore All

      not list

      CCS2 Controller DC Fast Charger AC Charge Controller
      bacancy

      Let’s grow together Partner with us

      get quote
      skype-icon

      Skype ID

      bacancy
      gmail-icon

      Email Us

      [email protected]
      call-yellow-icon

      USA

      +1 347 441 4161
      wp-icon

      UK

      +44 127 479 2316
hire developers

Bacancy

Bacancy represents the connected world, offering innovative and customer-centric information technology experiences, enabling Enterprises, Associates and the Society to Rise™.

12+

Countries where we have happy customers

1050+

Agile enabled employees

06

World wide offices

12+

Years of Experience

05

Agile Coaches

14

Certified Scrum Masters

1000+

Clients projects

1458

Happy customers

  • Customers
      Case Studies
      • React JS
      • Angular JS
      • Vue JS
      • Node JS
      • AI & ML
      • Explore All
      Fortune 500 Clients
      • Verizon
      • The Container Store
      • KPMG
      • Academy Sports & Outdoors
      • Bangkok Bank Ltd
      • The Children's Place
      • Edward Jones
      • Franklin Templeton
      • AdviceWorks
      • NatWest Markets
      • Bridgestone
      • United Parcel Service
      Industries
      • Information Technology
      • BFSI
      • Education
      • Marketing & Advertising
      • Manufacturing
      • Retail
      • Logistics & Transportation
      • Healthcare
      • eCommerce
      • Public Services
      • Travel & Hospitality
      • Cloud
      • Telecommunications
      • Real Estate
  • What we do
      Experience
      • Digital Workplace Services
      • Product Enhancement
      Insights
      • AI & Automation
      • Data Analytics
      SAP Solutions
      • SAP Consultation
      Innovate
      • Blockchain
      • Software Engineering Services
      • Internet of Things (IoT)
      Accelerate
      • Cloud - Bacancy Combat
      • Digital Process Automation
      • Open Source
      • Microsoft Dynamics
      • Salesforce
      • Service Experience Transformation
      Assure
      • Testing
      • Resource Augmentation
      Embedded & Hardware
      • Product Engineering
      • Analog Design Services
      • FPGA Engineering Service
      • Wireless Design
      • Embedded Software Design
      • Hardware Engineering
      • Power Engineering
      • IoT Hardware
      • AL/ML
  • who we work with
      Industries
      • Banking Financial services & Insurance
      • Startups
      • Oil & Gas
      • Healthcare Life Science
      • Real Estate & Construction
      • Logistics
  • About Us
      About Company
      • About Us
      • Leadership Team
      • Awards & Recognition
      • Infrastructure
      • Our Locations
      • Partnership
      Culture
      • Agile Mindset
      • Bacancy Values
      • Bacancy Culture
  • Technology
      Front End
      • Angular
      • Reactjs
      • Vue.js
      • UI/UX
      Platforms
      • MS Dynamics
      • Salesforce
      Back End
      • Ruby on Rails
      • Node.js
      • Golang
      • Laravel
      • .NET
      • Java
      • Python
      Mobile
      • React Native
      • Flutter
      • Android
      • iOS
      Cloud
      • AWS
      • DevOps
      QA
      • Automation Testing
      • Software Testing
      Embedded & Hardware
      • Embedded
      Explore All
  • Products
    • Battery Management System
    • Motor Controller
    • CCS2 Controller
    • AC Charger
    • DC Fast Charger
    • AC Charge Controller
    • Explore All
  • Careers
  • Work @ Bacancy
  • Blogs
  • Resources
  • Customer Reviews
  • Contact
  • Get Quote
Node.js Application

7 Sure shot Tips to Speed Up Your Node.js Application To Deal With Heavy Production Load

Riken Solanki
Riken Solanki Content Lead
Last Updated on August 9, 2022
July 16, 2019 3 min read

It is said that everyone should have a hobby, and my personal favorite is NodeJS development. Apart from being a leading tool to create server applications in JavaScript, it’s one of the most popular programming languages. Known for offering the functionality in both an application server and web server, Node.js is an essential tool for all the kinds of microservers-based development and delivery. However, when it’s time to take your application and server to its users in a production environment, few things are mandatory to understand to dodge terrible performance and keep your application from trashing.

I am writing this blog to discuss heavy production load and reliability for the applications deployed to production. I have categorized this topic into the “DevOps” world, both operational and traditional operations. So, the information is divided into two different parts.

Make sure to follow these things in your code;

  • Don’t use synchronous functions
  • Handle exceptions properly
  • Use gzip compression
  • Do logging correctly

Things to do in your Setup

  • Use a load balancer
  • Set NODE_ENV to production/development
  • Make sure your app restarts automatically
  • Run your app in a cluster
  • Cache request results
  • Make use of a reverse proxy

1. Things to do in your code to improve your application’s performance

  • Handle exceptions properly
  • Do logging correctly
  • Don’t use synchronous functions
  • Use gzip compression

We recently got an opportunity to build a project to resolve mathematical equation solution, and we had an obvious idea that load balancer in front of our application with an auto-scaling won’t be a good idea. So, we found it listed below tips very useful.

2. Increase Memory Limit for Your Process:

By default, Node.js is configured to the 1GB limit. Considering your server has assigned 4GB for your application will manually set the max memory limit by utilizing Node CLI and the following flag –max-old-space-size

3. Ensure To Use All Of Your CPU Cores:

If you have not defined any special configuration that runs multiple threads of Node on the same server, then save your money and choose a server with just one core.

4. Be Careful Before Using Synchronous Functions

A single call to a synchronous function can return in a few milliseconds. In the case of high-traffic websites, such requests lessen the performance of the application. Make sure to avoid synchronous functions used in production. At the time of the initial startup, the synchronous function is worth justifying.

If you are explicitly logging for the specific purpose of debugging, then instead of using console.log(), ensure to use debug. It will enable you to use DEBUG environment control what debug messages are sent to console.err().

5. Error Handling:

Make sure to use a logging tool Logz,io/AWS CloudWatch to find out the errors that can effortlessly fail your app. Here I would like to advise you to not errors to services like Slack as it usually comes in masses and there are high chances that it can block your application for throttling. My favorite library for logging is Winston.

6. Use Promises

Promises will take care of exceptions in asynchronous code blocks.

app.get('/', function (req, res, next) {
  // do some sync stuff
  queryDb()
    .then(function (data) {
      // handle data
      return makeCsv(data)
    })
    .then(function (csv) {
      // handle csv
    })
    .catch(next)
})
 
app.use(function (err, req, res, next) {
  // handle error
})

Source: expressjs.com

7. Use a Reverse Proxy

Usually, a reverse proxy performs supporting operations in front of a web application on the requests, instead of directing requests to the application, it has the capability to handle compression, error pages, serving files, caching and load balancing among other things. Handling tasks does not require proficient knowledge of the application to reverse proxy frees to perform specific application tasks. This is the reason; I would like to suggest you express a reverse proxy like HAProxy or Nginx in the production.

At Bacancy Technology, we used above-mentioned tips and it resulted in tenfold enhancement in the application’s performance and also helped in terms of reliability and heavy production load to serve thousands of users. If you find above-mentioned tips useful want to leverage most robust and scalable technology to develop high-performing and data-intensive applications, then hire Node.js developer from us to build ultrafast lightweight applications to deal with heavy production load.


Expand Your Digital Horizons With Us.

Start a new project or take an existing one to the next level. Get in touch to start small, scale-up, and go Agile.


Or
E-mail us : [email protected]

Your Success Is Guaranteed !

Related Articles

Node.js statistics
Ritwik Verma

August 7, 2023

Node.js

Node.js Statistics: The Updated Guide on Node.js Usage and Trends

By : Ritwik Verma

Quick Summary: The most popular technical stack for backend development within the tech development marketplace in 2023 is Node.js. It has become the preferred choice...

< 1 Minute Read
Read More
Voice UI in Web
Divyesh Maheta

July 13, 2023

Web Development

How Can You Leverage Voice User Interface in Web Development?

By : Divyesh Maheta

Quick Summary: There was a time when people used to interact with computers using Character User Interface or CUI; wherein people used to type text...

< 1 Minute Read
Read More
NPM Packages
Dipal Bhavsar

July 6, 2023

Node.js

31 Remarkable NPM Packages to Streamline Your Development

By : Dipal Bhavsar

Quick Summary: NPM packages play a pivotal role in modern software development, offering an extensive repository of pre-built tools and libraries. This blog will unlock...

< 1 Minute Read
Read More

How Can We Help You?

india India (HQ)

Corporate House
15-16, Times Corporate Park, Thaltej, Ahmedabad, Gujarat 380059

USA USA

601 Brickell Key Drive, Suite 700, Miami, Florida, 33131, USA

canada Canada

71 Dawes Road, Brampton, On L6X 5N9, Toronto

australia-flag Australia

351A Hampstead Rd, Northfield SA 5085

UAE UAE

1608 Clover Bay, Business Bay, Dubai, UAE. PO Box 62049

sweden Sweden

Junkergatan 4, 126 53 Hagersten


Get in Touch

call-yellow-icon

Contact Number

+1 347 441 4161

gmail-icon

Email Us

[email protected]


  • Employee
  • Brochure
  • Quality Assurance
  • Resources
  • Privacy Policy
  • Sitemap
  • Solutions
  • Careers
  • Testimonials
  • Tutorials
  • QandA
  • Contact Us
  • bacancy google review 4.6
    bacancy google review
    bacancy glassdoor review 4.5
    bacancy glassdoor review
    bacancy clutch review 4.8
    bacancy clutch review
    bacancy goodfirms review 4.5
    bacancy goodfirms review
    iso
    X

    Get Our Newsletter

    Be The First To Get The Latest Updates And Tutorials.

    Request A Free Consultation