node.js - Node: 100s of simultaneous requests slows down server substantially. O.S issue? -


my node application making requests 2 servers, , b. server a, waits 1 request finish before making next one. server b makes 20 requests second without waiting. when i'm making requests server b, requests server take long time. when don't make requests server b, go quickly. requests server b pile up, there no more few hundred in process simultaneously.

i've run exact same application, same node version on joyent smartos instance , don't have problem, assume issue limits operating system sets, , not limits node sets. in node have maxsockets set 10000 explained here, http://markdawson.tumblr.com/post/17525116003/node

i'm running application upstart though don't know if have problem without (that next test). in upstart config file have limit nofile 90000 90000. there other limits can raise documented here, http://upstart.ubuntu.com/wiki/stanzas#limit, don't know do. 1 of these causing problem? else might ubuntu machine's limits set?

i should add i'm launching upstart program via monit in case that's relevant.

you don't mention how talking servera or serverb, node's http library has default limit of 6 connections per host (protocol/server/port) combination. can increase http.globalagent.maxsockets = 20; or whatever maximum be.

other issues related open file/socket limits in os... want @ /proc/sys/fs/file-max instead

from recent linux/documentation/sysctl/fs.txt:

file-max & file-nr:

the kernel allocates file handles dynamically, yet doesn't free them again.

the value in file-max denotes maximum number of file- handles linux kernel allocate. when lots of error messages running out of file handles, might want increase limit.

historically, 3 values in file-nr denoted number of allocated file handles, number of allocated unused file handles, , maximum number of file handles. linux 2.6 reports 0 number of free file handles -- not error, means number of allocated file handles matches number of used file handles.

attempts allocate more file descriptors file-max reported printk, "vfs: file-max limit reached".


specifically ubuntu, if have lot of ufw (firewall) and/or iptables rules in place can effect things too.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -