Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hybrid Communication #798

Open
owny990312 opened this issue Oct 31, 2024 · 4 comments
Open

Hybrid Communication #798

owny990312 opened this issue Oct 31, 2024 · 4 comments

Comments

@owny990312
Copy link

Describe the feature

1.Is it possible to use zenoh for both shared memory communication and network cross-machine communication?Does it currently have such basic functionality?
2.Can it even autonomously schedule which solution to use?
Thanks

@YuanYuYuan
Copy link
Contributor

Hi @owny990312! Yes, Zenoh has already supported this functionality. Assuming you have three zenoh sessions assigned as below, you can check the messages are successfully transmitted.

flowchart TB
    subgraph Machine1["Machine 1"]
        A["Publisher"]
        B["Subscriber 1"]
        A -- SHM --> B
    end
    subgraph Machine2["Machine 2"]
        C["Subscriber 2"]
    end
    A -- TCP --> C
Loading
  • Machine 1
./z_pub_shm
./z_sub_shm
  • Machine 2
./z_sub_shm

@owny990312
Copy link
Author

Hi @owny990312! Yes, Zenoh has already supported this functionality. Assuming you have three zenoh sessions assigned as below, you can check the messages are successfully transmitted.嗨!是的,Zenoh 已经支持这项功能。假设你有三个 zenoh 会话,如下所示,你可以检查消息是否成功传输。

flowchart TB
    subgraph Machine1["Machine 1"]
        A["Publisher"]
        B["Subscriber 1"]
        A -- SHM --> B
    end
    subgraph Machine2["Machine 2"]
        C["Subscriber 2"]
    end
    A -- TCP --> C
Loading
  • Machine 1 机器 1
./z_pub_shm
./z_sub_shm
  • Machine 2 机器 2
./z_sub_shm

Thank you for your answer.

I'd like to further confirm: I just use the shm-API for all cases, then it will automatically handle network communication for cross-machine scenarios while using shared memory for local machine communication.

Could you point me to any relevant documentation?

@owny990312
Copy link
Author

Hi @owny990312! Yes, Zenoh has already supported this functionality. Assuming you have three zenoh sessions assigned as below, you can check the messages are successfully transmitted.嗨!是的,Zenoh 已经支持这项功能。假设你有三个 zenoh 会话,如下所示,你可以检查消息是否成功传输。

flowchart TB
    subgraph Machine1["Machine 1"]
        A["Publisher"]
        B["Subscriber 1"]
        A -- SHM --> B
    end
    subgraph Machine2["Machine 2"]
        C["Subscriber 2"]
    end
    A -- TCP --> C
Loading
  • Machine 1 机器 1
./z_pub_shm
./z_sub_shm
  • Machine 2 机器 2
./z_sub_shm

I did some testing and the results were very exciting.

I'd like to know how the internal judgment is made.

Also, during execution, since I'm using the shm-API but actually receiving cross-machine data, is this error a normal phenomenon? Will it affect the speed?

image

@YuanYuYuan
Copy link
Contributor

Hi @owny990312, Thanks for reporting this. I've created an issue for it, #814. Don't worry; this doesn't affect performance.

The mechanism of zenoh deciding whether to send the buffer with SHM depends on the underlying link while it's established. You can check the details here https://github.com/eclipse-zenoh/zenoh/blob/e73a89d3bab5d3960159ddfc0ef315407d2fdf7e/io/zenoh-transport/src/shm.rs?plain=1#L123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants