Increase Max Connections under Ubuntu? (Tsung conc

2019-04-16 07:59发布

问题:

I am testing NodeJs, especially the concurrency. I am using Tsung for this. Unfortunately Tsung seems not be able to spawn enough users. I'm only getting about 30K simultaneous connections although ~2GB RAM is still unused. (Check the charts)

The XML-Config File is the following:

<tsung loglevel="notice" version="1.0">
<!-- Client side setup -->
−
<clients>
<client host="localhost" use_controller_vm="false"/>
<client host="localhost" use_controller_vm="false"/>
</clients>
<!-- Server side setup -->
−
<servers>
<server host="localhost" port="8000" type="tcp"/>
</servers>
−
<!--
 to start os monitoring (cpu, network, memory). Use an erlang
  agent on the remote machine or SNMP. erlang is the default 
-->
−
<monitoring>
<monitor host="localhost" type="erlang"/>
</monitoring>
−
<load>
−    
<arrivalphase phase="1" duration="50" unit="minute">
<users interarrival="0.000000001" unit="second"/>
</arrivalphase>
</load>
−
<sessions>
−
<session name="nodeJS" probability="100" type="ts_http">
−
<for from="0" to="40" incr="1" var="counter">
−
<request>
<http url="http://localhost:8000/" version="1.1" method="GET"/>
</request>
<thinktime random="false" value="300"/>
</for>
</session>
</sessions>
</tsung>

So how to increase the users, so that all the RAM is used???

回答1:

I solved the problem!!! I just needed to increase the Port Range. With 4GB RAM i reach nearly the max possible Port Range. Exactly 61980 simultaneous connections. Great NodeJs!



回答2:

Depending on your CPU architecture, node might only support 1GB of RAM: http://code.google.com/p/v8/issues/detail?id=847

To work around this you can run multiple instances of node (and have them talk to each other if needed). Libraries like multi-node can help with this: https://github.com/kriszyp/multi-node

Otherwise you need to look into tuning your server for lots of long running connections - outside my expertise but there are lots of people thinking about this. Here's a thread from the nodejs Google Group about supporting 100k connections: https://groups.google.com/d/topic/nodejs/0Z34PH_R88o/discussion



标签: node.js tsung