From: | Mahi Gurram <teckymahi(at)gmail(dot)com> |
---|---|
To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
Cc: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Regarding Postgres Dynamic Shared Memory (DSA) |
Date: | 2017-05-24 06:09:38 |
Message-ID: | CAGg=GucojOQ6tzqUC1+Xq6oA0K2EXmj6yO6JjNS91FZPX-xBdQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
One solution that is striking me is....
1. I'll create one background worker and will initialise DSA in it.
2. If there are any callbacks available for client open/close connections,
i'll attach/detach to the DSA in those callbacks.
But i'm not sure there are such callbacks available. If such callbacks
exists in postgres and you guys know please help me out with that.
Thanks & Best Regards,
- Mahi
On Wed, May 24, 2017 at 11:32 AM, Mahi Gurram <teckymahi(at)gmail(dot)com> wrote:
> Hi,
>
> As Michael said, i'm creating DSA too early. Shared_Preload libraries are
> loading prior to memory related stuff.
>
> But i'm totally clueless how to solve my use case.
>
> Please help me with any work around.
>
> Thanks & Best Regards,
> - Mahi
>
> On Tue, May 23, 2017 at 5:52 PM, Mahi Gurram <teckymahi(at)gmail(dot)com> wrote:
>
>> Hi Michael,
>>
>> Thanks for your response.
>>
>> All i'm building is In-Memory Index as an extension over Postgres.
>>
>> Postgres Indexes will get Insert calls and Read calls from various
>> processes(typically client/connection process - forked processes to
>> postmaster process). Hence i have to maintain my In-Memory index in shared
>> memory.
>>
>> If i create DynamicSharedArea (DSA) in postmaster/main process, all these
>> Client/Connection processes(In-Memory Index Processes) need not attach to
>> that DSA using area handle. Because these are forked processes to
>> postmaster/Main process and hence they automatically gets attached.
>>
>> Hence i'm trying to create DSA in _PG_init function as it is called by
>> postmaster/main process.
>>
>> Hope this is clear.
>>
>> Thanks & Best Regards,
>> - Mahi
>>
>>
>> On Tue, May 23, 2017 at 5:30 PM, Michael Paquier <
>> michael(dot)paquier(at)gmail(dot)com> wrote:
>>
>>> On Tue, May 23, 2017 at 6:42 AM, Mahi Gurram <teckymahi(at)gmail(dot)com>
>>> wrote:
>>> > I'm building In-Memory index extension for Postgres, for which i'm
>>> trying to
>>> > use DSA. But ended with some issues, as it is not allowing me to create
>>> > DSA(Dynamic Shared Area) in _PG_init function.
>>> >
>>> > Please refer my_PG_init code below:
>>> >>
>>> >> void
>>> >> _PG_init(void)
>>> >> {
>>> >> area = dsa_create(LWLockNewTrancheId(), "CustomIndex_DSA");
>>> >> area_handle = dsa_get_handle(area);
>>> >> }
>>> >
>>> >
>>> > Because of this code, Postgres is not starting. Not even giving any
>>> error
>>> > messages in pg logs. Hence, i'm totally clue less :(
>>>
>>> It seems to me that you are creating those too early. For example, for
>>> a background worker process, DSA segments would likely be created in
>>> the main process routine. Without understanding what you are trying to
>>> achieve, it is hard to make a good answer. You could always use a
>>> ramdisk, but that would be likely be a waste of memory as Postgres has
>>> its own buffer pool, killing the performance gains of OS caching.
>>> --
>>> Michael
>>>
>>
>>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Fabien COELHO | 2017-05-24 07:14:14 | Re: pgbench more operators & functions |
Previous Message | Mahi Gurram | 2017-05-24 06:02:14 | Re: Regarding Postgres Dynamic Shared Memory (DSA) |