LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Persistence and source port of connections

To: lvs-users@xxxxxxxxxxxxxxxxxxxxxx
Subject: Persistence and source port of connections
From: Guy Waugh <gwaugh@xxxxxxxxxx>
Date: Tue, 18 Nov 2003 11:18:37 +1100
Hi all,

In my LVS-NAT system (IPVS-1.0.9 + ldirectord), I have an Oracle server on the inside (web-db1) that primarily services the two realservers within the LVS. However, I also have a webserver (www1) on the VIP side of the network whose apache processes make Oracle connections through to the Oracle server on the inside of the LVS. To allow this, I have the Oracle listener service (port 1521) as an LVS service, with persistence set to 25200 seconds (7 hours).

I'm noticing a couple of different types of connections from www1 to the Oracle listener port on the VIP: one with a source port of 0, and one with a random source port, like so (the VIP is 'learn'):

[root@lvs1 gwaugh]# ipvsadm -Lc
IPVS connection entries
pro expire state       source             virtual            destination
TCP 419:41 NONE        www1:0      learn:1521     web-db1:1521
TCP 01:38  TIME_WAIT   www1:2509 learn:1521  web-db1:1521
TCP 01:43  TIME_WAIT   www1:2560 learn:1521  web-db1:1521

Connections with a source port of 0 take on the persistence of 25200 seconds (as I have specified in ldirectord.cf), but connections out of a non-zero source port take on a persistence of 15 minutes (900 seconds). I see from http://www.linuxvirtualserver.org/Joseph.Mack/HOWTO/LVS-HOWTO.persistent_connection.html that: * For LVS persistence, the client is recognised by its IP (CIP) or in recent versions of ip_vs, by CIP:dst_port (i.e. by the CIP and the port being forwarded by the LVS). If only the CIP is used to schedule persistence, then the entries in the output of ipvsadm will be of the form VIP:0 (i.e. with port=0), otherwise the output of ipvsadm will be of the form VIP:port. Can anyone tell me why I get both types of connections (source port 0 and source port non-zero)? Perhaps the 'source port 0' connection is some sort of 'master' connection, and the 'source port non-zero' connections are some sort of 'slave' connections?

What I'm really wondering is if it is possible to effectively make the persistence for this connection infinite? Perhaps I shouldn't use LVS to do this, but should use iptables instead...?

The problem underlying all this is that some apache processes on www1 seem to lose their Oracle connection over time, so any client hitting www1 who happens to get serviced by an apache process that has lost its Oracle connection gets Oracle connection errors all over the page. I see from http://www.linuxvirtualserver.org/Joseph.Mack/HOWTO/LVS-HOWTO.services.single-port.html#tcpip_idle_timeout that one can set TCP idle timeouts for connections with ipvsadm - perhaps this is what I should be doing?

Any thoughts appreciated...

Thanks,
Guy.
<Prev in Thread] Current Thread [Next in Thread>