This wiki is obsolete, see the NorduGrid web pages for up to date information.

NOX/Tests/Echo

From NorduGrid
< NOX‎ | Tests
Jump to navigationJump to search

Echo service

General

The capability of the echo service is to accept SOAP messages like this:

<?xml version="1.0"?>
<soap-env:Envelope xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:echo="urn:echo">
    <soap-env:Body>
        <echo:echo>
            <echo:say>HELLO</echo:say>
        </echo:echo>
    </soap-env:Body>
</soap-env:Envelope>

Then the Echo service adds a prefix and a suffix to the message and sends it back like this:

<?xml version="1.0"?> 
<soap-env:Envelope xmlns:echo="urn:echo" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
    <soap-env:Body>
        <echo:echoResponse>
            <echo:hear>hi!}}</echo:hear>
        </echo:echoResponse>
    </soap-env:Body>
</soap-env:Envelope>

There are a C++ and a Python implementation of the Echo service, and there are configuration profiles for secure and non-secure deployments for both languages.

Client

Currently there are at least two readily available client to test the Echo service:

  • src/tests/echo/echo_client.py - is a python script which gets the credentials from the userconfig, and sends a single message to the given URL, then prints the reply
  • src/test/perf/perftest - sends as many messages as possible within a given number of seconds using a given number of threads

The C++ Echo service

Without TLS

We can use this config to run the server:

profile=/usr/local/share/arc/profiles/EchoServiceNonSecure.xml

pidfile=/tmp/arched.pid
logfile=/tmp/arched.log
debug=ERROR

port=60000

[echo]
prefix=[[
suffix=]]

Let's run it:

$ sudo /usr/local/sbin/arched -f -i EchoServiceNonSecure.ini

Then check if it is replying:

$ arc1/src/tests/echo/echo_client.py http://localhost:60000/Echo 'Hi, non-secure C++ Echo service!'
<soap-env:Envelope xmlns:echo="urn:echo" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soap-env:Body>
    <echo:echoResponse>
      <echo:hear>[[Hi, non-secure C++ Echo service!]]</echo:hear>
    </echo:echoResponse>
  </soap-env:Body>
</soap-env:Envelope>

Then run the perftest for 5 seconds in 5 threads:

$ arc1/src/tests/perf/perftest http://localhost:60000/Echo 5 5
Number of finished threads: 1
Number of finished threads: 2
Number of finished threads: 3
Number of finished threads: 4
Number of finished threads: 5
========================================
URL: http://localhost:60000/Echo
Number of threads: 5
Duration: 5 s
Number of requests: 5006
Completed requests: 5006 (100%)
Failed requests: 0 (0%)
Completed requests per second: 1001
Average response time for all requests: 5 ms
Average response time for completed requests: 5 ms
========================================

With TLS

We can use this config:

profile=/usr/local/share/arc/profiles/EchoService.xml

pidfile=/tmp/arched.pid
logfile=/tmp/arched.log
debug=ERROR

port=60000

cacert=/etc/grid-security/certificates
host_cert=/etc/grid-security/hostcert.pem
host_key=/etc/grid-security/hostkey.pem

[echo]
prefix={{
suffix=}}

Run it:

$ sudo /usr/local/sbin/arched -f -i EchoService.ini

We should have a client.conf at a default path which contains the credentials for the clients to be able to connect to the secure service, e.g.:

$ cat ~/.arc/client.conf 
keypath=/Users/zsombor/.arc/userkey.pem
certificatepath=/Users/zsombor/.arc/usercert.pem
cacertificatesdirectory=/etc/arc-security/certificates

Let's check if the service replies:

$ arc1/src/tests/echo/echo_client.py https://localhost:60000/Echo 'Hi, secure C++ Echo service!'
<soap-env:Envelope xmlns:echo="urn:echo" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soap-env:Body>
    <echo:echoResponse>
      <echo:hear>{{Hi, secure C++ Echo service!}}</echo:hear>
    </echo:echoResponse>
  </soap-env:Body>
