LoadBalancer code in Apache

ServerIP1 and ServerIP2 contains same GIS applications and the same Geoserver files.
Both Server accessing datas from ServerIP1:5433 Postgres Database Files.

While running select count(client_addr),client_addr from pg_stat_activity group by client_addr; this query
i'm getting from ServerIP1 Postgres counts are increasing continuously(count upto 50 or 100 or 200 like) and after some time intervals(not a fixed time)
that will come down to 1 then 2 then starting to increase the count.

If i stop ServerIP1:8080 tomcat then there is no problem.
Then i have checked which query is taking this much of connections in PostgreSQL But, i'm getting results only IDLE.
And getting only

probably not relevant but, why are you using 2 servers and the same stuff in each? It sounds complicated to me, I mean, it may be easier.
– GeryOct 25 '13 at 6:22

Dear Gery thank you for the reply.. So many clients are accessing our application and maps. So that for improving geoserver map and application speed i have done this. and i'm getting only 2013-10-24 18:23:43 IST ERROR: relation "public.gt_pk_metadata" does not exist at character 15 2013-10-25 06:15:31 IST LOG: unexpected EOF on client connection kind of errors in postgresql log.
– Ramesh T ROct 25 '13 at 6:32

how about if you just connect both servers (ie. their power capabilities) first and then use one to do all the stuff? Wouldn't be that easier? Btw, are you using windows or Linux? based on that errors, I'd think that PostgreSQL doesn't understand that there are two servers, or have to share its information, but if it does, then apache is not helping at all.
– GeryOct 25 '13 at 6:37

I'm using 2 Windows Server. if i stop tomcat in Server1 then there is no problem. Postgresql connection count is normal . Bt if i restart Server1 tomcat then suddenly the connections will increase.
– Ramesh T ROct 25 '13 at 6:39

That time i'm getting "unexpected EOF on client connection" this errors only in postgresql log
– Ramesh T ROct 25 '13 at 6:45