Re: Postgres with pthread

Поиск
Список
Период
Сортировка
От Konstantin Knizhnik
Тема Re: Postgres with pthread
Дата
Msg-id 5e757775-630f-5a6a-978a-a240d64259c8@postgrespro.ru
обсуждение исходный текст
Ответ на Re: Postgres with pthread  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
Hi

On 06.12.2017 20:08, Andres Freund wrote:
>
> 4. Rewrite file descriptor cache to be global (shared by all threads).
> That one I'm very unconvinced of, that's going to add a ton of new
> contention.

Do you mean lock contention because of mutex I used to synchronize 
access to shared file descriptor cache
or contention for file descriptors?
Right now each thread has its own virtual file descriptors, so them are 
not shared between threads.
But there is common LRU, restricting total number of opened descriptors 
in the process.

Actually I have not other choice if I want to support thousands of 
connection.
If each thread has its own private descriptor cache (as it is now for 
processes) and its size is estimated base on open file quota,
then there will be millions of opened file descriptors.

Concerning contention for mutex, I do not think that it is a problem.
At least I have to say that performance (with 100 connections) is 
significantly improved and shows almost the same speed as for 10 
connections
after I have rewritten file descriptor can and made it global
(my original implementation just made all fd.c static variables as 
thread local, so each thread has its separate pool).

It is possible to go further and shared file descriptors between threads 
and use pwrite/pread instead of seek+read/write.
But we still need mutex to implement LRU l2list and free handler list.


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Konstantin Knizhnik
Дата:
Сообщение: Re: Postgres with pthread
Следующее
От: Konstantin Knizhnik
Дата:
Сообщение: Re: Postgres with pthread