I'm using Queue.js as a libary for loading data from a java RestService.
https://github.com/mbostock/queue
I used the following code:
queue()
.defer(d3.json, "rest/v1/status/geographicalData")
.defer(d3.json, "rest/v1/status/geographicalFeatures")
.defer(d3.json, "rest/v1/status/classes")
.awaitAll(function(error, results) { console.log("all done!" + results.size)});
On the libary website is the queue method as following decribed:
queue([parallelism]) Constructs a new queue with the specified parallelism. If parallelism is not specified, the queue has infinite parallelism. Otherwise, parallelism is a positive integer. For example, if parallelism is 1, then all tasks will be run in series. If parallelism is 3, then at most three tasks will be allowed to proceed concurrently; this is useful, for example, when loading resources in a web browser.
I have the problem loading the data takes around 3 minutes. After that I tried loading the data synchron. I got the same time result as executing all 3 at once. So I guess they are not loaded parallel. How can I execute the loading of the the elements parallel?
Update
Java Jersey Rest Service threads
Thread after running the website
I started the rest service in the debugging mode after loading the website I saw multiple threads so the Rest service shouldn't be the problem?
After that I looked at the database connections:
After laoding the website I saw multiple open database connections so the database should be also ok?
After that I messerued the loading time with the firefox developer tools, but it took much longer with more data. But if its' runnign parallel it should be finished at the same time?