Today if i login into g-mail.after 3-4 days also i could see my account without logout. If everybody in this world do same thing,maintaining connections in a pool becomes difficult(may be because of Memory constraints).So if an account is idle after 2-3 days i think it is better to disconnect (disconnected one can be used for new connection).How long time(days) g-mail user can maintain connection with server if he doesn't logout.Can somebody explain this process of connecting to website , maintaining connection and connection pooling mechanism ?
You seem to be misunderstanding one thing. The web (in general) doesn't use actual persistent TCP connections, it uses a request and response methodology. The actual connection gets closed after the request and response have been exchanged (or a short while after). The thing that looks like a "connection" is just a unique session token Google has given to you to identify your "connection". And that's as expensive as having a row in a database, that is, not expensive at all.
(Let's try not to get into a big confusing debate about whether packet switched networks ever have anything that could be called a persistent connection.)
Every minute or so, the web page your are in (gmail) is requesting for an update (new mails for example) on the Google's load balancer servers. Since you do it frequently, your session on their servers stay alive.
Since you are "disconnected" form the web server as soon as you received the response, the session is maintained in their database using a record referencing an id that is also stored in a cookie on your local machine. (please read Matti's response to avoid confusion with TCP connections)
To answer the question, how they handle the load ? The request you do each minute is very small, and the response too. Compared to a google search for example. For the session, it's a single line in their databases, which if few bytes... compared to the 7 giga bytes they provide to all their users, it's nothing.
Further reference:
http://en.wikipedia.org/wiki/Http_session#Web_server_session_management