Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important information on the platform change.

cancel
Showing results for 
Search instead for 
Did you mean: 

Data exchange between two ctrlX Apps

Data exchange between two ctrlX Apps

EchoHarm0ny
Member
Hi,

we are facing the challenge of designing the data exchange between two apps to be as performant as possible.
 
  • The typical amount of data that needs to be exchanged per cycle is 30-60 Mb
  • We are planning for 400-800 cycles per hour

We would like to learn more about the methods you would recommend for exchanging data between apps. What are the advantages and disadvantages of the different approaches?


  • If the exchange with via the files system is viable, is there an example that shows using plugs and slots to define a shared directory for two apps to use?
    • Consider that these two apps may not be made by the same company, they may be not built at the same time.
  • We also found an cpp example for the exchange via Datalayer shared memory, is this example also available in other programming languages?
9 REPLIES 9

Sgilk
Frequent Contributor

@EchoHarm0ny ,

What kind of data are you exchanging between the applications?

This is going to be a problem with any storage media. The frequent read/write operations generate mechanical wear on the hardware. If you want to go this route, I'd recommend a removable media device.

  • If the exchange with via the files system is viable, is there an example that shows using plugs and slots to define a shared directory for two apps to use?

The best approach here would be using removable storage media and the corresponding plug as shown above. It may also be possible to use the home interface but this plug does not auto-connect. A request to development would need to be made to possibly implement auto-connect for this plug. 

  • We also found an cpp example for the exchange via Datalayer shared memory, is this example also available in other programming languages?

This would be my recommended solution, especially if the data is of a consistent format and simple types. There are not examples in other languages for shared memory. What language were you planning to use?

Hi @Sgilk, thank you for the explanation

Your questions in blue

What kind of data are you exchanging between the applications?

  • Data acquired by a 3D camera. Our current solution outputs files.

The best approach here would be using removable storage media and the corresponding plug as shown above.

  • How fast is the interface of a removable media on a ctrlX CORE, i read in the data sheet USB 2.0, is that correct?
  • Is it possible to auto connect on removable media with two different snaps?

This would be my recommended solution, especially if the data is of a consistent format and simple types. There are not examples in other languages for shared memory. What language were you planning to use?

  • A Python example for shared memory would be great.

I also read about an option to use RAM-Disk on Ubuntu systems, is that a feasible approach on a ctrlX Hardware? I assume its challenging create a RAM-DISK and then mounting it to two snaps.
The benefits of a RAM-Disk for us:
- We could continue writing files
- Very fast read and write operations
- Can sustain countless reads and writes

HI @Sgilk,

we looked into the datalayer shared memory example.

A few questions:

In the sample the two apps are running in the same snap. It is necessary for us that the data provider is a own snap and the data consumer is a seperate app. Is there a configuration in the snapcraft.yaml necessary that both apps can access the shared memory?

The MEM_SIZE of the shared memory is set to 100 Bytes, we increased it to fit our 60Mb requirements, the app is not starting after this and we receive an error: DL_OUT_OF_MEMORY
How much memory is available for the shared memory?
2024-11-13_11h45_28.png

Is it possible to do a shared memory implementation without the datalayer?

 

Sgilk
Frequent Contributor

@EchoHarm0ny ,

There shouldn't be any special snapcraft.yaml configuration required to share memory between applications. It should be the same as the sample.

I am not finding a documented limit on shared memory. Maybe @nickH could comment?

The shared memory functionality is provided through the datalayer service. I don't think we can support it otherwise.

Now that I understand more of the application, I think the removable media file sharing approach would be more suitable. This way you don't need to parse/encode your files as compatible types for the memory range.

Thank you,

we increased the MEM_SIZE in the example app main_owner
 (line 16), would be interesting to know the threshold.
Would be also intersting to know if shared memory without datalayer is possible.

Removable media via the sd card slot or the usb-c interface, correct?
I read in a data sheet that all ctrlX CORE have a usb 2.0 interface.
Which read/write speed can we expect for a ctrlX CORE x7?

Is it possible to auto connect on removable media with two different snaps?

Sgilk
Frequent Contributor

Yes, you can use USB-C 2.0 or uSD.

  • USB-C 2.0 should provide 10-25 Mbps read and 3-10 Mbps write
  • uSD depends on the card type

The removable media and storage extension interfaces are both auto-connecting.

CodeShepherd
Community Moderator
Community Moderator

As an addition, apps can also exchange data via Unix sockets directly. The same mechanism is used internally in the ctrlX OS at several points.

Sgilk
Frequent Contributor

@CodeShepherd ,

Do we have any documentation on this? I see the information on using the existing unix sockets (ie. licensing-service), and binding a webserver to a unix socket within a single application, but what about data exchange between apps? 

CodeShepherd
Community Moderator
Community Moderator

@Sgilk you found the correct documentation. The sockets used are examples how our system (consisting of apps) is exchanging data with other installed apps.

Also simply using an content interface in one app where the other app can connect to is possible. Just like our solution management is sharing the hosting folders for the active configuration and all apps can access this folder and its data.

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist