Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Alexey Kondratov <a(dot)kondratov(at)postgrespro(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit
Date: 2020-11-19 12:27:14
Message-ID: CALj2ACW+PzzuqE6YOueNUi5Zek9XTv9P3FXdT4XF3-1JDk4RuA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 19, 2020 at 5:39 PM Alexey Kondratov
<a(dot)kondratov(at)postgrespro(dot)ru> wrote:
>
> >
> > By clearing the cache entry we will have 2 advantages: 1) we could
> > save a(small) bit of memory 2) we could allow new connections to be
> > cached, currently ConnectionHash can have only 8 entries. IMHO, along
> > with disconnecting, we can also clear off the cache entry. Thoughts?
> >
>
> IIUC, 8 is not a hard limit, it is just a starting size. ConnectionHash
> is not a shared-memory hash table, so dynahash can expand it on-the-fly
> as follow, for example, from the comment before hash_create():
>

Thanks! Yes this is true. I was wrong earlier. I verified that 8 is
not a hard limit.

>
> Also I am not sure that by doing just a HASH_REMOVE you will free any
> memory, since hash table is already allocated (or expanded) to some
> size. So HASH_REMOVE will only add removed entry to the freeList, I
> guess.
>
> Anyway, I can hardly imagine bloating of ConnectionHash to be a problem
> even in the case, when one has thousands of foreign servers all being
> accessed during a single backend life span.
>

Okay. I will not add the code to remove the entries from cache.

Here is how I'm making 4 separate patches:

1. new function and it's documentation.
2. GUC and it's documentation.
3. server level option and it's documentation.
4. test cases for all of the above patches.

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2020-11-19 13:05:35 Re: scram-sha-256 broken with FIPS and OpenSSL 1.0.2
Previous Message Alexey Kondratov 2020-11-19 12:09:42 Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit