{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Adapter for Envoy
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • 日本語コミュニティ
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Edge/API Management /
avatar image
5

Node.js Performance Tips: Socket Pooling  

  • Export to PDF
Dibyo Mukherjee created · Jul 02, 2015 at 01:15 AM · 12.1k Views

Apigee Edge supports Node.js version 0.10. In this version of Node, the default connection pool for outgoing http requests to a host is 5. This can be a significant bottleneck if you have many concurrent requests to the same host. This is a very well-known issue. Fortunately, there are some very simple solutions that will make your application more performant in these scenarios:

  • Manually increase the connection pool:
    var http = require('http');    
    http.globalAgent.maxSockets = 100;
    // You could also set it to unlimited (Node v0.12 does by default):
    http.globalAgent.maxSockets = Infinity;
  • Disable HTTP global Agent:
  var http = require('http'); 
  var req = http.request({        
    agent: false,    
    url: "",            
    ...    
  }, function (res) { ... });
thub.nodes.view.add-new-comment
edgenode.jsperformancenpm
Add comment Show 3
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Sathish Balasubramaniyan ♦   · Oct 12, 2016 at 06:07 AM 0
Link

Are there any side-effects of increasing the size of the connection pool or disabling connection pooling (such as increased memory foot-print) that one needs to be aware of when making these changes and would any changes be required in those areas where side-effects could be caused?

avatar image Radhika Talluri · Oct 11, 2018 at 02:07 PM 0
Link

where should i add this off code in node.js

avatar image Jason Walsh · Oct 13, 2018 at 11:42 AM 0
Link

I read somewhere that static files should be served from Nginx which sits in front of Node.js. Why is it not recommended to serve from Node.js directly? Is express.static() not good for production usage?

Jason Walsh

Article

Contributors

avatar image

Follow this article

28 People are following this .

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Navigation

Node.js Performance Tips: Socket Pooling

Related Articles

Sample: Using Node.js caching with Edge policies

Apigee Edge Caching In Detail

New to Edge? : Where to Start

How to dynamically call different target endpoints based on region

Enable SAML for Apigee Edge Production Organizations!

How do I setup maven API deployments to work with a http/https proxy server ?

How to return a WSDL through Edge

How to import a NodeJS module to apigee edge?

Apigee Developer? Here's The Stuff You Should Know

Implementing JMS use cases with Apigee Edge

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2021 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Adapter for Envoy
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • 日本語コミュニティ
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Badges