Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Titan internal communication(Unix domain sockets vs. TCP sockets)
Titan internal communication [message #1741846] Tue, 30 August 2016 07:03
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
The executing Titan architecture consists of the following components:
a Main Controller(MC), a Host Controller (HC) for each host on which Titan is executing,
a Main Test Component ( MTC), and zero to any number of Parallel Test Components (PTC)
(see Userguide Ch.4 Executing Test Suites).
MC maintains a control connection with all other components (HCs, MTC and PTCs).
This control connection can be based on Unix domain sockets(if the comunicating componenets reside on the same machine) or TCP Sockets.
When TCP sockets are used, each of these connections use an open file descriptor, which is a limited resource in the operating system.
If many test components should be run simultaneously, this limitation can be a bottleneck.
However, the number of open files per process can be increased up to a so called hard limit
(for example 1024 on Solaris and unlimited on Linux). The limit can be increased by a built-in shell command
(limit on tcsh and ulimit on bash) before starting the MC.
Unix domain sockets are faster than TCP sockets , as no stack is involved, and don't come with the above limitations.
By default , Titan will use Unix domain sockets for communication on the same machine.
Besides the control connections, components can also be connected via internal test ports, or mapped to the test system with ports etc.


Let's consider the following scenarios:


+-------------------------------------------------------------------------------+
|  +------------------------------------------------+ +--------------------+    |
|  | +------------------+     +------------------+  | | +----------------+ |    |
|  | |                  |     |                  |  | | |                | |    |
|  | |   +---------+    |     |     +---------+  |  | | | +---------+    | |    |
|  | |   |         +---------------->         |  |  | | | |         |    | |    |
|  | |   | MC      +-------------------------------------->         |    | |    |
|  | |   |         |    |     |     |         |  |  | | | |         |    | |    |
|  | |   |         |    |     |     |    HC1  |  |  | | | |   HC2   |    | |    |
|  | |   +------+-++    |     |     +---------+  |  | | | +---------+    | |    |
|  | |          | |     |     |                  |  | | |                | |    |
|  | |          | |     |     |     +---------+  |  | | | +---------+    | |    |
|  | |          | +--------------------------------------->         |    | |    |
|  | |          +------------------->         |  |  | | | |         |    | |    |
|  | |                  |     |     |  MTC    |  |  | | | |  PTC    |    | |    |
|  | |                  |     |     |         |  |  | | | |         |    | |    |
|  | |                  |     |     +---------+  |  | | | +---------+    | |    |
|  | |                1 |     |                1 |  | | |              1 | |    |
|  | +------------------+     +------------------+  | | +----------------+ |    |
|  |                                                | |                    |    |
|  |                                                | |                    |    |
|  |                                             2  | |                  2 |    |
|  +------------------------------------------------+ +--------------------+    |
|                                                                               |
|                                                                               |
|                                                                               |
|                                                                            3  |
+-------------------------------------------------------------------------------+



Scenario 1: MC , HC1 and MTC, HC2 and PTC running on separate machines
In this scenario, control communication is based on TCP sockets.


      MC    HC1      TS

      MC    HC2      TS
1
      MC    MTC      TS

      MC    PTC      TS


Scenario 2: MC , HC1 and MTC running on one machine, HC2 and PTC running on another.
In this scenario, control communication is based on both Unix and TCP sockets.


      MC    HC1      US

      MC    HC2      TS
2
      MC    MTC      US

      MC    PTC      TS


Scenario 3: All components residing on the same machine.
In this scenario, control communication is based on both Unix domain sockets exclusively.

      MC    HC1      US

      MC    HC2      US
3
      MC    MTC      US

      MC    PTC      US



Use of Unix sockets can be controlled via a configuration parameter UnixSocketsEnabled in the [MAIN_CONTROLLER]
section of the configuration file. Its' default value is yes. We will use three terminals, two for controlling Titan, the third to examine
the control conectiond with netstat.

First with Unix sockets enabled:

[MAIN_CONTROLLER]
TCPPort := 9034
UnixSocketsEnabled := Yes  



terminal 3
netstat -antp --unix |grep mctr
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)



Main controller is started:
terminal 1

mctr_cli ./client.cfg 

*************************************************************************
* TTCN-3 Test Executor - Main Controller 2                              *
* Version: CRL 113 200/5 R5B01                                          *
* Copyright (c) 2000-2016 Ericsson Telecom AB                           *
* All rights reserved. This program and the accompanying materials      *
* are made available under the terms of the Eclipse Public License v1.0 *
* which accompanies this distribution, and is available at              *
* http://www.eclipse.org/legal/epl-v10.html                             *
*************************************************************************

