Discussion:
[Ryu-devel] Event receive timestamps
Matthew Hayes
2017-07-10 10:34:04 UTC
Permalink
Hi all,

Can Ryu present timestamps to applications detailing when it received particular OpenFlow events (example: timestamp for when a Packet-In event was received by Ryu)?

I have a reactive SDN project built on Ryu (see: https://nmeta.readthedocs.io ), and telemetry built into the app records processing time for OpenFlow events, such as Packet-In.

I want to be able to access to the timestamp of when the OpenFlow event is received by the controller, to enable tracking of the delay in the application receiving the event, which will vary under load. This feature would also help with accuracy of algorithms that analyse packet arrival times.

Please advise if this data is available in Ryu, and if not, whether it would be possible to develop it?

Thanks,

Matt.
Iwase Yusuke
2017-07-11 00:31:19 UTC
Permalink
Hi Matt,

Ryu handles the low level messages receiving at ryu/controller/controller.py, I guess we need to
get the timestamp here.
https://github.com/osrg/ryu/blob/master/ryu/controller/controller.py#L233


Then, how about the following?
I added the "timestamp" into "EventOFP***" events.

$ git diff
diff --git a/ryu/controller/controller.py b/ryu/controller/controller.py
index 62bca5f..4c7259c 100644
--- a/ryu/controller/controller.py
+++ b/ryu/controller/controller.py
@@ -22,6 +22,7 @@ The main component of OpenFlow controller.

"""

+import time
import contextlib
from ryu import cfg
import logging
@@ -266,11 +267,13 @@ class Datapath(ofproto_protocol.ProtocolDesc):
remaining_read_len = (msg_len - buf_len)
break

+ _received_time = time.time()
msg = ofproto_parser.msg(
self, version, msg_type, msg_len, xid, buf[:msg_len])
# LOG.debug('queue msg %s cls %s', msg, msg.__class__)
if msg:
ev = ofp_event.ofp_msg_to_ev(msg)
+ ev.timestamp = _received_time
self.ofp_brick.send_event_to_observers(ev, self.state)

dispatchers = lambda x: x.callers[ev.__class__].dispatchers


Thanks,
Iwase


On 2017年07月10日 19:34, Matthew Hayes wrote:
> Hi all,
>
> Can Ryu present timestamps to applications detailing when it received particular OpenFlow events
> (example: timestamp for when a Packet-In event was received by Ryu)?
>
> I have a reactive SDN project built on Ryu (see: https://nmeta.readthedocs.io ), and telemetry built
> into the app records processing time for OpenFlow events, such as Packet-In.
>
> I want to be able to access to the timestamp of when the OpenFlow event is received by the
> controller, to enable tracking of the delay in the application receiving the event, which will vary
> under load. This feature would also help with accuracy of algorithms that analyse packet arrival times.
>
> Please advise if this data is available in Ryu, and if not, whether it would be possible to develop it?
>
> Thanks,
>
> Matt.
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Ryu-devel mailing list
> Ryu-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
Matthew Hayes
2017-07-11 09:59:04 UTC
Permalink
Hi Iwase


Thank you for the really prompt reply. I will test your patch out with my project.

Will this patch make it into the main Ryu distribution at some stage?


Thanks,


Matt.

________________________________
From: Iwase Yusuke <***@gmail.com>
Sent: Tuesday, 11 July 2017 12:31 a.m.
To: ***@hotmail.com
Cc: ryu-***@lists.sourceforge.net
Subject: Re: [Ryu-devel] Event receive timestamps

Hi Matt,

Ryu handles the low level messages receiving at ryu/controller/controller.py, I guess we need to
get the timestamp here.
https://github.com/osrg/ryu/blob/master/ryu/controller/controller.py#L233


Then, how about the following?
I added the "timestamp" into "EventOFP***" events.

$ git diff
diff --git a/ryu/controller/controller.py b/ryu/controller/controller.py
index 62bca5f..4c7259c 100644
--- a/ryu/controller/controller.py
+++ b/ryu/controller/controller.py
@@ -22,6 +22,7 @@ The main component of OpenFlow controller.

"""

+import time
import contextlib
from ryu import cfg
import logging
@@ -266,11 +267,13 @@ class Datapath(ofproto_protocol.ProtocolDesc):
remaining_read_len = (msg_len - buf_len)
break

+ _received_time = time.time()
msg = ofproto_parser.msg(
self, version, msg_type, msg_len, xid, buf[:msg_len])
# LOG.debug('queue msg %s cls %s', msg, msg.__class__)
if msg:
ev = ofp_event.ofp_msg_to_ev(msg)
+ ev.timestamp = _received_time
self.ofp_brick.send_event_to_observers(ev, self.state)

dispatchers = lambda x: x.callers[ev.__class__].dispatchers


Thanks,
Iwase


On 2017$BG/(B07$B7n(B10$BF|(B 19:34, Matthew Hayes wrote:
> Hi all,
>
> Can Ryu present timestamps to applications detailing when it received particular OpenFlow events
> (example: timestamp for when a Packet-In event was received by Ryu)?
>
> I have a reactive SDN project built on Ryu (see: https://nmeta.readthedocs.io ), and telemetry built
> into the app records processing time for OpenFlow events, such as Packet-In.
>
> I want to be able to access to the timestamp of when the OpenFlow event is received by the
> controller, to enable tracking of the delay in the application receiving the event, which will vary
> under load. This feature would also help with accuracy of algorithms that analyse packet arrival times.
>
> Please advise if this data is available in Ryu, and if not, whether it would be possible to develop it?
>
> Thanks,
>
> Matt.
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Ryu-devel mailing list
> Ryu-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
Iwase Yusuke
2017-07-12 00:38:34 UTC
Permalink
Hi Matt,

Oops, sorry the snippet I wrote on the previous mail is not the official patch.
And currently, I don't have a plan to send it into the upstream.

If adding timestamps into upstream, I guess we need to take care about the
performance.
For example, with tons of Packet-In, we want to reduce the overhead of receiving
and parsing OpenFlow messages in "_recv_loop".
I think better to add the new options for taking timestamps.
e.g.) taking timestamps only when "--with-timestamp" option is specified.

Thanks,
Iwase


On 2017$BG/(B07$B7n(B11$BF|(B 18:59, Matthew Hayes wrote:
> Hi Iwase
>
>
> Thank you for the really prompt reply. I will test your patch out with my project.
>
> Will this patch make it into the main Ryu distribution at some stage?
>
>
> Thanks,
>
>
> Matt.
>
>
> ----------------------------------------------------------------------------------------------------
> *From:* Iwase Yusuke <***@gmail.com>
> *Sent:* Tuesday, 11 July 2017 12:31 a.m.
> *To:* ***@hotmail.com
> *Cc:* ryu-***@lists.sourceforge.net
> *Subject:* Re: [Ryu-devel] Event receive timestamps
> Hi Matt,
>
> Ryu handles the low level messages receiving at ryu/controller/controller.py, I guess we need to
> get the timestamp here.
> https://github.com/osrg/ryu/blob/master/ryu/controller/controller.py#L233
>
>
> Then, how about the following?
> I added the "timestamp" into "EventOFP***" events.
>
> $ git diff
> diff --git a/ryu/controller/controller.py b/ryu/controller/controller.py
> index 62bca5f..4c7259c 100644
> --- a/ryu/controller/controller.py
> +++ b/ryu/controller/controller.py
> @@ -22,6 +22,7 @@ The main component of OpenFlow controller.
>
> """
>
> +import time
> import contextlib
> from ryu import cfg
> import logging
> @@ -266,11 +267,13 @@ class Datapath(ofproto_protocol.ProtocolDesc):
> remaining_read_len = (msg_len - buf_len)
> break
>
> + _received_time = time.time()
> msg = ofproto_parser.msg(
> self, version, msg_type, msg_len, xid, buf[:msg_len])
> # LOG.debug('queue msg %s cls %s', msg, msg.__class__)
> if msg:
> ev = ofp_event.ofp_msg_to_ev(msg)
> + ev.timestamp = _received_time
> self.ofp_brick.send_event_to_observers(ev, self.state)
>
> dispatchers = lambda x: x.callers[ev.__class__].dispatchers
>
>
> Thanks,
> Iwase
>
>
> On 2017$BG/(B07$B7n(B10$BF|(B 19:34, Matthew Hayes wrote:
>> Hi all,
>>
>> Can Ryu present timestamps to applications detailing when it received particular OpenFlow events
>> (example: timestamp for when a Packet-In event was received by Ryu)?
>>
>> I have a reactive SDN project built on Ryu (see: https://nmeta.readthedocs.io ), and telemetry built
>> into the app records processing time for OpenFlow events, such as Packet-In.
>>
>> I want to be able to access to the timestamp of when the OpenFlow event is received by the
>> controller, to enable tracking of the delay in the application receiving the event, which will vary
>> under load. This feature would also help with accuracy of algorithms that analyse packet arrival times.
>>
>> Please advise if this data is available in Ryu, and if not, whether it would be possible to develop it?
>>
>> Thanks,
>>
>> Matt.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>
>>
>>
>> _______________________________________________
>> Ryu-devel mailing list
>> Ryu-***@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Ryu-devel mailing list
> Ryu-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
Matthew Hayes
2017-07-20 08:36:02 UTC
Permalink
Hi Iwase,


I've tested your suggested patch and it works (although I had to apply updates manually).


The develop branch of nmeta has been updated to consume the event timestamp, if it exists (see https://github.com/mattjhayes/nmeta/blob/develop/nmeta/nmeta.py#L330)


I've attached a brief analysis of the benefits of event receive timestamps for measuring controller/app performance.


Please let me know if this enhancement makes it into the upstream, a command line switch to enable it would be just fine.


Thanks,


Matt.


________________________________
From: Iwase Yusuke <***@gmail.com>
Sent: Wednesday, 12 July 2017 12:38 a.m.
To: ***@hotmail.com
Cc: ryu-***@lists.sourceforge.net
Subject: Re: [Ryu-devel] Event receive timestamps

Hi Matt,

Oops, sorry the snippet I wrote on the previous mail is not the official patch.
And currently, I don't have a plan to send it into the upstream.

If adding timestamps into upstream, I guess we need to take care about the
performance.
For example, with tons of Packet-In, we want to reduce the overhead of receiving
and parsing OpenFlow messages in "_recv_loop".
I think better to add the new options for taking timestamps.
e.g.) taking timestamps only when "--with-timestamp" option is specified.

Thanks,
Iwase


On 2017ÒŽ07êÅ11ìí 18:59, Matthew Hayes wrote:
> Hi Iwase
>
>
> Thank you for the really prompt reply. I will test your patch out with my project.
>
> Will this patch make it into the main Ryu distribution at some stage?
>
>
> Thanks,
>
>
> Matt.
>
>
> ----------------------------------------------------------------------------------------------------
> *From:* Iwase Yusuke <***@gmail.com>
> *Sent:* Tuesday, 11 July 2017 12:31 a.m.
> *To:* ***@hotmail.com
> *Cc:* ryu-***@lists.sourceforge.net
> *Subject:* Re: [Ryu-devel] Event receive timestamps
> Hi Matt,
>
> Ryu handles the low level messages receiving at ryu/controller/controller.py, I guess we need to
> get the timestamp here.
> https://github.com/osrg/ryu/blob/master/ryu/controller/controller.py#L233
[https://avatars0.githubusercontent.com/u/1179438?v=3&s=400]<https://github.com/osrg/ryu/blob/master/ryu/controller/controller.py#L233>

ryu/controller.py at master ¡€ osrg/ryu ¡€ GitHub<https://github.com/osrg/ryu/blob/master/ryu/controller/controller.py#L233>
github.com
ryu - Ryu component-based software defined networking framework


>
>
> Then, how about the following?
> I added the "timestamp" into "EventOFP***" events.
>
> $ git diff
> diff --git a/ryu/controller/controller.py b/ryu/controller/controller.py
> index 62bca5f..4c7259c 100644
> --- a/ryu/controller/controller.py
> +++ b/ryu/controller/controller.py
> @@ -22,6 +22,7 @@ The main component of OpenFlow controller.
>
> """
>
> +import time
> import contextlib
> from ryu import cfg
> import logging
> @@ -266,11 +267,13 @@ class Datapath(ofproto_protocol.ProtocolDesc):
> remaining_read_len = (msg_len - buf_len)
> break
>
> + _received_time = time.time()
> msg = ofproto_parser.msg(
> self, version, msg_type, msg_len, xid, buf[:msg_len])
> # LOG.debug('queue msg %s cls %s', msg, msg.__class__)
> if msg:
> ev = ofp_event.ofp_msg_to_ev(msg)
> + ev.timestamp = _received_time
> self.ofp_brick.send_event_to_observers(ev, self.state)
>
> dispatchers = lambda x: x.callers[ev.__class__].dispatchers
>
>
> Thanks,
> Iwase
>
>
> On 2017ÒŽ07êÅ10ìí 19:34, Matthew Hayes wrote:
>> Hi all,
>>
>> Can Ryu present timestamps to applications detailing when it received particular OpenFlow events
>> (example: timestamp for when a Packet-In event was received by Ryu)?
>>
>> I have a reactive SDN project built on Ryu (see: https://nmeta.readthedocs.io ), and telemetry built
>> into the app records processing time for OpenFlow events, such as Packet-In.
>>
>> I want to be able to access to the timestamp of when the OpenFlow event is received by the
>> controller, to enable tracking of the delay in the application receiving the event, which will vary
>> under load. This feature would also help with accuracy of algorithms that analyse packet arrival times.
>>
>> Please advise if this data is available in Ryu, and if not, whether it would be possible to develop it?
>>
>> Thanks,
>>
>> Matt.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>
>>
>>
>> _______________________________________________
>> Ryu-devel mailing list
>> Ryu-***@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Ryu-devel mailing list
> Ryu-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
Iwase Yusuke
2017-07-25 01:38:31 UTC
Permalink
Hi Matt,

Sorry for the delay.


On 2017年07月20日 17:36, Matthew Hayes wrote:
> Hi Iwase,
>
>
> I've tested your suggested patch and it works (although I had to apply updates manually).
>
>
> The develop branch of nmeta has been updated to consume the event timestamp, if it exists (see
> https://github.com/mattjhayes/nmeta/blob/develop/nmeta/nmeta.py#L330)
>
>
> I've attached a brief analysis of the benefits of event receive timestamps for measuring
> controller/app performance.
>
>
> Please let me know if this enhancement makes it into the upstream, a command line switch to enable
> it would be just fine.

Thank you so much for your suggestion!
I've posted the patches for supporting this feature.
Could you reviewing my patches?
[Ryu-devel] [PATCH 0/2] Option to enable timestamp

Please note this feature is only enabled with "--with-timestamp" option in order to avoid changing
the existing features.

Thanks,
Iwase


>
>
> Thanks,
>
>
> Matt.
>
>
>
> ----------------------------------------------------------------------------------------------------
> *From:* Iwase Yusuke <***@gmail.com>
> *Sent:* Wednesday, 12 July 2017 12:38 a.m.
> *To:* ***@hotmail.com
> *Cc:* ryu-***@lists.sourceforge.net
> *Subject:* Re: [Ryu-devel] Event receive timestamps
> Hi Matt,
>
> Oops, sorry the snippet I wrote on the previous mail is not the official patch.
> And currently, I don't have a plan to send it into the upstream.
>
> If adding timestamps into upstream, I guess we need to take care about the
> performance.
> For example, with tons of Packet-In, we want to reduce the overhead of receiving
> and parsing OpenFlow messages in "_recv_loop".
> I think better to add the new options for taking timestamps.
> e.g.) taking timestamps only when "--with-timestamp" option is specified.
>
> Thanks,
> Iwase
>
>
> On 2017年07月11日 18:59, Matthew Hayes wrote:
>> Hi Iwase
>>
>>
>> Thank you for the really prompt reply. I will test your patch out with my project.
>>
>> Will this patch make it into the main Ryu distribution at some stage?
>>
>>
>> Thanks,
>>
>>
>> Matt.
>>
>>
>> ----------------------------------------------------------------------------------------------------
>> *From:* Iwase Yusuke <***@gmail.com>
>> *Sent:* Tuesday, 11 July 2017 12:31 a.m.
>> *To:* ***@hotmail.com
>> *Cc:* ryu-***@lists.sourceforge.net
>> *Subject:* Re: [Ryu-devel] Event receive timestamps
>> Hi Matt,
>>
>> Ryu handles the low level messages receiving at ryu/controller/controller.py, I guess we need to
>> get the timestamp here.
>> https://github.com/osrg/ryu/blob/master/ryu/controller/controller.py#L233
> <https://github.com/osrg/ryu/blob/master/ryu/controller/controller.py#L233>
>
> ryu/controller.py at master · osrg/ryu · GitHub
> <https://github.com/osrg/ryu/blob/master/ryu/controller/controller.py#L233>
> github.com
> ryu - Ryu component-based software defined networking framework
>
>
>>
>>
>> Then, how about the following?
>> I added the "timestamp" into "EventOFP***" events.
>>
>> $ git diff
>> diff --git a/ryu/controller/controller.py b/ryu/controller/controller.py
>> index 62bca5f..4c7259c 100644
>> --- a/ryu/controller/controller.py
>> +++ b/ryu/controller/controller.py
>> @@ -22,6 +22,7 @@ The main component of OpenFlow controller.
>>
>> """
>>
>> +import time
>> import contextlib
>> from ryu import cfg
>> import logging
>> @@ -266,11 +267,13 @@ class Datapath(ofproto_protocol.ProtocolDesc):
>> remaining_read_len = (msg_len - buf_len)
>> break
>>
>> + _received_time = time.time()
>> msg = ofproto_parser.msg(
>> self, version, msg_type, msg_len, xid, buf[:msg_len])
>> # LOG.debug('queue msg %s cls %s', msg, msg.__class__)
>> if msg:
>> ev = ofp_event.ofp_msg_to_ev(msg)
>> + ev.timestamp = _received_time
>> self.ofp_brick.send_event_to_observers(ev, self.state)
>>
>> dispatchers = lambda x: x.callers[ev.__class__].dispatchers
>>
>>
>> Thanks,
>> Iwase
>>
>>
>> On 2017年07月10日 19:34, Matthew Hayes wrote:
>>> Hi all,
>>>
>>> Can Ryu present timestamps to applications detailing when it received particular OpenFlow events
>>> (example: timestamp for when a Packet-In event was received by Ryu)?
>>>
>>> I have a reactive SDN project built on Ryu (see: https://nmeta.readthedocs.io ), and telemetry built
>>> into the app records processing time for OpenFlow events, such as Packet-In.
>>>
>>> I want to be able to access to the timestamp of when the OpenFlow event is received by the
>>> controller, to enable tracking of the delay in the application receiving the event, which will vary
>>> under load. This feature would also help with accuracy of algorithms that analyse packet arrival times.
>>>
>>> Please advise if this data is available in Ryu, and if not, whether it would be possible to develop it?
>>>
>>> Thanks,
>>>
>>> Matt.
>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Check out the vibrant tech community on one of the world's most
>>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>
>>>
>>>
>>> _______________________________________________
>>> Ryu-devel mailing list
>>> Ryu-***@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>
>>
>>
>> _______________________________________________
>> Ryu-devel mailing list
>> Ryu-***@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Ryu-devel mailing list
> Ryu-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>
Loading...