LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: ipvsadm -l --stats

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: ipvsadm -l --stats
From: Wensong Zhang <wensong@xxxxxxxxxxxx>
Date: Sun, 12 Oct 2003 23:04:43 +0800 (CST)

Hi,

On Thu, 9 Oct 2003, Rutger van Oosten wrote:

> When I run ipvsadm -l --stats it shows connections, packets and bytes in and
> out for the virtual services and for the real servers. One would expect that
> the traffic for the service is the sum of the traffic to the servers - but
> it is not, the numbers don't add up at all, whereas in ipvsadm -l --rate
> they do (approximately, not exactly for the bytes per second ones).
> 
> For example (LVS-NAT, two real servers, one http virtual service):
> 
> # ipvsadm -l --stats
> IP Virtual Server version 1.0.10 (size=4096)
> Prot LocalAddress:Port               Conns   InPkts  OutPkts  InBytes
> OutBytes
>   -> RemoteAddress:Port
> TCP  vip:http                      4239091 31977546 29470876    3692M
> 26647M
>   -> www02:http                    3911835 29405279 26900679    3407M
> 24292M
>   -> www01:http                    3395953 25407180 23257431    2931M
> 20957M
> 
> 
> # ipvsadm -l --rate
> IP Virtual Server version 1.0.10 (size=4096)
> Prot LocalAddress:Port                 CPS    InPPS   OutPPS    InBPS
> OutBPS
>   -> RemoteAddress:Port
> TCP  vip:http                           45      348      314    41739
> 285599
>   -> www02:http                         35      252      216    30416
> 197101
>   -> www01:http                         10       96       98    11323
> 88497
> 
> 
> # ipvsadm --version
> ipvsadm v1.21 2002/11/12 (compiled with popt and IPVS v1.0.10)
> 
> 
> Is this a bug, or am I just missing something?
> 

It's quite possible that the conns/bytes/packets statistics of virtual
service is not the sum of the conns/bytes/packets counters of its real
servers, because some real servers may be removed permanetly. The
connection rate of virtual service is the sum of connection rate of its
real servers, because it is an instant metric at a time.

In the output of your "ipvsadm --l --stats", the counters of virtual
service is less than the sum of the counters of its real servers. I guess
that your virtual service must have been removed after it run for a while,
and then must be created later. In current implementation, if real servers
are to be deleted, they will not be removed permanently, but be put in the
trash, because established connections still refer to them; a server can
be looked up in the trash when it is added back to a service. When a 
virtual service is created, it always has counters set to zero, but the 
real servers can be picked up from the trash, they have the past counters. 
We probably need zero the counters of real servers if the service is a new 
one. Anyway, you can do "cat /proc/net/ip_vs_stats". The counters of all 
IPVS services is larger than or equal to the sum of real servers.

Regards,

Wensong

<Prev in Thread] Current Thread [Next in Thread>