Using configuration file: ./client.cfg
MC@ntaf: Unix server socket created successfully.
MC@ntaf: Listening on TCP port 9034.
MC2> 



and listening:

(both on Unix sockets and TCP sockets; the MC may be contacted across the network on TCP sockets , but internally will use Unix domain sockets)

terminal 3
 netstat -antp --unix |grep mctr
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:9034            0.0.0.0:*               LISTEN      6772/mctr_cli   
unix  2      [ ACC ]     STREAM     LISTENING     34114    6772/mctr_cli       /tmp/ttcn3-mctr-9034




Host controller is started:
terminal 2
./SocketCANtest localhost 9034
TTCN-3 Host Controller (parallel mode), version CRL 113 200/5 R5B01
The address of MC was set to a local IP address. This may cause incorrect behavior if a HC from a remote host also connects to MC.



and is connected to the MC:

netstat -antp --unix |grep mctr
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:9034            0.0.0.0:*               LISTEN      6772/mctr_cli   
unix  2      [ ACC ]     STREAM     LISTENING     34114    6772/mctr_cli       /tmp/ttcn3-mctr-9034
unix  3      [ ]         STREAM     CONNECTED     34145    6772/mctr_cli       /tmp/ttcn3-mctr-9034



terminal 1
MTC created:

cmtc
MC@ntaf: Downloading configuration file to all HCs.
HC@ntaf: Warning: The address of MC was set to a local IP address. This may cause incorrect behavior if a HC from a remote host also connects to MC.
MC@ntaf: Configuration file was processed on all HCs.
MC@ntaf: Creating MTC on host 127.0.0.1.
MC@ntaf: MTC is created.
MC2> 



and connected to the MC:
terminal 3

netstat -antp --unix |grep mctr
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:9034            0.0.0.0:*               LISTEN      6772/mctr_cli   
unix  2      [ ACC ]     STREAM     LISTENING     34114    6772/mctr_cli       /tmp/ttcn3-mctr-9034
unix  3      [ ]         STREAM     CONNECTED     34174    6772/mctr_cli       /tmp/ttcn3-mctr-9034
unix  3      [ ]         STREAM     CONNECTED     34145    6772/mctr_cli       /tmp/ttcn3-mctr-9034



MTC started:
terminal 1
 smtc
Executing all items of [EXECUTE] section.
MC2> MTC@ntaf: Test case tc_can_raw0 started.
MTC@ntaf: Test case tc_can_raw0 finished. Verdict: pass
MC@ntaf: Test execution finished.
Execution of [EXECUTE] section finished.





terminal 3
ntaf@ntaf:~$ netstat -antp --unix |grep mctr
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:9034            0.0.0.0:*               LISTEN      6772/mctr_cli   
unix  2      [ ACC ]     STREAM     LISTENING     34114    6772/mctr_cli       /tmp/ttcn3-mctr-9034
unix  3      [ ]         STREAM     CONNECTED     34174    6772/mctr_cli       /tmp/ttcn3-mctr-9034
unix  3      [ ]         STREAM     CONNECTED     34145    6772/mctr_cli       /tmp/ttcn3-mctr-9034




MTC ends:
terminal 1
emtc
MC@ntaf: Terminating MTC.
MTC@ntaf: Verdict statistics: 0 none (0.00 %), 1 pass (100.00 %), 0 inconc (0.00 %), 0 fail (0.00 %), 0 error (0.00 %).
MTC@ntaf: Test execution summary: 1 test case was executed. Overall verdict: pass
MC@ntaf: MTC terminated.



and disconnects from the MC:
terminal 3
 netstat -antp --unix |grep mctr
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:9034            0.0.0.0:*               LISTEN      6772/mctr_cli   
unix  2      [ ACC ]     STREAM     LISTENING     34114    6772/mctr_cli       /tmp/ttcn3-mctr-9034
unix  3      [ ]         STREAM     CONNECTED     34145    6772/mctr_cli       /tmp/ttcn3-mctr-9034


Main controller terminates, HC is also exited.
terminal 1
quit
MC@ntaf: Shutting down session.
MC@ntaf: Shutdown complete.





terminal 3
netstat -antp --unix |grep mctr
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)



