IPCsockets, how many helper apps possible ?

Hi, I’m writing a videoframe analyser program (well trying to), right now it takes 3 seconds on each frame…

thinking of multiple cpu and IPC sockets… But all examples, tells of two programs communication with each other…

I would like to have 1 master and (maxCPU cores -1) node apps, sending only a TRUE of FALSE back again… each node will constantly get a new frame number to analyse, and will send back either true or false…

The word counter is a great example for helper apps… but will an IPC socket do this faster ?

You’ll need one socket per helper on the “server” side.

Thomas Templeman has a multicore project using IPC sickets
http://www.tempel.org/RB/MultiProcessing

Hi Markus the thomas example will not run anymore, because of a thread exception from main thread thing…

System? Version?

Mac, 10.11.3. Xojo 2015r4.1

error:
Exception Message: A thread has attempted to manipulate a user interface element. This can only be done from the application’s main thread.

Any updates on this ? it’s quite interesting but unfortunately very few details about it .

Using IPC sockets you can open as much communication channels as you like provided each one is bound to a different socket (port). This realistically means ~500000 on Windows, but should suffice for your use.
That is, you can have multiple instances of the same helper tool running.

[quote=429364:@Massimo Valle]Using IPC sockets you can open as much communication channels as you like provided each one is bound to a different socket (port). This realistically means ~500000 on Windows, but should suffice for your use.
That is, you can have multiple instances of the same helper tool running.[/quote]
Great,

What would you recommend in the case of a helper to check an messaging app every 1 min and to do some sorting and filtering and update one database, in this case it can be sqlite or mysql .From what I read putting a timer and increasing the frequency of fetching data could drive the cpu crazy , no idea how it could work and if I can transfer record sets between apps or if there is a better way to doit. thinking to implement an api in the main app and then call it from the helper app , but ipc looks better, I’ll have to read more about it.

First of all I have to correct my number above: 50000 not 500000. Sorry typo.

Timers can indeed kill the cpu, but this depends also on the frequency. 1 min seems not problematic. However it also depends on how many helpers you spawn. 10 helpers might be ok, 100 maybe not. Finally it also depends on the platform. On Mac and Linux timers works more smoothly than on Windows, on my experience.

About transferring data between the main app and/or the helpers, keep in mind a IPC socket is just… a socket (though the latency might be a bit higher). You can transfer whatever you want in the format you prefer. Being binary data or text, JSON, etc. Decide a communication API and implement it.

Also, you wrote about SQLite. Keep in mind a such database is not for concurrent use, meaning there can’t be two or more applications opening it at the same time.

Final consideration: watch out about helpers to not end up with the application crashing and leaving orphans everywhere. You can instruct the helper to close if the other end of the IPC connection close, for example.

In the end, if you don’t strictly need the multicore data crunching it makes no sense to implement a such complication. But you probably need if you have to process video frames.

[quote=429376:@Massimo Valle]First of all I have to correct my number above: 50000 not 500000. Sorry typo.

Timers can indeed kill the cpu, but this depends also on the frequency. 1 min seems not problematic. However it also depends on how many helpers you spawn. 10 helpers might be ok, 100 maybe not. Finally it also depends on the platform. On Mac and Linux timers works more smoothly than on Windows, on my experience.

About transferring data between the main app and/or the helpers, keep in mind a IPC socket is just… a socket (though the latency might be a bit higher). You can transfer whatever you want in the format you prefer. Being binary data or text, JSON, etc. Decide a communication API and implement it.

Also, you wrote about SQLite. Keep in mind a such database is not for concurrent use, meaning there can’t be two or more applications opening it at the same time.

Final consideration: watch out about helpers to not end up with the application crashing and leaving orphans everywhere. You can instruct the helper to close if the other end of the IPC connection close, for example.

In the end, if you don’t strictly need the multicore data crunching it makes no sense to implement a such complication. But you probably need if you have to process video frames.[/quote]
Thanks for the feedback ,

Seeing this now, URLConnection — Xojo documentation and hopefully it will remain, I guess I can handle all within the app and with a timer, the idea was to have a helper not to overload the main app to do all those things, as for the sqlite I could use it as WAL and create like a buffer somewhere on the main app and push all from there so in any way data reading and writing will be done on the main app.

I’ll see the first option of using URLConnection for the async part and hopefully with a timer could be able to manage all the data properly and update what I need.

Thanks again.

For a main plus helper app scenario this is not true. Get them to both open the SQLite database as multi-user and they can pass instructions and results to each other. This works really well as an alternative, and is within the scope of more programmers.