What's the meaning of "simultaneous" in Tsung? - tsung

Here is my tsung.xml:
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/share/tsung/tsung-1.0.dtd">
<tsung loglevel="warning" version="1.0">
<clients>
<client host="localhost" use_controller_vm="true" maxusers="30000"/>
</clients>
<servers>
<server host="127.0.0.1" port="9988" type="tcp"/>
</servers>
<!--
<monitoring>
<monitor host="localhost" type="erlang"></monitor>
</monitoring>
-->
<load duration="90" unit="second">
<arrivalphase phase="1" duration="1" unit="minute">
<users arrivalrate="300" unit="second" />
</arrivalphase>
</load>
<options>
<option name="thinktime" value="0" random="false" override="true"/>
<option name="tcp_snd_buffer" value="4096"/>
<option name="tcp_rcv_buffer" value="4096"/>
<option name="ports_range" min="1025" max="65535"/>
</options>
<sessions>
<session name="mysocket" probability="100" type="ts_raw">
<request>
<raw datasize="1" ack="local"></raw>
</request>
</session>
</sessions>
</tsung>
It tests my socket program, but I cannot fully understand the Tsung report.
Please help to look at this pic, what does "simultaneous" mean?
If anyone can help to tell me something about the report stats, that will be fine.
Stats like following(fetched from Tsung's manual):
users: Number of simultaneous users.
connected: Number of simultaneous connected users. new in 1.2.2.
Is it good or bad if users and connected is low?
Thank you in advance.

The http server will close the TCP socket if there is no action on it for a while or if it is overloaded. The opening and closing of TCP Sockets is handled automatically by Tsung. That said the 'connected' value is the current number 'users' that are connected to the server. Hope this helps

Related

How can i use chinese string in tsung

I'm china developer, i use tsung to test my application.
but now , i have problem,
this is my xml code.
<options>
<option name="file_server" id="usernames" value="/usr/local/tsung/username.csv" />
</options>
<sessions>
<session name='rec20160406-1853' probability='100' type='ts_http'>
<setdynvars sourcetype="file" fileid="usernames" delimiter=";">
<var name="user_name"/>
</setdynvars>
<request subst="true">
<http url='http://10.2.0.96:3000/sessions?username=%%_user_name%%'>
</http>
</request>
</session>
</sessions>
username.csv
四方茉莉-Ra
宁靜致遠
阿莫西林
脸骑士
大嗨朵
右眼淤青
程子
这明显不科学
冰与火奏鸣曲
I want send user_name to my application, the user_name is read from csv file, the csv file is chinese content.
I start tsung, and watch the nginx access-log.
log:
192.168.60.61 - - [21/Apr/2016:17:17:29 +0800] "GET /sessions?username=\xE5\x86\xB0\xE4\xB8\x8E\xE7\x81\xAB\xE5\xA5\x8F\xE9\xB8\xA3\xE6\x9B\xB2 HTTP/1.1" 500 70 "-" "tsung"
the user_name encode to be \xE5\x86\xB0\xE4\xB8\x8E\xE7\x81\xAB\xE5\xA5\x8F\xE9\xB8\xA3\xE6\x9B\xB2, my application can not resolve this.
please help me , how can i to do.

What is the limit of TCP connections per machine using TSUNG?

I want to generate a lot of requests using TSUNG.
My configuration file is
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" dumptraffic="false" version="1.0">
<clients>
<client host="localhost" maxusers="70000" use_controller_vm="true"/>
</clients>
<servers>
<server host="myhost" port="5222" type="tcp"/>
</servers>
<load>
<arrivalphase phase="1" duration="70000" unit="second">
<users arrivalrate="10" unit="second"/>
</arrivalphase>
</load>
<options>
<option type="ts_jabber" name="global_number" value="70000"/>
<option type="ts_jabber" name="domain" value="my-domain"/>
<option name="file_server" id="userdb" value="/root/userdata.csv"/>
</options>
<sessions>
<session probability="100" name="xmpp-connection" type="ts_jabber" bidi="true" $
<setdynvars sourcetype="file" fileid="userdb" delimiter=";" order="iter">
<var name="userid"/>
</setdynvars>
<transaction name="initial_stream">
<request subst="true">
<jabber type="connect" ack="local">
<xmpp_authenticate username="tsung%%_userid%%" passwd="tsung%%_userid%%"/>
</jabber>
</request>
</transaction>
<thinktime value="2"/>
<transaction name="authenticate">
<request> <jabber type="auth_sasl" ack="local"/> </request>
<request> <jabber type="connect" ack="local"/> </request>
<request> <jabber type="auth_sasl_bind" ack="local"/> </request>
<request> <jabber type="auth_sasl_session" ack="local"/> </request>
</transaction>
<transaction name="roster_get">
<request> <jabber type="iq:roster:get" ack="local"/> </request>
</transaction>
<request> <jabber type="presence:initial" ack="no_ack"/> </request>
<for from="1" to="28" incr="1" var="counter">
<request> <jabber type="raw" ack="no_ack" data="
"/></request>
<thinktime value="60" random="false"/>
</for>
<for from="1" to="30" incr="1" var="counter">
<request> <jabber type="raw" ack="no_ack" data="
"/></request>
<thinktime value="60" random="false"/>
</for>
<transaction name="close">
<request> <jabber type="close" ack="no_ack"/> </request>
</transaction>
</session>
</sessions>
</tsung>
As per the documentation of TSUNG, I can hit the server using multiple client ips (one machine)
http://tsung.erlang-projects.org/user_manual/conf-client-server.html
Several virtual IP can be used to simulate more machines. This is very useful when a load-balancer use the client’s IP to distribute the traffic among a cluster of servers.
<clients>
<client host="louxor" weight="1" maxusers="800">
<ip value="10.9.195.12"></ip>
<ip value="10.9.195.13"></ip>
</client>
<client host="memphis" weight="3" maxusers="600" cpu="2"/>
</clients>
I want to find out how many connections per one machine I can generate using TSUNG.
I have a 32 GB, 8 core machine.
This will depend on two factors:
The maximum number of simultaneously open Erlang ports.
The maximum amount of open file description in your operating system.
For information about the first one see open ports in the 10.2 System Limits section of the Advanced Erlang document. It can be changed using the +Q option when starting the Erlang VM. The default is 16384. And the current limit can be checked using erlang:system_info/1:
erlang:system_info(port_limit).
For second information simply ulimit -n in the shell. How to change this value depends on the operating system but it's a popular topic so you will easily be able to search for instructions.

Resource not found on localhost using Anypoint Studio (MULE)

I tried to do the tutorials suggested on the MuleSoft's website.
I first started with this example:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.6.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8084" doc:name="HTTP Listener Configuration"/>
<flow name="basic_tutorialFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<expression-filter expression="#[payload != '/favicon.ico']" doc:name="Expression"/>
<logger level="INFO" doc:name="Logger" message="Current payload is #[payload]"/>
<set-payload doc:name="Set Payload" value="#['Hello, ' + message.inboundProperties.'http.request.path' + '. Today is ' + server.dateTime.format('dd/MM/yy') + '.' ]"/>
</flow>
</mule>
Which can be found here http://www.mulesoft.org/documentation/display/current/Basic+Studio+Tutorial
I made it using the drag and drop feature and after that I copied the code on the website just to be sure it wasn't my mistake.
When I enter the URL with no payload it works well. I get this response
Hello, /. Today is 23/01/15.
But when I add a payload like in the tutorial it doesn't work :
Resource not found.
I have tried other examples as well, as long as I don't enter a payload it works. Here is what the console tells me :
INFO 2015-01-23 10:33:55,614 [[basic_tutorial].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: Current payload is {NullPayload}
INFO 2015-01-23 10:34:32,794 [[basic_tutorial].HTTP_Listener_Configuration.worker.01] org.mule.module.http.internal.listener.HttpListenerRegistry: No listener found for request: (GET)/asd
INFO 2015-01-23 10:34:32,796 [[basic_tutorial].HTTP_Listener_Configuration.worker.01] org.mule.module.http.internal.listener.HttpListenerRegistry: Available listeners are: [(*)/]
INFO 2015-01-23 10:34:36,205 [[basic_tutorial].HTTP_Listener_Configuration.worker.01] org.mule.module.http.internal.listener.HttpListenerRegistry: No listener found for request: (GET)/world
INFO 2015-01-23 10:34:36,205 [[basic_tutorial].HTTP_Listener_Configuration.worker.01] org.mule.module.http.internal.listener.HttpListenerRegistry: Available listeners are: [(*)/]
So basically the problem is :
INFO 2015-01-23 10:34:36,205 [[basic_tutorial].HTTP_Listener_Configuration.worker.01] org.mule.module.http.internal.listener.HttpListenerRegistry: No listener found for request: (GET)/world
So with 3.6, the HTTP connector has changed drastically. Here are some changes:
Previously, the HTTP connector would place the contents of the path inside your payload. Moreover, now you need to invoke paths as is. What I mean is that nowadays, if your endpoint is listening on http://localhost:8084/, that's where you need to send the request. Sending a request on http://localhost:8084/HelloWorld will NOT match.
Sending a GET request now will set your payload to NullPayload, which admittedly makes sense, since an HTTP GET does not have an HTTP body.
What I suggest is the following: have your endpoint listening on a path as follows:
<http:listener config-ref="HTTP_Listener_Configuration" path="/{name}" doc:name="HTTP"/>
Notice that I've added a placeholder variable called "name", you can change this to whatever you like. You can then access this placeholder as follows:
#[message.inboundProperties['http.uri.params']['name']]
You can use this expression to return some fancy string, as you're doing above:
<flow name="basic_tutorialFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/{name}" doc:name="HTTP"/>
<set-variable variableName="name" value="#[message.inboundProperties['http.uri.params']['name']]" />
<set-payload doc:name="Set Payload" value="#['Hello, ' + flowVars['name'] + '. Today is ' + server.dateTime.format('dd/MM/yy') + '.' ]"/>
</flow>
Cheers,
JS
As told before, the HTTP Connector is deeply changed from version 3.6 onward.
Now, the connector only listen to the specific path you explicitly define.
My issue was that I wasn't even able to get the WSDL by the obious http://localhost:8080/soap?wsdl.
So, the easiest solution I found to solve this issue was to allow the connector to accept all subpaths by ending the path with the wildcard '*'.
Change your project.xml as I show here:
<http:listener config-ref="HTTP_Listener_Configuration" path="/*" doc:name="HTTP"/>
and all subpaths will be processed.

Phase duration exceeded, but not all users were launched

I've test socket with tsung.
tsung.xml:
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" version="1.0">
<!-- Client side setup -->
<clients>
<client host="localhost" use_controller_vm="true" maxusers="10000"/>
</clients>
<!-- Server side setup -->
<servers>
<server host="127.0.0.1" port="5678" 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"></monitor>
</monitoring> -->
<!-- <load duration="1" unit="minute" loop="3"> -->
<load loop="3">
<arrivalphase phase="1" duration="1" unit="minute">
<!-- <users interarrival="0.001" unit="second"></users> -->
<users arrivalrate="200" unit="second" />
</arrivalphase>
</load>
<!--
<options>
<option type="ts_http" name="user_agent">
<user_agent probability="80">Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Galeon/1.3.21</user_agent>
<user_agent probability="20">Mozilla/5.0 (Windows; U; Windows NT 5.2; fr-FR; rv:1.7.8) Gecko/20050511 Firefox/1.0.4</user_agent>
</option>
</options>
-->
<!-- start a session for a http user. the probability is the
frequency of this type os session. The sum of all session's
probabilities must be 100 -->
<sessions>
<session probability="100" name="socket-example" type="ts_socket">
<request>
<socket></socket>
</request>
</session>
</sessions>
</tsung>
And in almost every phase, I received report: Phase duration exceeded, but not all users were launched, just like folloing:
=INFO REPORT==== 21-Sep-2012::14:28:44 ===
ts_config_server:(5:<0.50.0>) All remote beams started, sync
=INFO REPORT==== 21-Sep-2012::14:28:44 ===
ts_config_server:(5:<0.50.0>) New arrival phase 1 for client "localhost" (last ? true): will start 6000 users
=INFO REPORT==== 21-Sep-2012::14:28:44 ===
ts_config_server:(5:<0.50.0>) New arrival phase 2 for client "localhost" (last ? true): will start 6000 users
=INFO REPORT==== 21-Sep-2012::14:28:44 ===
ts_config_server:(5:<0.50.0>) New arrival phase 3 for client "localhost" (last ? true): will start 6000 users
=INFO REPORT==== 21-Sep-2012::14:28:44 ===
ts_config_server:(5:<0.50.0>) New arrival phase 4 for client "localhost" (last ? true): will start 6000 users
=INFO REPORT==== 21-Sep-2012::14:28:44 ===
ts_launcher:(5:<0.84.0>) Expected duration of first phase: 60.0 sec (6000 users)
=INFO REPORT==== 21-Sep-2012::14:28:44 ===
ts_launcher:(5:<0.84.0>) Activate launcher (6000 users) in 10019 msec
=INFO REPORT==== 21-Sep-2012::14:29:54 ===
ts_launcher:(5:<0.84.0>) Phase duration exceeded, but not all users were launched (440 users, 7.3% of phase)
Is there any problem?
Are you sure that's the tsung.xml associated with that log? It looks like you've only specified 1 phase while the log is showing 4...or does that loop recycle the 1st phase identically, 3 more times?
Not sure how familiar you are with Tsung, I just started using it a couple weeks ago and I've found it to be NO JOKE. Extremely powerful. I had to tune it way back because of how wickely it can scale, distribute and force multiply a load.
It looks like you've got it set kinda stout. It's late and my math's never been good but it looks like you're blasting 200,000 http get's a second for a minute. Go ahead and multiply 200,000 x 3 to get a bare minimum packets per second. Is that what your intent was?
What I did was bump it all the way down to 1 user arriving 1 time a second for 1 min to see if it would actaully stop on it's own and get a feeling for it's loading capabilities

communicate with remote host using camel-netty tcp

I have a program running on a remote host that I need to connect to, handshake, then listen for messages. I have setup the following camel route:
<route>
<from uri="netty:tcp://localhost:50001?decoders=#decoders&sync=false" />
<bean ref="TransformMessage" method="inboundDecoder" />
<to uri="eventadmin:messages/aacus/inbound" />
</route>
<route>
<from uri="eventadmin:messages/aacus/outbound" />
<bean ref="TransformMessage" method="outboundEncoder" />
<to uri="netty:tcp://192.168.0.111:50001?allowDefaultCodec=false&sync=false" />
</route>
My question is how do I make this work? If I establish the route using
<from uri="netty:tcp://192.168.0.111:50001?decoders=#decoders&sync=false" />
it fails with a binding error.
How can I setup the connection to respond on a specific port without modifying the server?
This is not possible with either camel-mina nor camel-netty at this time of writing. A consumer can only bind to a local server. There is a JIRA ticket at Apache to implement such a new feature for the future. https://issues.apache.org/jira/browse/CAMEL-1077
Use the following workaround:
Instead ob 192.168.0.111 use localhost.
Then install "socat" and start it as follows
socat -s -u tcp4:192.168.0.111:50001 tcp4:localhost:50001
This will Tunnel your remote connection to the local service you created with camel/netty.

Resources