</soap-env:Envelope>

Let's run the perftest:

$ arc1/src/tests/perf/perftest https://localhost:60000/Echo 5 5
Number of finished threads: 1
Number of finished threads: 2
Number of finished threads: 3
Number of finished threads: 4
Number of finished threads: 5
========================================
URL: https://localhost:60000/Echo
Number of threads: 5
Duration: 5 s
Number of requests: 2368
Completed requests: 2368 (100%)
Failed requests: 0 (0%)
Completed requests per second: 473
Average response time for all requests: 10 ms
Average response time for completed requests: 10 ms
========================================

The Python Echo service

Without TLS

Here's a config we can use:

profile=/usr/local/share/arc/profiles/EchoServicePythonNonSecure.xml

pidfile=/tmp/arched.pid
logfile=/tmp/arched.log
debug=ERROR

port=60000

[echo]
prefix=-pyt-[
suffix=]-hon-

Let's run it:

$ sudo /usr/local/sbin/arched -f -i EchoServicePythonNonSecure.ini

Run the echo_client.py:

$ arc1/src/tests/echo/echo_client.py http://localhost:60000/Echo 'Hi, non-secure Python Echo service!'
<soap-env:Envelope xmlns:echo="urn:echo" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soap-env:Body>
    <echo:echoResponse>
      <echo:hear>-pyt-[Hi, non-secure Python Echo service!]-hon-</echo:hear>
    </echo:echoResponse>
  </soap-env:Body>
</soap-env:Envelope>

Run the perftest:

$ arc1/src/tests/perf/perftest http://localhost:60000/Echo 5 5
Number of finished threads: 1
Number of finished threads: 2
Number of finished threads: 3
Number of finished threads: 4
Number of finished threads: 5
========================================
URL: http://localhost:60000/Echo
Number of threads: 5
Duration: 5 s
Number of requests: 1951
Completed requests: 1951 (100%)
Failed requests: 0 (0%)
Completed requests per second: 390
Average response time for all requests: 13 ms
Average response time for completed requests: 13 ms
========================================

With TLS

Here's a config we can use:

profile=/usr/local/share/arc/profiles/EchoServicePython.xml

pidfile=/tmp/arched.pid
logfile=/tmp/arched.log
debug=ERROR

port=60000

cacert=/etc/grid-security/certificates
host_cert=/etc/grid-security/hostcert.pem
host_key=/etc/grid-security/hostkey.pem

[echo]
prefix=-pyt-{
suffix=}-hon-

Run it:

$ sudo /usr/local/sbin/arched -f -i EchoServicePython.ini

Test it with echo_client.py:

$ arc1/src/tests/echo/echo_client.py https://localhost:60000/Echo 'Hi, secure Python Echo service!'
<soap-env:Envelope xmlns:echo="urn:echo" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soap-env:Body>
    <echo:echoResponse>
      <echo:hear>-pyt-{Hi, secure Python Echo service!}-hon-</echo:hear>
    </echo:echoResponse>
  </soap-env:Body>
</soap-env:Envelope>

And with perftest:

$ arc1/src/tests/perf/perftest https://localhost:60000/Echo 5 5
Number of finished threads: 1
Number of finished threads: 2
Number of finished threads: 3
Number of finished threads: 4
Number of finished threads: 5
========================================
URL: https://localhost:60000/Echo
Number of threads: 5
Duration: 5 s
Number of requests: 1647
Completed requests: 1647 (100%)
Failed requests: 0 (0%)
Completed requests per second: 329
Average response time for all requests: 15 ms
Average response time for completed requests: 15 ms
========================================

Conclusion

Both the C++ and the Python Echo services are working fine, thanks.

Egerszalók discussion

We should reuse text in this report in sys admin Manual (also with config and testcases for the service). The idea that it would not make much sense to prepare separate text for Echo service, while setting it up running still represent a useful check of successfulness of installation of HED.