mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
ofproto: Report controller rate limiting statistics in database.
Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Gurucharan Shetty <gshetty@nicira.com>
This commit is contained in:
1
NEWS
1
NEWS
@@ -7,6 +7,7 @@ Post-v2.3.0
|
|||||||
possible to generate or match options. This is planned for a future
|
possible to generate or match options. This is planned for a future
|
||||||
release. The protocol is documented at
|
release. The protocol is documented at
|
||||||
http://tools.ietf.org/html/draft-gross-geneve-00
|
http://tools.ietf.org/html/draft-gross-geneve-00
|
||||||
|
- The OVS database now reports controller rate limiting statistics.
|
||||||
|
|
||||||
|
|
||||||
v2.3.0 - xx xxx xxxx
|
v2.3.0 - xx xxx xxxx
|
||||||
|
@@ -414,7 +414,10 @@ connmgr_get_memory_usage(const struct connmgr *mgr, struct simap *usage)
|
|||||||
|
|
||||||
packets += rconn_count_txqlen(ofconn->rconn);
|
packets += rconn_count_txqlen(ofconn->rconn);
|
||||||
for (i = 0; i < N_SCHEDULERS; i++) {
|
for (i = 0; i < N_SCHEDULERS; i++) {
|
||||||
packets += pinsched_count_txqlen(ofconn->schedulers[i]);
|
struct pinsched_stats stats;
|
||||||
|
|
||||||
|
pinsched_get_stats(ofconn->schedulers[i], &stats);
|
||||||
|
packets += stats.n_queued;;
|
||||||
}
|
}
|
||||||
packets += pktbuf_count_packets(ofconn->pktbuf);
|
packets += pktbuf_count_packets(ofconn->pktbuf);
|
||||||
}
|
}
|
||||||
@@ -471,6 +474,7 @@ connmgr_get_controller_info(struct connmgr *mgr, struct shash *info)
|
|||||||
time_t last_connection = rconn_get_last_connection(rconn);
|
time_t last_connection = rconn_get_last_connection(rconn);
|
||||||
time_t last_disconnect = rconn_get_last_disconnect(rconn);
|
time_t last_disconnect = rconn_get_last_disconnect(rconn);
|
||||||
int last_error = rconn_get_last_error(rconn);
|
int last_error = rconn_get_last_error(rconn);
|
||||||
|
int i;
|
||||||
|
|
||||||
shash_add(info, target, cinfo);
|
shash_add(info, target, cinfo);
|
||||||
|
|
||||||
@@ -494,6 +498,27 @@ connmgr_get_controller_info(struct connmgr *mgr, struct shash *info)
|
|||||||
smap_add_format(&cinfo->pairs, "sec_since_disconnect",
|
smap_add_format(&cinfo->pairs, "sec_since_disconnect",
|
||||||
"%ld", (long int) (now - last_disconnect));
|
"%ld", (long int) (now - last_disconnect));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < N_SCHEDULERS; i++) {
|
||||||
|
if (ofconn->schedulers[i]) {
|
||||||
|
const char *name = i ? "miss" : "action";
|
||||||
|
struct pinsched_stats stats;
|
||||||
|
|
||||||
|
pinsched_get_stats(ofconn->schedulers[i], &stats);
|
||||||
|
smap_add_nocopy(&cinfo->pairs,
|
||||||
|
xasprintf("packet-in-%s-backlog", name),
|
||||||
|
xasprintf("%u", stats.n_queued));
|
||||||
|
smap_add_nocopy(&cinfo->pairs,
|
||||||
|
xasprintf("packet-in-%s-bypassed", name),
|
||||||
|
xasprintf("%llu", stats.n_normal));
|
||||||
|
smap_add_nocopy(&cinfo->pairs,
|
||||||
|
xasprintf("packet-in-%s-queued", name),
|
||||||
|
xasprintf("%llu", stats.n_limited));
|
||||||
|
smap_add_nocopy(&cinfo->pairs,
|
||||||
|
xasprintf("packet-in-%s-dropped", name),
|
||||||
|
xasprintf("%llu", stats.n_queue_dropped));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -295,10 +295,17 @@ pinsched_set_limits(struct pinsched *ps, int rate_limit, int burst_limit)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the number of packets scheduled to be sent eventually by 'ps'.
|
/* Retrieves statistics for 'ps'. The statistics will be all zero if 'ps' is
|
||||||
* Returns 0 if 'ps' is null. */
|
* null. */
|
||||||
unsigned int
|
void
|
||||||
pinsched_count_txqlen(const struct pinsched *ps)
|
pinsched_get_stats(const struct pinsched *ps, struct pinsched_stats *stats)
|
||||||
{
|
{
|
||||||
return ps ? ps->n_queued : 0;
|
if (ps) {
|
||||||
|
stats->n_queued = ps->n_queued;
|
||||||
|
stats->n_normal = ps->n_normal;
|
||||||
|
stats->n_limited = ps->n_limited;
|
||||||
|
stats->n_queue_dropped = ps->n_queue_dropped;
|
||||||
|
} else {
|
||||||
|
memset(stats, 0, sizeof *stats);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
|
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -33,6 +33,13 @@ void pinsched_send(struct pinsched *, ofp_port_t port_no, struct ofpbuf *,
|
|||||||
void pinsched_run(struct pinsched *, struct list *txq);
|
void pinsched_run(struct pinsched *, struct list *txq);
|
||||||
void pinsched_wait(struct pinsched *);
|
void pinsched_wait(struct pinsched *);
|
||||||
|
|
||||||
unsigned int pinsched_count_txqlen(const struct pinsched *);
|
struct pinsched_stats {
|
||||||
|
unsigned int n_queued; /* # currently queued to send. */
|
||||||
|
unsigned long long n_normal; /* # txed w/o rate limit queuing. */
|
||||||
|
unsigned long long n_limited; /* # queued for rate limiting. */
|
||||||
|
unsigned long long n_queue_dropped; /* # dropped due to queue overflow. */
|
||||||
|
};
|
||||||
|
|
||||||
|
void pinsched_get_stats(const struct pinsched *, struct pinsched_stats *);
|
||||||
|
|
||||||
#endif /* pinsched.h */
|
#endif /* pinsched.h */
|
||||||
|
@@ -3223,7 +3223,7 @@
|
|||||||
</column>
|
</column>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group title="Asynchronous Message Configuration">
|
<group title="Asynchronous Messages">
|
||||||
<p>
|
<p>
|
||||||
OpenFlow switches send certain messages to controllers spontanenously,
|
OpenFlow switches send certain messages to controllers spontanenously,
|
||||||
that is, not in response to any request from the controller. These
|
that is, not in response to any request from the controller. These
|
||||||
@@ -3243,38 +3243,102 @@
|
|||||||
on any messages that it does want to receive, if any.
|
on any messages that it does want to receive, if any.
|
||||||
</column>
|
</column>
|
||||||
|
|
||||||
<column name="controller_rate_limit">
|
<group title="Controller Rate Limiting">
|
||||||
<p>
|
<p>
|
||||||
The maximum rate at which the switch will forward packets to the
|
A switch can forward packets to a controller over the OpenFlow
|
||||||
OpenFlow controller, in packets per second. This feature prevents a
|
protocol. Forwarding packets this way at too high a rate can
|
||||||
single bridge from overwhelming the controller. If not specified,
|
overwhelm a controller, frustrate use of the OpenFlow connection for
|
||||||
the default is implementation-specific.
|
other purposes, increase the latency of flow setup, and use an
|
||||||
|
unreasonable amount of bandwidth. Therefore, Open vSwitch supports
|
||||||
|
limiting the rate of packet forwarding to a controller.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
In addition, when a high rate triggers rate-limiting, Open vSwitch
|
There are two main reasons in OpenFlow for a packet to be sent to a
|
||||||
queues controller packets for each port and transmits them to the
|
controller: either the packet ``misses'' in the flow table, that is,
|
||||||
controller at the configured rate. The <ref
|
there is no matching flow, or a flow table action says to send the
|
||||||
column="controller_burst_limit"/> value limits the number of queued
|
packet to the controller. Open vSwitch limits the rate of each kind
|
||||||
packets. Ports on a bridge share the packet queue fairly.
|
of packet separately at the configured rate. Therefore, the actual
|
||||||
|
rate that packets are sent to the controller can be up to twice the
|
||||||
|
configured rate, when packets are sent for both reasons.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Open vSwitch maintains two such packet rate-limiters per bridge: one
|
This feature is specific to forwarding packets over an OpenFlow
|
||||||
for packets sent up to the controller because they do not correspond
|
connection. It is not general-purpose QoS. See the <ref
|
||||||
to any flow, and the other for packets sent up to the controller by
|
table="QoS"/> table for quality of service configuration, and <ref
|
||||||
request through flow actions. When both rate-limiters are filled with
|
column="ingress_policing_rate" table="Interface"/> in the <ref
|
||||||
packets, the actual rate that packets are sent to the controller is
|
table="Interface"/> table for ingress policing configuration.
|
||||||
up to twice the specified rate.
|
|
||||||
</p>
|
</p>
|
||||||
</column>
|
|
||||||
|
|
||||||
<column name="controller_burst_limit">
|
<column name="controller_rate_limit">
|
||||||
In conjunction with <ref column="controller_rate_limit"/>,
|
<p>
|
||||||
the maximum number of unused packet credits that the bridge will
|
The maximum rate at which the switch will forward packets to the
|
||||||
allow to accumulate, in packets. If not specified, the default
|
OpenFlow controller, in packets per second. If no value is
|
||||||
is implementation-specific.
|
specified, rate limiting is disabled.
|
||||||
</column>
|
</p>
|
||||||
|
</column>
|
||||||
|
|
||||||
|
<column name="controller_burst_limit">
|
||||||
|
<p>
|
||||||
|
When a high rate triggers rate-limiting, Open vSwitch queues
|
||||||
|
packets to the controller for each port and transmits them to the
|
||||||
|
controller at the configured rate. This value limits the number of
|
||||||
|
queued packets. Ports on a bridge share the packet queue fairly.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This value has no effect unless <ref
|
||||||
|
column="controller_rate_limit"/> is configured. The current
|
||||||
|
default when this value is not specified is one-quarter of <ref
|
||||||
|
column="controller_rate_limit"/>, meaning that queuing can delay
|
||||||
|
forwarding a packet to the controller by up to 250 ms.
|
||||||
|
</p>
|
||||||
|
</column>
|
||||||
|
|
||||||
|
<group title="Controller Rate Limiting Statistics">
|
||||||
|
<p>
|
||||||
|
These values report the effects of rate limiting. Their values are
|
||||||
|
relative to establishment of the most recent OpenFlow connection,
|
||||||
|
or since rate limiting was enabled, whichever happened more
|
||||||
|
recently. Each consists of two values, one with <code>TYPE</code>
|
||||||
|
replaced by <code>miss</code> for rate limiting flow table misses,
|
||||||
|
and the other with <code>TYPE</code> replaced by
|
||||||
|
<code>action</code> for rate limiting packets sent by OpenFlow
|
||||||
|
actions.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
These statistics are reported only when controller rate limiting is
|
||||||
|
enabled.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<column name="status" key="packet-in-TYPE-bypassed"
|
||||||
|
type='{"type": "integer", "minInteger": 0}'>
|
||||||
|
Number of packets sent directly to the controller, without queuing,
|
||||||
|
because the rate did not exceed the configured maximum.
|
||||||
|
</column>
|
||||||
|
|
||||||
|
<column name="status" key="packet-in-TYPE-queued"
|
||||||
|
type='{"type": "integer", "minInteger": 0}'>
|
||||||
|
Number of packets added to the queue to send later.
|
||||||
|
</column>
|
||||||
|
|
||||||
|
<column name="status" key="packet-in-TYPE-dropped"
|
||||||
|
type='{"type": "integer", "minInteger": 0}'>
|
||||||
|
Number of packets added to the queue that were later dropped due to
|
||||||
|
overflow. This value is less than or equal to <ref column="status"
|
||||||
|
key="packet-in-TYPE-queued"/>.
|
||||||
|
</column>
|
||||||
|
|
||||||
|
<column name="status" key="packet-in-TYPE-backlog"
|
||||||
|
type='{"type": "integer", "minInteger": 0}'>
|
||||||
|
Number of packets currently queued. The other statistics increase
|
||||||
|
monotonically, but this one fluctuates between 0 and the <ref
|
||||||
|
column="controller_burst_limit"/> as conditions change.
|
||||||
|
</column>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group title="Additional In-Band Configuration">
|
<group title="Additional In-Band Configuration">
|
||||||
|
Reference in New Issue
Block a user