Applicative Cache
Monday, 9 November 2015 · 7 messages · last reply 20 Nov 2015
ML
Marco Lettere9 Nov 2015 16:28 #
Hi all,
I went though the emails talking about mainmemory databases and related but I've not been able to find an answer to this loud thinking ... Would it be possible to create an in memory database with a RESTXQ call and keep it accessible for other RESTXQ invocations as if it was a disk db throughout the lifecycle of a basexhttp server?
Application level cacheing of (possibly distributed) dbs or management of transient volatile data items like tokens are the scenarios I have in mind.
Just wondering whether this makes any sense. Whether it's feasible or whether someone already did this with other means.
Thanks a lot!
Marco.
EF
Etanchaud Fabrice9 Nov 2015 17:08 #
Hi Marco,
I did a few tests in that configuration last year (not with 8.X version), And it worked, as long as I did not "OPEN" another database. But I tested it again with 8.3, and did not succeed in sharing a server side mainmem db.
Server :
java -cp "%CP%" %BASEX_JVM% org.basex.BaseXServer %* -c"SET MAINMEM TRUE;CREATE DB mainmem"Client :
Quoted text · Marco Lettere · 1 line
> xquery db:open('mainmem')
Stopped at ., 1/9:
[bxerr:BXDB0002] Database 'mainmem' was not found.
Best regards,
Fabrice
-----Message d'origine-----
Quoted text · Marco Lettere · 11 lines
De : basex-talk-bounces at mailman.uni-konstanz.de [mailto:basex-talk-bounces at mailman.uni-konstanz.de] De la part de Marco Lettere Envoyé : lundi 9 novembre 2015 16:29 À : BaseX <basex-talk at mailman.uni-konstanz.de> Objet : [basex-talk] Applicative Cache Hi all, I went though the emails talking about mainmemory databases and related but I've not been able to find an answer to this loud thinking ... Would it be possible to create an in memory database with a RESTXQ call and keep it accessible for other RESTXQ invocations as if it was a disk db throughout the lifecycle of a basexhttp server? Application level cacheing of (possibly distributed) dbs or management of transient volatile data items like tokens are the scenarios I have in mind. Just wondering whether this makes any sense. Whether it's feasible or whether someone already did this with other means. Thanks a lot! Marco.
CG
Christian Grün20 Nov 2015 13:12 #
Hi Fabrice, hi Marco,
Quoted text · Etanchaud Fabrice · 1 line
> But I tested it again with 8.3, and did not succeed in sharing a server side mainmem db.
True! I have reintroduced that feature in the latest snapshot [1]. Spontaneously, I would say there’s currently no way to realize this for web applications. I could add the -c flag for BaseXHTTP as well. @Marco: Do you think this would be helpful?
Please note that it’s not possible to open existing databases in main memory [2]..
Christian
[1] http://files.basex.org/releases/latest
[2] https://github.com/BaseXdb/basex/issues/948
Quoted text · Etanchaud Fabrice · 33 lines
On Mon, Nov 9, 2015 at 5:08 PM, Etanchaud Fabrice <Fabrice.Etanchaud at horanet.com> wrote: > Hi Marco, > > I did a few tests in that configuration last year (not with 8.X version), > And it worked, as long as I did not "OPEN" another database. > > Server : > > java -cp "%CP%" %BASEX_JVM% org.basex.BaseXServer %* -c"SET MAINMEM TRUE;CREATE DB mainmem" > > Client : > >> xquery db:open('mainmem') > Stopped at ., 1/9: > [bxerr:BXDB0002] Database 'mainmem' was not found. > > Best regards, > Fabrice > > -----Message d'origine----- > De : basex-talk-bounces at mailman.uni-konstanz.de [mailto:basex-talk-bounces at mailman.uni-konstanz.de] De la part de Marco Lettere > Envoyé : lundi 9 novembre 2015 16:29 > À : BaseX <basex-talk at mailman.uni-konstanz.de> > Objet : [basex-talk] Applicative Cache > > Hi all, > I went though the emails talking about mainmemory databases and related but I've not been able to find an answer to this loud thinking ... > Would it be possible to create an in memory database with a RESTXQ call and keep it accessible for other RESTXQ invocations as if it was a disk db throughout the lifecycle of a basexhttp server? > Application level cacheing of (possibly distributed) dbs or management of transient volatile data items like tokens are the scenarios I have in mind. > Just wondering whether this makes any sense. Whether it's feasible or whether someone already did this with other means. > Thanks a lot! > Marco.
EF
Etanchaud Fabrice20 Nov 2015 14:34 #
Thank you Christian !
By the way, I did not succeed in trying to connect the basehttpserver to an already running basexserver (in order to use the -c option for mainmemory db creation). I used the -n,p,U,P options.
Is it possible to manage this kind of configuration, aside the local or brand new server configurations ?
Best regards,
Fabrice
-----Message d'origine-----
Quoted text · Christian Grün · 47 lines
De : Christian Grün [mailto:christian.gruen at gmail.com] Envoyé : vendredi 20 novembre 2015 13:13 À : Etanchaud Fabrice <Fabrice.Etanchaud at horanet.com> Cc : Marco Lettere <marco.lettere at dedalus.eu>; basex-talk at mailman.uni-konstanz.de Objet : Re: [basex-talk] Applicative Cache Hi Fabrice, hi Marco, > But I tested it again with 8.3, and did not succeed in sharing a server side mainmem db. True! I have reintroduced that feature in the latest snapshot [1]. Spontaneously, I would say there’s currently no way to realize this for web applications. I could add the -c flag for BaseXHTTP as well. @Marco: Do you think this would be helpful? Please note that it’s not possible to open existing databases in main memory [2].. Christian [1] http://files.basex.org/releases/latest [2] https://github.com/BaseXdb/basex/issues/948 On Mon, Nov 9, 2015 at 5:08 PM, Etanchaud Fabrice <Fabrice.Etanchaud at horanet.com> wrote: > Hi Marco, > > I did a few tests in that configuration last year (not with 8.X > version), And it worked, as long as I did not "OPEN" another database. > > Server : > > java -cp "%CP%" %BASEX_JVM% org.basex.BaseXServer %* -c"SET MAINMEM TRUE;CREATE DB mainmem" > > Client : > >> xquery db:open('mainmem') > Stopped at ., 1/9: > [bxerr:BXDB0002] Database 'mainmem' was not found. > > Best regards, > Fabrice > > -----Message d'origine----- > De : basex-talk-bounces at mailman.uni-konstanz.de > [mailto:basex-talk-bounces at mailman.uni-konstanz.de] De la part de > Marco Lettere Envoyé : lundi 9 novembre 2015 16:29 À : BaseX > <basex-talk at mailman.uni-konstanz.de> > Objet : [basex-talk] Applicative Cache > > Hi all, > I went though the emails talking about mainmemory databases and related but I've not been able to find an answer to this loud thinking ... > Would it be possible to create an in memory database with a RESTXQ call and keep it accessible for other RESTXQ invocations as if it was a disk db throughout the lifecycle of a basexhttp server? > Application level cacheing of (possibly distributed) dbs or management of transient volatile data items like tokens are the scenarios I have in mind. > Just wondering whether this makes any sense. Whether it's feasible or whether someone already did this with other means. > Thanks a lot! > Marco.
ML
Hi Christian,
Quoted text · Christian Grün · 5 lines
On 20/11/2015 13:12, Christian Grün wrote: > True! I have reintroduced that feature in the latest snapshot [1]. > Spontaneously, I would say there’s currently no way to realize this > for web applications. I could add the -c flag for BaseXHTTP as well. > @Marco: Do you think this would be helpful?
It might be helpful.
What about running from within a RESTXQ a
client:connect/client:execute against the coupled db server that has been configured to startup like suggested by Fabrice (-c"SET MAINMEM TRUE;CREATE DB mainmem")? Just for my understanding, would this be equivalent? Because in that case I could already give it a try by downloading the latest snapshot.
Thanks,
Marco.Quoted text · Christian Grün · 42 lines
> Please note that it’s not possible to open existing databases in main > memory [2].. > > Christian > > [1] http://files.basex.org/releases/latest > [2] https://github.com/BaseXdb/basex/issues/948 > > > On Mon, Nov 9, 2015 at 5:08 PM, Etanchaud Fabrice > <Fabrice.Etanchaud at horanet.com> wrote: >> Hi Marco, >> >> I did a few tests in that configuration last year (not with 8.X version), >> And it worked, as long as I did not "OPEN" another database. >> >> Server : >> >> java -cp "%CP%" %BASEX_JVM% org.basex.BaseXServer %* -c"SET MAINMEM TRUE;CREATE DB mainmem" >> >> Client : >> >>> xquery db:open('mainmem') >> Stopped at ., 1/9: >> [bxerr:BXDB0002] Database 'mainmem' was not found. >> >> Best regards, >> Fabrice >> >> -----Message d'origine----- >> De : basex-talk-bounces at mailman.uni-konstanz.de [mailto:basex-talk-bounces at mailman.uni-konstanz.de] De la part de Marco Lettere >> Envoyé : lundi 9 novembre 2015 16:29 >> À : BaseX <basex-talk at mailman.uni-konstanz.de> >> Objet : [basex-talk] Applicative Cache >> >> Hi all, >> I went though the emails talking about mainmemory databases and related but I've not been able to find an answer to this loud thinking ... >> Would it be possible to create an in memory database with a RESTXQ call and keep it accessible for other RESTXQ invocations as if it was a disk db throughout the lifecycle of a basexhttp server? >> Application level cacheing of (possibly distributed) dbs or management of transient volatile data items like tokens are the scenarios I have in mind. >> Just wondering whether this makes any sense. Whether it's feasible or whether someone already did this with other means. >> Thanks a lot! >> Marco.
CG
Christian Grün20 Nov 2015 15:27 #
Quoted text · Marco Lettere · 3 lines
> What about running from within a RESTXQ a client:connect/client:execute > against the coupled db server that has been configured to startup like > suggested by Fabrice (-c"SET MAINMEM TRUE;CREATE DB mainmem")?
…Marco’s approach ;) I agree, this would be possible! Looking forward to your experiences.
Christian
EF
Etanchaud Fabrice20 Nov 2015 16:58 #
I am afraid that this would not work.
If you do not create the mainmem database at server's initialization, but afterwards from a client,
then the database lives as long as the client's connection.
So using the client module in a RESTXQ request will not help, because connection is closed at the end of the request.
Currently, I use a basexclient for that, and keep the client console open, to prevent the mainmem db from closing.
Best regards,
Fabrice
-----Message d'origine-----
Quoted text · Christian Grün · 10 lines
De : Christian Grün [mailto:christian.gruen at gmail.com] Envoyé : vendredi 20 novembre 2015 15:28 À : Marco Lettere <marco.lettere at dedalus.eu> Cc : Etanchaud Fabrice <Fabrice.Etanchaud at horanet.com>; basex-talk at mailman.uni-konstanz.de Objet : Re: [basex-talk] Applicative Cache > What about running from within a RESTXQ a > client:connect/client:execute against the coupled db server that has > been configured to startup like suggested by Fabrice (-c"SET MAINMEM TRUE;CREATE DB mainmem")? …Marco’s approach ;) I agree, this would be possible! Looking forward to your experiences. Christian
Written for BaseX 8.3. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery