Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add direct-ip support for tsung nodes interconnection #189

Merged
merged 3 commits into from
Aug 11, 2017

Conversation

weibomobile
Copy link
Contributor

…ons within /etc/hosts file any more, without the dns server support now

…ons within /etc/hosts file any more, without the dns server support now
@weibomobile weibomobile changed the title dd direct ip support, and you don't need set up hostname & ip relati… Add direct ip support within tsung_controller and tsung client Jul 13, 2016
@weibomobile weibomobile changed the title Add direct ip support within tsung_controller and tsung client Add direct ip support within tsung_controller and tsung clients Jul 13, 2016
@weibomobile
Copy link
Contributor Author

weibomobile commented Jul 13, 2016

Intro

This pull request adds the ability that the tsung_controller can connect the tsung client server with direct ip support.

In many case, the server's hostname is shortname, add the local dns server not resolve it.
Then we should add the hostname & IP relations, and write it into /etc/hosts, eg:

echo "10.10.10.10 tsung_master" >> /etc/hosts
echo "10.10.10.11 tsung_client1" >> /etc/hosts

Using the IP direct feature will avoid many settings, if you have one tsung cluster with lots of servers.

How to use it

1. Tsung Controller using IP with FQDN support

When start tsung, you can use the -I parameter:

tsung -I Your_Server_IP -f tsung.xm start

eg:

tsung -I 10.10.10.10 -f tsung.xm start

You get the node name is : tsung_controller@10.10.10.10.

2. Set up the client ip attribution

<client host="tsung_client1" hostip="10.10.10.11" maxusers="120000" cpu="7" weight="4">
    <ip value="10.10.10.11"></ip>
    <ip value="10.10.10.12"></ip>
</client>

In order to support the tsung client with direct ip support, I add the hostip attribute for ATTLIST client in tusng-1.0.dtd:

<!ATTLIST client
     cpu      NMTOKEN "1"
     type     (machine | batch)  "machine"
     host     NMTOKEN #IMPLIED
     hostip   CDATA ""
     batch    (torque | pbs | lsf | oar) #IMPLIED
     scan_intf NMTOKEN #IMPLIED
     maxusers NMTOKEN "800"
     use_controller_vm (true | false) "false"
     weight   NMTOKEN "1">

Then the tsung client node name will be : tsung1@10.10.10.11 .

3. How does it work

The major logic within tsung_controller/ts_config.erl module:

HostIP   = getAttr(Attrs, hostip),
...

%% if the node()'s hostname is ip, then we will got the hostip replace the host attr
{ok, MasterHostname} = ts_utils:node_to_hostname(node()),
case {ts_utils:is_ip(MasterHostname), ts_utils:is_ip(Host), ts_utils:is_ip(HostIP)} of
   %% must be hostname and not ip:
    {false, true, _} ->
        io:format(standard_error,"ERROR: client config: 'host' attribute must be a hostname, "++ "not an IP ! (was ~p)~n",[Host]),
        exit({error, badhostname});
    {true, true, _} ->
        %% add a new client for each CPU
        lists:duplicate(CPU,#client{host     = Host,
                                    weight   = Weight/CPU,
                                    maxusers = MaxUsers});
    {true, _, true} ->
        %% add a new client for each CPU
        lists:duplicate(CPU,#client{host     = HostIP,
                                    weight   = Weight/CPU,
                                    maxusers = MaxUsers});
    {_, _, _} ->
        %% add a new client for each CPU
        lists:duplicate(CPU,#client{host     = Host,
                                    weight   = Weight/CPU,
                                    maxusers = MaxUsers})
end

If the tsung_controller's node hostname and the hostip all are the ips, then the client's host will be assignined the ip value.

That's all :))

The direct-ip feature has been applied in our tsung clusters, and that works well :))

NOTE

Thanks to @nniclausse 's advice, I add -I replace the -F option, modified @ 2016-09-05 14:50

@weibomobile weibomobile changed the title Add direct ip support within tsung_controller and tsung clients Add direct-ip support for tsung nodes interconnection Jul 13, 2016
@tisba
Copy link
Collaborator

tisba commented Jul 15, 2016

Hey! This seems like a really nice addition, without much impact! I'll take a little test drive this weekend, but as far as I can tell, this looks good. Thanks!

@nniclausse
Copy link
Contributor

Hi;
thanks!
I tried your patch, but the old behavior (tsung -F without values) no longer works. Maybe you should use another option (-I ?) to set this, and let the -F option for FQDN

@weibomobile
Copy link
Contributor Author

weibomobile commented Sep 5, 2016

@nniclausse
Good advise !

Haha, I have added -I option for direct-ip support for Tsung :))

@nniclausse nniclausse merged commit 6a31709 into processone:master Aug 11, 2017
@nniclausse nniclausse modified the milestone: v1.6.1 Aug 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants