Query / Iteration on server side.
Monday, 28 November 2011 · 3 messages · last reply 29 Nov 2011
FH
Fabian Hickert28 Nov 2011 14:17 #
Hi all,
I was playing with the python examples of basex version 6.7.1-1 from the debian-wheezy repository. I've used the corresponding BaseXClient.py to establish a connection/add/update/query stuff and so on, it worked very well.
Now I've noticed the new 7.0.2 version and now I've got problems with the query/iterate operation.
In the 6.7 example one starts a query and iterates over the results, using the more method, which sends \x01 followed by the query-result id.
But the examples of 7.0.2 don't behave like this anymore, instead they cache the complete result on the client side.
I've tried to rebuild the old 6.7 behaviour with the commands shown here, http://docs.basex.org/wiki/Server_Protocol but I wasn't successful.
Is is still possible to query and iterate on the server side instead, of caching the complete result on the client side?
Am I doing things the wrong way? If I do, could you please point me to the right direction or examples, documentation?
Best regards
Fabian
--
Fabian Hickert <fabian.hickert at GONICUS.de> (System Engineer)
* GONICUS GmbH * Moehnestrasse 11-17 * D-59755 Arnsberg
* Tel.: +49 (0) 29 32 / 9 16 - 0 * Fax: +49 (0) 29 32 / 9 16 - 242
* http://www.GONICUS.de * http://twitter.com/gonicus
*Sitz der Gesellschaft: Moehnestrasse 11-17 * D-59755 Arnsberg *Geschaeftsfuehrer: Rainer Luelsdorf, Alfred Schroeder
*Vorsitzender des Beirats: Juergen Michels
*Amtsgericht Arnsberg * HRB 1968
CG
Christian Grün28 Nov 2011 19:59 #
Dear Fabian,
you're right, and you found the correct links in our Wiki: in our new iterator, all results are cached client-side. The two main reason for switching to the new approach were that a) the old approach was pretty slow if many small results were requested, and b) it caused deadlocks as soon as updating queries were intefering.
The old behavior cannot really be simulated with the new architecture, but it is simply possible to rewrite the iterator code and directly process the returned results. This way, caching can be avoided, but you have to make sure that all results will be requested in order not to stall the client/network comunication of a specific process.
I just noticed that the new caching iterator has not been implemented in Python yet; contributions are welcome here. If we should observe that the new concept performs too bad, we may continue and look for another solution.
Hope this helps,
Christian
Quoted text · Fabian Hickert · 30 lines
On Mon, Nov 28, 2011 at 2:17 PM, Fabian Hickert <hickert at gonicus.de> wrote: > Hi all, > > I was playing with the python examples of basex version 6.7.1-1 from the > debian-wheezy repository. I've used the corresponding BaseXClient.py to > establish a connection/add/update/query stuff and so on, it worked very > well. > > Now I've noticed the new 7.0.2 version and now I've got problems with > the query/iterate operation. > > In the 6.7 example one starts a query and iterates over the results, > using the more method, which sends \x01 followed by the query-result > id. > > But the examples of 7.0.2 don't behave like this anymore, instead they > cache the complete result on the client side. > > I've tried to rebuild the old 6.7 behaviour with the commands shown > here, http://docs.basex.org/wiki/Server_Protocol but I wasn't > successful. > > Is is still possible to query and iterate on the server side instead, of > caching the complete result on the client side? > > Am I doing things the wrong way? If I do, could you please point me to > the right direction or examples, documentation? > > Best regards > Fabian
FH
Fabian Hickert29 Nov 2011 11:29 #
Hi Christian,
thank you for this explanation, it was very helpful.
I've once had one of the described dead-locks, but thought I've done something wrong ;)
regards
Fabian
Quoted text · +0100 · 54 lines
Am Montag, den 28.11.2011, 19:59 +0100 schrieb Christian Grün: > Dear Fabian, > > you're right, and you found the correct links in our Wiki: in our new > iterator, all results are cached client-side. The two main reason for > switching to the new approach were that a) the old approach was pretty > slow if many small results were requested, and b) it caused deadlocks > as soon as updating queries were intefering. > > The old behavior cannot really be simulated with the new architecture, > but it is simply possible to rewrite the iterator code and directly > process the returned results. This way, caching can be avoided, but > you have to make sure that all results will be requested in order not > to stall the client/network comunication of a specific process. > > I just noticed that the new caching iterator has not been implemented > in Python yet; contributions are welcome here. If we should observe > that the new concept performs too bad, we may continue and look for > another solution. > > Hope this helps, > Christian > ___________________________ > > On Mon, Nov 28, 2011 at 2:17 PM, Fabian Hickert <hickert at gonicus.de> wrote: > > Hi all, > > > > I was playing with the python examples of basex version 6.7.1-1 from the > > debian-wheezy repository. I've used the corresponding BaseXClient.py to > > establish a connection/add/update/query stuff and so on, it worked very > > well. > > > > Now I've noticed the new 7.0.2 version and now I've got problems with > > the query/iterate operation. > > > > In the 6.7 example one starts a query and iterates over the results, > > using the more method, which sends \x01 followed by the query-result > > id. > > > > But the examples of 7.0.2 don't behave like this anymore, instead they > > cache the complete result on the client side. > > > > I've tried to rebuild the old 6.7 behaviour with the commands shown > > here, http://docs.basex.org/wiki/Server_Protocol but I wasn't > > successful. > > > > Is is still possible to query and iterate on the server side instead, of > > caching the complete result on the client side? > > > > Am I doing things the wrong way? If I do, could you please point me to > > the right direction or examples, documentation? > > > > Best regards > > Fabian
--
Fabian Hickert <fabian.hickert at GONICUS.de> (System Engineer)
* GONICUS GmbH * Moehnestrasse 11-17 * D-59755 Arnsberg
* Tel.: +49 (0) 29 32 / 9 16 - 0 * Fax: +49 (0) 29 32 / 9 16 - 242
* http://www.GONICUS.de * http://twitter.com/gonicus
*Sitz der Gesellschaft: Moehnestrasse 11-17 * D-59755 Arnsberg *Geschaeftsfuehrer: Rainer Luelsdorf, Alfred Schroeder
*Vorsitzender des Beirats: Juergen Michels
*Amtsgericht Arnsberg * HRB 1968
Written for BaseX 7.0. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery