Hi Peter, > This leads me to believe that a lot of the time (>7 seconds) may be spent opening the database each time a POST is done? Is there a way to tweak the HTTP server to “remember” the connection with the current database for a little while? This may be against the REST principles, of course. The database is guaranteed to be read-only in my case.
One option is to open the database with the initial basexhttp call. It will be kept open until the server is shut down: basexhttp -c"open name-of-db" Best, Christian On Sat, Feb 15, 2025 at 8:53 PM Peter Villadsen via BaseX-Talk < [email protected]> wrote: > All, > > > > I have been using BaseX for a while, connecting to the TCP endpoint. I > know the performance I typically get, and it is impressive! However, now I > wanted to use the HTTP endpoint, and it seems the performance is at least 2 > orders of magnitude worse! > > > > Here is the query that I am POSTing to > http://localhost:8984/rest/RainFnd_6.0.10.0 > > > > <query xmlns=http://basex.org/rest> > > <text>/Class[@Package='ApplicationPlatform']/@Name</text> > > </query> > > > > This simple query will generate around 1500 results from the 13GB database > (RainFnd_6.0.10.0 <http://localhost:8984/rest/RainFnd_6.0.10.0>). It > takes just over 7 seconds to do this. If I do this in the BaseX GUI that is > self contained, it takes around 20ms. > > > > However, it seems that the time spent executing the query against the > database is negligible. Please consider this query: > > > > <query xmlns=http://basex.org/rest> > > <text>1 + 2</text> > > </query> > > > > In which there there is obviously no database access. It takes almost the > same amount of time as the query that accesses the database. 7 seconds to > calculate 1 + 2 is too long. > > > > If I post the 1 + 2 query to the endpoint without specifying the database > on the URL: > > > > http://localhost:8984/rest > > > > it takes around 7 milliseconds, close to what I expected, certainly within > expectations for the time spent sending the query over the wire and > serializing etc. > > > > This leads me to believe that a lot of the time (>7 seconds) may be spent > opening the database each time a POST is done? Is there a way to tweak the > HTTP server to “remember” the connection with the current database for a > little while? This may be against the REST principles, of course. The > database is guaranteed to be read-only in my case. > > > > The problem is that this makes the HTTP server inappropriate for > interactive applications. I can still use the TCP server, where I get the > results I need, but using the HTTP would be simpler, and have less overhead > in terms of code needed to communicate with the server. > > > > Please let me know if there is a way to accomplish acceptable performance > with the HTTP server. > > > > > > Best Regards > > > > Peter Villadsen > > Principal Technical Program Manager > > Microsoft Business Applications Group > > > > >

