Re: Postgres is using 100% CPU

Поиск
Список
Период
Сортировка
От Graeme B. Bell
Тема Re: Postgres is using 100% CPU
Дата
Msg-id 7EF5206B-3427-4349-A0A1-974862D61017@skogoglandskap.no
обсуждение исходный текст
Ответ на Postgres is using 100% CPU  (Ashik S L <ashiksl178@gmail.com>)
Ответы Re: Postgres is using 100% CPU  ("Graeme B. Bell" <grb@skogoglandskap.no>)
Список pgsql-performance
On Sun, May 31, 2015 at 7:53 PM, Yves Dorfsman <yves@zioup.com> wrote:

>> That's the thing, even on an old laptop with a slow IDE disk, 273
> individual
>> inserts should not take more than a second.
>

I think that would depend on settings such as synchronous_commit, commit_delay, or whether 2-phase commit is being
used. 

If synchronous commit is enabled and commit_delay was not used (e.g. 0), and you have a client synchronously making
individualinserts to the DB (1 transaction each), then surely you have delays due to waiting for each transaction to
commitsynchronously to WAL on disk?  

I believe yes / 0 are the default settings for synchronous commit and commit_delay. (Interestingly the manual pages do
notspecify.) 


Assuming a 5400RPM laptop drive (which is a typical drive - some laptop drives run < 5000RPM), and assuming you are
writinga sequential log to disk (with very short gaps between entries being added, e.g. no seek time, only rotational
latency)will mean 5400 transactions per minute, 1 write per rotation.  

That's a maximum 90 transactions per second synchronised to WAL. It would take just over 3 seconds.


Ashik, try altering your postgresql.conf to say 'commit_delay=100' or 'synchronous_commit=off'. Let us know if that
fixesthe problem. Read up on the options before you change them. 

Graeme Bell





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

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: Connection time when using SSL
Следующее
От: "Graeme B. Bell"
Дата:
Сообщение: Re: Postgres is using 100% CPU