And then with TCP Sockets, by disabling Unix sockets in the config:

[MAIN_CONTROLLER]
TCPPort := 9034
UnixSocketsEnabled := No


terminal 3
netstat -antp --unix |grep mctr
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)


Main controller is started:

terminal 1
mctr_cli ./client.cfg 

*************************************************************************
* TTCN-3 Test Executor - Main Controller 2                              *
* Version: CRL 113 200/5 R5B01                                          *
* Copyright (c) 2000-2016 Ericsson Telecom AB                           *
* All rights reserved. This program and the accompanying materials      *
* are made available under the terms of the Eclipse Public License v1.0 *
* which accompanies this distribution, and is available at              *
* http://www.eclipse.org/legal/epl-v10.html                             *
*************************************************************************

Using configuration file: ./client.cfg
MC@ntaf: Listening on TCP port 9034.


MC listens only on TCP :

terminal 3
netstat -antp --unix |grep mctr
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:9034            0.0.0.0:*               LISTEN      6956/mctr_cli  



Host controller is started:
terminal 2
 ./SocketCANtest localhost 9034
TTCN-3 Host Controller (parallel mode), version CRL 113 200/5 R5B01
The address of MC was set to a local IP address. This may cause incorrect behavior if a HC from a remote host also connects to MC.


and connected to MC:

the difference is obvious

terminal 3
netstat -antp --unix |grep mctr
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:9034            0.0.0.0:*               LISTEN      6956/mctr_cli   
tcp        0      0 127.0.0.1:9034          127.0.0.1:57434         ESTABLISHED 6956/mctr_cli 


MTC created:
terminal 1
cmtc
MC@ntaf: Downloading configuration file to all HCs.
HC@ntaf: Warning: The address of MC was set to a local IP address. This may cause incorrect behavior if a HC from a remote host also connects to MC.
MC@ntaf: Configuration file was processed on all HCs.
MC@ntaf: Creating MTC on host localhost.
MC@ntaf: MTC is created.


and connected to MC:
terminal 3
 netstat -antp --unix |grep mctr
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:9034            0.0.0.0:*               LISTEN      6956/mctr_cli   
tcp        0      0 127.0.0.1:9034          127.0.0.1:50668         ESTABLISHED 6956/mctr_cli   
tcp        0      0 127.0.0.1:9034          127.0.0.1:57434         ESTABLISHED 6956/mctr_cli  



MTC started:

terminal 1
smtc
Executing all items of [EXECUTE] section.
MC2> MTC@ntaf: Test case tc_can_raw0 started.
MTC@ntaf: Test case tc_can_raw0 finished. Verdict: pass
MC@ntaf: Test execution finished.
Execution of [EXECUTE] section finished.



terminal 3
netstat -antp --unix |grep mctr
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:9034            0.0.0.0:*               LISTEN      6956/mctr_cli   
tcp        0      0 127.0.0.1:9034          127.0.0.1:50668         ESTABLISHED 6956/mctr_cli   
tcp        0      0 127.0.0.1:9034          127.0.0.1:57434         ESTABLISHED 6956/mctr_cli   



MTC ends:

terminal 1
emtc
MC@ntaf: Terminating MTC.
MTC@ntaf: Verdict statistics: 0 none (0.00 %), 1 pass (100.00 %), 0 inconc (0.00 %), 0 fail (0.00 %), 0 error (0.00 %).
MTC@ntaf: Test execution summary: 1 test case was executed. Overall verdict: pass
MC@ntaf: MTC terminated.


and disconnects from MC:

netstat -antp --unix |grep mctr
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 0.0.0.0:9034            0.0.0.0:*               LISTEN      6956/mctr_cli   
tcp        0      0 127.0.0.1:9034          127.0.0.1:57434         ESTABLISHED 6956/mctr_cli   

Main controller terminates, HC is also exited.

terminal 1
quit
MC@ntaf: Shutting down session.
MC@ntaf: Shutdown complete.


terminal 3
netstat -antp --unix |grep mctr
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)






I hope this sheds some light on this not very well-documented part.

Best regards
Elemer



[Updated on: Tue, 30 August 2016 07:09]

Report message to a moderator

Previous Topic:Eclipse Titan on Win 10 WSL part 1: command line
Next Topic:C++ compiler error for Eclipse plugin
Goto Forum:
  


Current Time: Fri Apr 19 19:07:02 GMT 2024

Powered by FUDForum. Page generated in 0.02866 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top