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
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