Sunday, July 10, 2011

Getting Started with BEEP

‹prev | My Chain | next›

Convinced that SCTP is no SPDY alternative, I turn my attention to BEEP, the Block Extensible Exchange Protocol. Per the SPDY whitepaper, it lacks certain features to reduce page load time. Given the whitepaper's almost kind assessment of SCTP, I have no reason to doubt it, but still, I think it worth a day or two's investigation.

My simple understanding is that BEEP is a protocol on which other protocols can be built. It includes some TCP/IP best practices to make the resulting protocols as efficient as possible. I can see where that might not help specifically with page load times, but who knows?

I opt to investigate the Vortex implementation of BEEP. It is written in C, but offers compatibility with the browser via jsVortex. It is likely a bad idea for me compare the browser BEEP implementation with SPDY. For one thing, the Javascript would been to be downloaded over vanilla HTTP before initializing a BEEP session—not exactly a recipe for fast page loads.

Still, it beats exploring Java!

Vortex is not in Ubuntu. It does offer a Debian source, but I am not one to trust unknown system packages (aside from Chrome, sigh). So I obtain the most recent tarball from the Google code page. I un-tar/gunzip into my $HOME/src directory. I am not going to install this system-wide, so I configure it with --prefix=$HOME/local:
➜  vortex-1.1.8.b4662.g4666  ./configure --prefix=$HOME/local
./configure: line 2130: axl-knife: command not found
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
...
checking for AXL... no
configure: error: Package requirements (axl >= 0.6.4) were not met:

No package 'axl' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables AXL_CFLAGS
and AXL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
Hrm...

OK. So backing up, I start on the Google code page and download the axl library. After un-tarring it into $HOME/src, I configure and install it:

➜ axl-0.6.4.b4604.g4608 ./configure --prefix=$HOME/local
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
....
------------------------------------------
-- LibAXL LIBRARY SETTINGS --
------------------------------------------
Installation prefix: /home/cstrom/local
Build Axl Namespace support: yes
Build Axl Library tests: yes
Build Axl Knife: yes
Build Axl Library debug log: yes
Build PyAxl: no
Build Axl Library doc: disabled
NOTE: To enable Axl documentation you will
have to install doxygen tool. Then run again
configure process.
vasprintf support: yes
------------------------------------------
-- NOW TYPE: make; make install --
------------------------------------------
After a quick, uneventful make; make install, now I am ready to configure vortex:
➜  vortex-1.1.8.b4662.g4666  ./configure --prefix=$HOME/local
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
...
checking for a Python interpreter with version >= 2.3... python
checking for python... /usr/bin/python
checking for python version... 2.7
checking for python platform... linux2
checking for python script directory... ${prefix}/lib/python2.7/site-packages
checking for python extension module directory... ${exec_prefix}/lib/python2.7/site-packages
Python includes:
Python development headers status: no
configure: error: Cannot find Python.h header or current python development environment do not compile symbols required. On debian try to install python-dev package.
Sigh.

After a quick sudo apt-get install python-dev, I again am ready to configure vortex:
➜  vortex-1.1.8.b4662.g4666  ./configure --prefix=$HOME/local
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
...
------------------------------------------
-- VORTEX LIBRARY 1.1 SETTINGS --
------------------------------------------
Installation prefix: /home/cstrom/local
select(2) support: yes
poll(2) support: yes
epoll(2) support: yes
default: epoll
debug log support: yes
pthread cflags=-pthread, libs=-lpthread
additional libs=
NOTE: To disable log reporting use:
--disable-vortex-log

Axl installation:
cflags: -I/home/cstrom/local/include/axl
libs: -L/home/cstrom/local/lib -laxl -lm

Build vortex-client tool: enabled
Build TLS profile support: enabled
(libvortex-tls-1.1)
Build SASL profile support: disabled

NOTE: To enable SASL profile support you have to
install GNU SASL developement files.
Once installed run again configure process
using --enable-sasl-support option.
Build XML-RPC profile support: enabled
(libvortex-xml-rpc-1.1)
Build xml-rpc-gen tool: enabled
Build TUNNEL profile support: enabled
(libvortex-tunnel-1.1)
Build PULL API support: enabled
(libvortex-pull-1.1)
Build HTTP CONNECT proxy support: enabled
(libvortex-http-1.1)
Build ALIVE check profile: enabled
(libvortex-alive-1.1)
Build PyVortex support: enabled
Build Vortex Library doc: disabled

NOTE: To enable Vortex documentation you will
have to install doxygen tool. Then run again
configure process.

------------------------------------------
-- LET IT BEEP! --
-- --
-- NOW TYPE: make; make install --
------------------------------------------
After a relatively quick make; make install, I am ready to play around a bit!

Happily, the vortex source code includes some executable sample clients and servers in the test sub-directory. For today, I am going to stick with the ./test/vortex-simple-listener and ./test/vortex-simple-client executables.

Starting up the server in one window blocks until it receives a message from the client. So let's send a client message:
➜  vortex-1.1.8.b4662.g4666  ./test/vortex-simple-client
connecting to localhost:44000...
ok
my reply have arrived: (size: 23):
Received Ok: my message
Grammar aside, that seems to have worked. Checking back in the server window, I now see:
➜  vortex-1.1.8.b4662.g4666  ./test/vortex-simple-listener
New connection accepted from: 127.0.0.1:59005
A frame received on channl: 3
Data received: 'my message'
VORTEX_LISTENER: end task (pid: 29081)
So it works right?

Nothing works on the network unless Wireshark says it does, so let's see if vortex earns the BEEP seal of approval from Wireshark.

I start a Wireshark capture on the loopback interface (since the server was listening on 127.0.0.1). And I see a bunch of packets, but none of them are particularly BEEPish. Just plain-jane TCP/IP. To get Wireshark to read these packets as BEEP, I choose Analyze -> Decode As...

In the resulting dialog, I choose to decode "both" (ports 44000 and 59005) as BEEP packets:



With that, I see BEEP!



Most of the packets are now BEEP (the others just lower level TCP packets). I can even use Wireshark to inspect the message contents that I just sent in my test.

That's a good stopping point for the night. Up tomorrow, I will kick the tires on some BEEP features. I doubt that I will push my investigation too far though. I still have a bunch of other stuff that I would like to cover in SPDY Book and only 3 weeks before release!


Day #71

No comments:

Post a Comment