On Mon, Aug 23, 2010 at 12:22 PM, Christian Grün <christian.gruen@gmail.com> wrote:
Thanks, and true; I've added a buffer. Note that the example file
rather serves as an example how to access BaseX with sockets; this is
why you won't find it in the jar file. The real Client/Server API,
which is included in the main package, is much more mature; see e.g.:

 http://basex.org/code/ServerExample
 http://basex.org/code/ServerConcurrencyExample


Could you elaborate?

Why is there a "real" API and an example?

The ServerExample link above doesn't appear to use the iterative protocol, using 'execute' instead. In what sense is this "more mature" than the BaseXClient.java file that supports this protocol?

I'd much rather use a single, officially sanctioned API to access a BaseX server from a Java client and have a robust way to iterate through multiple query results.

On a related note, I can't make sense of this figure: http://www.inf.uni-konstanz.de/dbis/basex/gfx/comm.png
In particular, "Handle Results" has no incident edges; and it's not clear why after continuing in iterative mode I would end up stuck in "standard mode" with no outgoing edges.

 - Godmar


 
Christian


On Mon, Aug 23, 2010 at 4:56 PM, Godmar Back <godmar@gmail.com> wrote:
>
> Hi,
>
> The example file BaseXClient uses an unbuffered stream to write to the
> socket:
>
>   out = socket.getOutputStream();
>
>   void send(final String s) throws IOException {
>     for(final byte t : s.getBytes()) out.write(t);
>     out.write(0);
>   }
>
> This yields extremely bad performance, especially for large queries (every
> single call to write will trigger a separate system call to the OS, which in
> turn will trigger a separate TCP segment on the wire). On a typical
> Ethernet, this means that 100 minimum sized packets are transmitted rather
> than a single packet to transmit a 100-byte query.
>
> On a different note, why is BaseXClient not part of the "official" BaseX
> API, or at least provided as part of the distributed .jar files in an
> org.basex.* package?
>
>  - Godmar
>
>
> _______________________________________________
> BaseX-Talk mailing list
> BaseX-Talk@mailman.uni-konstanz.de
> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
>
>