[openflowplugin-dev] StackedSegment SEGMENT_SIZE = 4096


Anil Vishnoi
 

+openflowjava

On Wed, Feb 15, 2017 at 2:20 AM, Mageshwaran Vaithianathan <mageshwaran.v@...> wrote:

Hello Team,


    Can you please let me know the reason for setting the SEGMENT_SIZE to 4096 in StackedSegment.java? . What will be the appropriate use-case for the same.


 "/openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/StackedSegment.java"


I am observing that the queue is not getting completely utilised always. My understanding is only those mesages which expects a Reply from the switch will be using this segment for the RpcResponseKey. Is this interpretation correct? 



Best Regards

Mageshwaran Vaithianathan


_______________________________________________
openflowplugin-dev mailing list
openflowplugin-dev@lists.opendaylight.org
https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev




--
Thanks
Anil


Michal Rehak -X (mirehak - PANTHEON TECHNOLOGIES@Cisco) <mirehak@...>
 

Hi Mageshwaran,

SEGMENT_SIZE must be power of 2 in order to fit into max long (in case that message xid reaches 2^64). But that is just an implementation detail.

Queue segments are arrays and amount of used instances is driven by demand from consumer (e.g.: ofplugin outbound mechanism). By low traffic there might be only 2 segment instances used. As soon as the first one is full then the overlaying outbound queue takes the second one. And as soon as all messages in the first segment are done (confirmed, failed or covered by subsequent barrier)  then the first segment gets recycled. The original message reference is erased upon being sent and corresponding callback reference is erased upon completion/failure fired. This makes segment entries (OutboundQueueEntry) friendly to garbage collector.


In nutshell :

 Segments are cheap.

 And as soon as a OF message is subject to rpc (or some asynchronous mechanism) then it is essential to detect when device finished processing it.

 In my opinion - until there is no profiling data pointing at memory leak around outbound queue and segments I would postpone any optimization. Especially when based on setups with low utilization.


Regarding the RpcResponseKey - this is the old way of getting device reply within a hardcoded interval. It is still used before the outbound queue mechanism is plugged in (between connection established and protocol handshake finish).



Regards,

Michal




From: openflowjava-dev-bounces@... <openflowjava-dev-bounces@...> on behalf of Anil Vishnoi <vishnoianil@...>
Sent: Monday, February 20, 2017 22:35
To: Mageshwaran Vaithianathan
Cc: openflowjava-dev@...; openflowplugin-dev@...
Subject: Re: [openflowjava-dev] [openflowplugin-dev] StackedSegment SEGMENT_SIZE = 4096
 
+openflowjava

On Wed, Feb 15, 2017 at 2:20 AM, Mageshwaran Vaithianathan <mageshwaran.v@...> wrote:

Hello Team,


    Can you please let me know the reason for setting the SEGMENT_SIZE to 4096 in StackedSegment.java? . What will be the appropriate use-case for the same.


 "/openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/StackedSegment.java"


I am observing that the queue is not getting completely utilised always. My understanding is only those mesages which expects a Reply from the switch will be using this segment for the RpcResponseKey. Is this interpretation correct? 



Best Regards

Mageshwaran Vaithianathan


_______________________________________________
openflowplugin-dev mailing list
openflowplugin-dev@lists.opendaylight.org
https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev




--
Thanks
Anil