I have two identical Unix servers (Oracle T5-2, Solaris 11.2) and I want to do some testing of the network redundancy/failover I've configured (which I hope I've done right).
Each server has four network ports.
Two ports on server 1 and two ports on server 2 are connected to switch 1. Two ports on server 1 and two ports on server 2 are connected to switch 2.
I want to do something like this: root@srv1:~# pv </dev/zero | ssh root@srv2 'cat >/dev/null' and get a running throughput rate while I unplug and replug cables, BUT I'd like to have four simultaneous streams and four running totals. I don't know how to do this. I'd rather not have four separate sessions open to see this. I just want to have one session that looks like
448MB 0:00:09 [ 112MB/s] [ <=> ] 448MB 0:00:09 [ 112MB/s] [ <=> ] 448MB 0:00:09 [ 112MB/s] [ <=> ] 448MB 0:00:09 [ 112MB/s] [ <=> ]
Or similar. Any suggestions?
On 2014-12-12 Kevin McGregor wrote:
I want to do something like this: root@srv1:~# pv </dev/zero | ssh root@srv2 'cat >/dev/null'
As per Adam's presentation a while back, you'll probably want to use nc not ssh, otherwise you aren't testing the network as much as the CPUs. Unless you don't care about that, of course.
totals. I don't know how to do this. I'd rather not have four separate sessions open to see this. I just want to have one session that looks like
448MB 0:00:09 [ 112MB/s] [ <=> ] 448MB 0:00:09 [ 112MB/s] [ <=> ]
I just looked at pv's man at length and tried a few things and I see absolutely no way to have pv combine multiple *different* pipes (ie not in the same pipe group) into one output. I'm pretty sure what Paul was showing us was just multiple pv's in one pipe group, which isn't the same thing. Perhaps he can verify.
You may be able to write a script that uses something like -n to spit out program-parseable output, launch all 4 pipes and aggregate the results into your own curses output (or perhaps use dialog as the man page suggests). Your script would probably have to use select() on the filehandles. Perl would be perfect for this, I do select() stuff all the time with perl.
Something Trevor said made me think of this:
Host 2: (nc -l 10001 | pv -c -N one >/dev/null & nc -l 10002 | pv -c -N two
/dev/null & nc -l 10003 | pv -c -N three >/dev/null & nc -l 10004 | pv
-c -N four >/dev/null)
Host 1: ( pv -c -N one </dev/zero | nc host2 10001 & pv -c -N two </dev/zero | nc host2 10002 & pv -c -N three </dev/zero | nc host2 10003 & pv -c -N four </dev/zero | nc host2 10004 )
As long as all the pv instances have the same controlling tty and process group, which is accomplished by putting the whole thing inside parentheses ( "(",")" ) the IPC stuff works correctly. It's designed for parts of a single pipeline yes, but this trick appears to fool pv adequately well. At least on Linux and OpenBSD this works, not sure about Solaris.
-Adam
As a test I did this: pv -c -N One </dev/zero | nc -b 65536 host1 10001 but all I get is ^[[45;1R on the sending end and ^[[63;1R on the listening end. And there it hangs. Both ends. This is after I set up the terminal-type in Solaris. Cursor positioning? Why wouldn't it be interpreted properly?
On Sat, Dec 13, 2014 at 12:42 AM, Adam Thompson athompso@athompso.net wrote:
Something Trevor said made me think of this:
Host 2: (nc -l 10001 | pv -c -N one >/dev/null & nc -l 10002 | pv -c -N two
/dev/null & nc -l 10003 | pv -c -N three >/dev/null & nc -l 10004 | pv -c
-N four >/dev/null)
Host 1: ( pv -c -N one </dev/zero | nc host2 10001 & pv -c -N two </dev/zero | nc host2 10002 & pv -c -N three </dev/zero | nc host2 10003 & pv -c -N four </dev/zero | nc host2 10004 )
As long as all the pv instances have the same controlling tty and process group, which is accomplished by putting the whole thing inside parentheses ( "(",")" ) the IPC stuff works correctly. It's designed for parts of a single pipeline yes, but this trick appears to fool pv adequately well. At least on Linux and OpenBSD this works, not sure about Solaris.
-Adam
-- -Adam Thompson athompso@athompso.net Cell: +1 204 291-7950 Fax: +1 204 489-6515
Roundtable mailing list Roundtable@muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable
On 14-12-15 01:52 PM, Kevin McGregor wrote:
As a test I did this: pv -c -N One </dev/zero | nc -b 65536 host1 10001 but all I get is ^[[45;1R on the sending end and ^[[63;1R on the listening end. And there it hangs. Both ends. This is after I set up the terminal-type in Solaris. Cursor positioning? Why wouldn't it be interpreted properly?
At the very least, you should be seeing a bunch of garbage. 1) confirm that you aren't running the exact same command on both ends; they need to be reciprocals of each other. On one host you'd run the command as you show above, on the other host, you'd run "nc -l 10001 | pv -c -N One >/dev/null". 2) confirm that you've exported TERM correctly to the environment. 3) confirm that, say, reset(1) works as expected. (If it produces garbage, you still have a terminal emulation problem.) 4) I assume the "-b" argument to nc(1) is block size? None of my implementations have that flag, so try different sizes and/or the default. With TCP Window Scaling, the default should be fairly good anyway. 5) confirm that terminal emulation works at all; maybe try vi(1) or something like that? (Remember ESC : q! always quits even if the terminal is screwed up.)
Otherwise... dunno? -Adam
1. Check 2. Check 3. No reset command, apparently, on Solaris 11.2 4. -b is block size. The default is 1024 bytes. Throughput is ~79 MB/s as compared with the ssh method I started with, which gave 112 MB/s. A larger blocksize makes a big difference. 5. vi works great!
I left off the -c and -N options, and the mildly mangled output seemed roughly as expected. I'll fiddle some more tomorrow.
On Mon, Dec 15, 2014 at 1:58 PM, Adam Thompson athompso@athompso.net wrote:
On 14-12-15 01:52 PM, Kevin McGregor wrote:
As a test I did this: pv -c -N One </dev/zero | nc -b 65536 host1 10001 but all I get is ^[[45;1R on the sending end and ^[[63;1R on the listening end. And there it hangs. Both ends. This is after I set up the terminal-type in Solaris. Cursor positioning? Why wouldn't it be interpreted properly?
At the very least, you should be seeing a bunch of garbage.
- confirm that you aren't running the exact same command on both ends;
they need to be reciprocals of each other. On one host you'd run the command as you show above, on the other host, you'd run "nc -l 10001 | pv -c -N One >/dev/null". 2) confirm that you've exported TERM correctly to the environment. 3) confirm that, say, reset(1) works as expected. (If it produces garbage, you still have a terminal emulation problem.) 4) I assume the "-b" argument to nc(1) is block size? None of my implementations have that flag, so try different sizes and/or the default. With TCP Window Scaling, the default should be fairly good anyway. 5) confirm that terminal emulation works at all; maybe try vi(1) or something like that? (Remember ESC : q! always quits even if the terminal is screwed up.)
Otherwise... dunno? -Adam
Roundtable mailing list Roundtable@muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable
On 2014-12-15 Kevin McGregor wrote:
- vi works great!
6. make sure a firewall isn't blocking the ports you select (on either side, but esp the listening comp; make sure you get the tcp/udp choice correct).
PS: good trick Adam. I had tried something similar to see if it would work (with "&") but was trying with ssh (not nc) and it just wouldn't do it correctly.
PPS: This trick should go into the pv info. Better yet, pv needs a feature to "connect" to arbitrary running pv to combine output :-) Wouldn't be hard to do as it does IPC already.
Both hosts are on the same VLAN and connected to the same switch. There's no external firewall. I don't know if Solaris 11.2 includes a firewall which is turned on by default, but I don't think so.
On Tue, Dec 16, 2014 at 8:01 AM, Trevor Cordes trevor@tecnopolis.ca wrote:
On 2014-12-15 Kevin McGregor wrote:
- vi works great!
- make sure a firewall isn't blocking the ports you select (on either
side, but esp the listening comp; make sure you get the tcp/udp choice correct).
PS: good trick Adam. I had tried something similar to see if it would work (with "&") but was trying with ssh (not nc) and it just wouldn't do it correctly.
PPS: This trick should go into the pv info. Better yet, pv needs a feature to "connect" to arbitrary running pv to combine output :-) Wouldn't be hard to do as it does IPC already. _______________________________________________ Roundtable mailing list Roundtable@muug.mb.ca http://www.muug.mb.ca/mailman/listinfo/roundtable