BMv2 time-sensitivity

Hello everyone!
I have been working with BMv2 for a year now. I am trying to implement a time-sensitive synchronization protocol on BMv2. I understand that BMv2 is not a production-level switch with low delay. However, I prefer to minimize the delay so I can verify my algorithm.

I’m having trouble sending a packet to two switches simultaneously.
Both switches are identical and connected to the same veth.
However, there is a large difference between the time they receive the packet. (I use OS timestamps. Switches are identical)
I am using Ubuntu on a virtual machine. I have tried allocating one CPU core to each switch. I have also increased the priority of each switch process using the OS scheduler. Both were ineffective. I am still observing differences in the time that two switches receive the packet (random value between a couple of microseconds up to a couple of milliseconds).

What is the cause of this inconsistency?
Is BMv2 put to sleep when it’s not receiving any packets?
How can I minimize this time difference?

I would appreciate it if you share your experiences.

BMv2’s simple_switch / simple_switch_grpc are simply user space programs, scheduled like any other user space programs are. When it is waiting on arriving packets, I believe that at least one of its threads is blocking on a system call, with nothing to do until that system call returns (but I could be wrong on that detail). Operating system schedulers have many tuning parameters, but I have not examined them all in detail to see if some of them may help you.

What kind of time difference in processing the packets would you consider good enough for your purposes?

Have you considered writing a discrete event simulation program for modeling your system, rather than using BMv2?

1 Like

Thank you for the information!
I need a time difference of less than ten microseconds, but sometimes, I get values as high as a couple of milliseconds. Moreover, the time difference is different in each test. I will look into scheduler options.