Re: MVCC and Implications for (Near) Real-Time Application

Поиск
Список
Период
Сортировка
От Pierre C
Тема Re: MVCC and Implications for (Near) Real-Time Application
Дата
Msg-id op.vlctrxpjeorkce@apollo13
обсуждение исходный текст
Ответ на MVCC and Implications for (Near) Real-Time Application  (Steve Wong <powerpchead@yahoo.com>)
Список pgsql-performance
> My questions are: (1) Does the MVCC architecture introduce significant
> delays between insert by a thread and visibility by other threads

As said by others, once commited it is immediately visible to all

> (2) Are there any available benchmarks that can measure this delay?

Since you will not be batching INSERTs, you will use 1 INSERT per
transaction.
If you use Autocommit mode, that's it.
If you don't, you will get a few extra network roundtrips after the
INSERT, to send the COMMIT.

One INSERT is usually extremely fast unless you're short on RAM and the
indexes that need updating need some disk seeking.

Anyway, doing lots of INSERTs each in its own transaction is usually very
low-throughput, because at each COMMIT, postgres must always be sure that
all the data is actually written to the harddisks. So, depending on the
speed of your harddisks, each COMMIT can take up to 10-20 milliseconds.

On a 7200rpm harddisk, it is absolutely impossible to do more than 7200
commits/minute if you want to be sure each time that the data really is
written on the harddisk, unless :

- you use several threads (one disk write can group several commits from
different connections, see the config file docs)
- you turn of synchronous_commit ; in this case commit is instantaneous,
but if your server loses power or crashes, the last few seconds of data
may be lost (database integrity is still guaranteed though)
- you use a battery backup cache on your RAID controller, in this case
"written to the harddisks" is replaced by "written to batteyr backed RAM"
which is a lot faster

If you dont use battery backed cache, place the xlog on a different RAID1
array than the tables/indexes, this allows committing of xlog records
(which is the time critical part) to proceed smoothly and not be disturbed
by other IO on the indexes/tables. Also consider tuning your bgwriter and
checkpoints, after experimentation under realistic load conditions.

So, when you benchmark your application, if you get disappointing results,
think about this...

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

Предыдущее
От: david@lang.hm
Дата:
Сообщение: Re: BBU Cache vs. spindles
Следующее
От: James Mansion
Дата:
Сообщение: Re: BBU Cache vs. spindles