Does the web service support parallel processing ?

Started by kkae, July 29, 2017, 08:01:25 PM

Previous topic - Next topic

kkae

Here a code fragment from my app.
I send the IMatch.favoriteExecute calls and I thought that Imatch works these in parallel.
But the result shows that it is done serial.
Is it supported in future ?


    // create Thumbnails via Image batch processor (asynchron)
    var promise1 = IMatch.favoriteExecute({
        guid: GuidThumbnails,
        op: 'primary',
        idlist: IDLISTPHOTOS
    })
    .catch(reporterror);

    // create smaller images via Image batch processor (asynchron)
    var promise2 = IMatch.favoriteExecute({
        guid: GuidPhotos,
        op: 'primary',
        idlist: IDLISTPHOTOS
    })
    .catch(reporterror);

    // waiting until promise1 und promise2 are finished
    Promise.all([promise1, promise2])
    .then(whenFinished)
    .catch(reporterror);

Mario

Favorites cannot run in parallel. Geez  :o

IMWS will synchronize many internal IMatch routines to protect script authors from shooting themselves into their own foot.
Why would you run two Favorites at the same time  ;)

Everything that has an impact on the UI, for example, needs to run on the UI thread. IMWS hands over the control from the web server process to the UI thread process and this process then performs the command. IMWS of course can process multiple requests in parallel, but Windows cannot update an application user interface from multiple threads.

In your case this means that the Favorites are processed in sequence.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

kkae

Thanks.

QuoteWhy would you run two Favorites at the same time
These are long processes and they can run in principle in parallel, this saves time.
My computer has 8 cores and 7 are bored.

Mario

IMatch uses all threads in your computer when ingesting files, running filters, updating categories etc. But usually the bottleneck is the disk. 4,6 or 8 cores can calculate things much faster than your disk can deliver data.

Having so many cores is good when you run multiple applications at the same time. Or when you run applications with easily to parallize tasks like 3D rendering. And for servers of course - IMWS loves systems with many processors.

But you are here trying to run a UI-based feature in IMatch: Favorites. This won't work. I did not bother to parallize the batch processor, becasuse it is fast enough even on computers with one computer.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook