I’m looking for insight on how to build a system for my eXist DB App with which I can start multiple queries and have some kind of broker to ensure that only say the first 3 of them run simultaneously and when one of the queries is finished, it starts the next one waiting and so on.
I guess this can’t be done in pure Xquery, perhaps with some JavaScript hook? I also guess this means I have to look into Java Management Extensions, is that right?
In index.html of Monex the running queries seem to get displayed with the following code:
<span id="jmx-queries" data-bind="text: $data.jmx.ProcessReport.RunningQueries().length || 0">?</span>
I would like to replicate this in my own app and from here on look further into using jmx in my own app. So thanks for any input on how to do this or any help/further infos on how to achieve my main goal!
Thanks
You could keep the state of the queue in a document in the database, and you could have 3 scheduled tasks which poll that document. Each would pop the next item of the queue and run it. You can achieve all of that from XQuery.
Related
I'm running a query to create a table using the spatialite gui on my Windows 7 machine. It has been going for days and I would like to cancel it and try something different. Is there a way for me to view the results of the query so far? The .sqlite file has trippled in size and I'm curious about what is happening.
In SQLite, transactions are atomic and isolated. (And if you do not use explicit transactions, every command gets an automatic transaction.)
So there is no easy way to see partial results; the database goes to great efforts to ensure that the transaction either succeeds completely, or is rolled back.
If possible, try the command with a smaller data set, or write the query so that only a part of the data is processed.
I have a plan of writing a small command line tool that does the following (without getting into details):
Listen for input stream (a tail of some files)
Parse incoming data and update screen information real-time (like the top command does for example)
Untill the application is being quited (CTLR + C) it will be updating (not appending!) the information on the screen.
I prefer to work with the Symfony console.
Since they have for example the progress-bar I expect it to be doable, since the progress-bar does update the screen. (However, I don't need an actual progressbar).
Keep listening for an input stream and keep updating when information comes in is something I am not sure about to be possible in this manner.
I can't find enough information on how to do this. Does anyone know if this is possible and what components I would need to:
Listen for input stream and trigger an event when information comes in
Update screen information
Any help would be appreciated.
Update:
For now I built the tool without using any framework. I wrote it myself by using this "Listening for incoming streams" example and this "setting cursor position" example (and ofcourse this referenced overview of commands).
However I still would like to know whether and how this would be possible using Symfony's console components.
I have many server that I want to monitor with sensu + InfluxDB. I already created checks and metric collection with Sensu into InfluxDB.
I installed Chronograf to make queries on the DB and it's working like a charm.
But...
For all my servers, I want to have the same graphs:
CPU usage
CPU load
Memory
Disks
etc...
Even if recreating them is very straight forward, I wanted to do it automatically. I want for all my graphs, the ability to choose the server I want to watch. All my data in the database are like this:
server1.memory.total
server1.load_avg.five
server2.memory.total
server2.load_avg.five
[...]
The queries I use for example are like that:
SELECT "value" FROM "metrics".."server1.load_avg.five" WHERE time > now() - 1h
I just want to find the way to select the right server for the graph I want to see.
Can I do that with grafana or chronograf? Maybe I have to develop my own dashboard, what is the best way to begin this?
Chronograf has an undocumented API that will allow for the functionality you're looking for, but it's still in it's early stages and hasn't been tested extensively.
At the moment they're minimally documented on our end. It may require a bit of toying with to figure out how they work. Here's the list of routes for the API
POST "/api/v0/servers"
GET "/api/v0/servers"
GET "/api/v0/servers/:id"
PUT "/api/v0/servers/:id"
DELETE "/api/v0/servers/:id"
GET "/api/v0/servers/:id/version"
GET "/api/v0/servers/:id/query"
POST "/api/v0/dashboards"
GET "/api/v0/dashboards"
GET "/api/v0/dashboards/:id"
GET "/api/v0/dashboards/:id/export"
PUT "/api/v0/dashboards/:id"
DELETE "/api/v0/dashboards/:id"
DELETE "/api/v0/dashboards/:id/visualizations/:vid/cell"
POST "/api/v0/dashboard_import"
POST "/api/v0/dashboards/:id/cells"
PUT "/api/v0/dashboards/:id/cells"
POST "/api/v0/visualizations"
GET "/api/v0/visualizations"
GET "/api/v0/visualizations/:id"
PUT "/api/v0/visualizations/:id"
DELETE "/api/v0/visualizations/:id"
POST "/api/v0/visualizations/:id/statements"
PUT "/api/v0/visualizations/:id/statements/:sid/text"
PUT "/api/v0/visualizations/:id/statements/:sid/config"
DELETE "/api/v0/visualizations/:id/statements/:sid"
I would like to create a background task which continuously inputs the location from a mobile to a database and in a website, I would like to get the same location immediately as it changes.
I am using an SQL Azure database. so pushing and polling are not an option. Also I am not sure if I can use a cache since the location continuously changes.
I think I have to create some infinite loop which carries on a task continuously. But how does this concept work?
Does this simply involve the create of a thread and a while(true) { ... } ?
I worked on a similar situation, and the approach I went for was to have an special page (/StartJob.aspx?AccessKey=xxxxxxxxxxxxx), that when hit with the right access key, would start a job cycle.
I then setup a "Cron Job" using www.setCronJob.com, to call this page at regular intervals. This service can notify you by email if it fails too.
Have a look at the timer control
http://msdn.microsoft.com/en-us/library/bb386404.aspx
sounds like something that could help out with achieving what you need :)
I'm wondering if there is a tried/true method for reporting the progress of a DB call from a .Net application to its user. I'm wondering if it's even possible to actually indicate a percentage of completion, or is the best/only approach to simply display a "loading" animation to indicate that something is happening?
Also, does SQL2008 address this to anyone's knowledge?
You have to load things deterministically. For example if you know that you'll be fetching a lot of data, for example, you might do something like:
-get a count of all of the records
-get 500 of them
-report status as 500/total %
-get 500 more
-report status as 1000/total %
-... continue until you've gotten them all of the user has canceled
This would be incredibly wasteful on something that takes no time at all, since the mere fact of going to the database is a large part of the overhead.
As far as I know there is no way to do this. My suggestion is use one of the circular progress bars that just spins forever. Microsoft uses these in database operations in SQL and Project.
Here is an article on CodeProject that has a variety of these:
http://www.codeproject.com/KB/vb/sql2005circularprogress.aspx?fid=324397&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2205952
Adam Berent
You could use raiserror with the no wait option to send a message back to the remote caller without ending the sql transaction. Of course this will break the usual try/catch conventions, so caution is advised.
On the other hand, "a db call" could also refer to a restore or backup operation, in which case you could simply use the progress event in the SMO (server management objects) library.
Additionally, an ORM solution such as Linq could be used to handle "db call"s such as batch update operations. If that is the case, then this answer could be useful:
How can I get a percentage of LINQ to SQL submitchanges?