zheap: a new storage format for PostgreSQL
Sometime back Robert has proposed a solution to reduce the bloat in
PostgreSQL [1]https://github.com/EnterpriseDB/zheap which has some other advantages of its own as well. To
recap, in the existing heap, we always create a new version of a tuple on
an update which must eventually be removed by periodic vacuuming or by
HOT-pruning, but still in many cases space is never reclaimed completely.
A similar problem occurs for tuples that are deleted. This leads to bloat
in the database.
At EnterpriseDB, we (me and some of my colleagues) are working from more
than a year on the new storage format in which only the latest version of
the data is kept in main storage and the old versions are moved to an undo
log. We call this new storage format "zheap". To be clear, this proposal
is for PG-12. The purpose of posting this at this stage is that it can
help as an example to be integrated with pluggable storage API patch and to
get some early feedback on the design. The purpose of this email is to
introduce the overall project, however, I think going forward, we need to
discuss some of the subsystems (like Indexing, Tuple locking, Vacuum for
non-delete-marked indexes, Undo Log Storage, Undo Workers, etc. ) in
separate threads.
The three main advantages of this new format are:
1. Provide better control over bloat (a) by allowing in-place updates in
common cases and (b) by reusing space as soon as a transaction that has
performed a delete or non-in-place-update has committed. In short, with
this new storage, whenever possible, we’ll avoid creating bloat in the
first place.
2. Reduce write amplification both by avoiding rewrites of heap pages (for
setting hint-bits, freezing, etc.) and by making it possible to do an
update that touches indexed columns without updating every index.
3. Reduce the tuple size by (a) shrinking the tuple header and (b)
eliminating most alignment padding.
You can check README.md in the project folder [1]https://github.com/EnterpriseDB/zheap to understand how to use
it and also what are the open issues. The detailed design of the project is
present at src/backend/access/zheap/README. The code for this project is
being developed in Github repository [1]https://github.com/EnterpriseDB/zheap. You can also read about this
project from Robert's recent blog [2]http://rhaas.blogspot.in/2018/01/do-or-undo-there-is-no-vacuum.html. I have also added few notes on
integration with pluggable API on zheap wiki page [3]https://wiki.postgresql.org/wiki/Zheap#Integration_with_ Pluggable_Storage_API.
Preliminary performance results
-------------------------------------------
*We’ve shown the performance improvement of zheap over heap in a few
different pgbench scenarios. All of these tests were run with data that
fits in shared_buffers (32GB), and 16 transaction slots per zheap page.
Scenario-1 and Scenario-2 has used synchronous_commit = off and Scenario-3
and Scenario-4 has used synchronous_commit = onScenario 1: A 15 minutes
simple-update pgbench test with scale factor 100 shows 5.13% TPS
improvement with 64 clients. The performance improvement increases as we
increase the scale factor; at scale factor 1000, it reaches11.5% with 64
clients.Scale FactorHEAPZHEAP (tables)*ImprovementBefore test1001281 MB1149
MB-10.3%100013 GB11 GB-15.38%After test1004.08 GB3 GB-26.47%100015 GB12.6
GB-16%* The size of zheap tables increase because of the insertions in
pgbench_history table.Scenario 2: To show the effect of bloat, we’ve
performed another test similar to the previous scenario, but a transaction
is kept open for the first 15 minutes of a 30-minute test. This restricts
HOT-pruning for the heap and undo-discarding for zheap for the first half
of the test. Scale factor 1000 - 75.86% TPS improvement for zheap at 64
client count. Scale factor 3000 - 98.18% TPS improvement for zheap at 64
client count.Scale FactorHEAPZHEAP (tables)*ImprovementAfter test100019
GB14 GB-26.3%300045 GB37 GB-17.7%* The size of zheap tables increase
because of the insertions in pgbench_history table.The reason for this huge
performance improvement is that when the long-running transaction gets
committed after 900 seconds, autovacuum workers start working and degrade
the performance of heap for a long time. In addition, the heap tables are
also bloated by a significant amount. On the other hand, the undo worker
discards the undo very quickly, and we don't have any bloat in the zheap
relations. In brief, zheap clusters the bloats in undo segments. We just
need to determine the how much undo can be discarded and remove it, which
is cheap.Scenario 3: A 15 minutes simple-update pgbench test with scale
factor 100 shows 6% TPS improvement with 64 clients. The performance
improvement increases as we increase the scale factor to 1000 achieving
11.8% with 64 clients.Scale FactorHEAPZHEAP (tables)*ImprovementBefore
test1001281 MB1149 MB-10.3%100013 GB11 GB-15.38%After test1002.88 GB2.20
GB-23.61%100013.9 GB11.7 GB-15.8%* The size of zheap tables increase
because of the insertions in pgbench_history table.Scenario 4: To amplify
the effect of bloats in scenario 3, we’ve performed another test similar to
scenario, but a transaction is kept open for the first 15 minutes of a 30
minute test. This restricts HOT-pruning for heap and undo-discarding for
zheap for the first half of the test.Scale FactorHEAPZHEAP
(tables)*ImprovementAfter test100015.5 GB12.4 GB-20%300040.2 GB35 GB-12.9%*
Pros
--------
1. Zheap has better performance characteristics as it is smaller in size
and it has an efficient mechanism to discard undo in the background which
is cheaper than HOT-pruning.
2. The performance improvement is huge in cases where heap bloats and
zheap bloats
the undo.
3. We will also see a good performance boost for the cases where UPDATE
statement updates few indexed columns.
4. The system slowdowns due to Vacuum (or Autovacuum) would be reduced to a
great extent.
5. Due to fewer rewrites of the heap (like is no freezing, hot-pruning,
hint-bits etc), the overall writes and the WAL volume will be lesser.
Cons
-----------
1. Deletes can be somewhat expensive.
2. Transaction aborts will be expensive.
3. Updates that update most of the indexed columns can be somewhat
expensive.
Credits
------------
Robert did much of the basic design work. The design and development of
various subsystems of zheap have been done by a team comprising of me,
Dilip Kumar, Kuntal Ghosh, Mithun CY, Ashutosh Sharma, Rafia Sabih, Beena
Emerson, and Amit Khandekar. Thomas Munro wrote the undo storage system.
Marc Linster has provided unfailing management support, and Andres Freund
has provided some design input (and criticism). Neha Sharma and Tushar
Ahuja are helping with the testing of this project.
[1]: https://github.com/EnterpriseDB/zheap
[2]: http://rhaas.blogspot.in/2018/01/do-or-undo-there-is-no-vacuum.html
[3]: https://wiki.postgresql.org/wiki/Zheap#Integration_with_ Pluggable_Storage_API
Pluggable_Storage_API
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
On Thu, Mar 1, 2018 at 7:39 PM, Amit Kapila <amit.kapila16@gmail.com> wrote:
Preliminary performance results
-------------------------------------------
I have not used plain text mode in my previous email due to which
performance results might not be clear in some email clients, so
attaching it again in the form of pdf.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
Attachments:
Cons
-----------
1. Deletes can be somewhat expensive.
2. Transaction aborts will be expensive.
3. Updates that update most of the indexed columns can be somewhat expensive.
Given transaction aborts are expensive, is there any impact on the crash recovery? Did you perform any tests on the recovery duration?
Thanks,
Satya
________________________________
From: Amit Kapila <amit.kapila16@gmail.com>
Sent: Thursday, March 1, 2018 7:05:12 AM
To: PostgreSQL Hackers
Subject: Re: zheap: a new storage format for PostgreSQL
On Thu, Mar 1, 2018 at 7:39 PM, Amit Kapila <amit.kapila16@gmail.com> wrote:
Preliminary performance results
-------------------------------------------
I have not used plain text mode in my previous email due to which
performance results might not be clear in some email clients, so
attaching it again in the form of pdf.
On 01.03.2018 16:30, Satyanarayana Narlapuram wrote:
Given transaction aborts are expensive, is there any impact on the crash
recovery?
In InnoDB/XtraDB, which has used the "move old row versions to UNDO log"
since the very beginning, rollbacks are indeed costly, and especially
so on recovery when the UNDO log pages are not yet cached in RAM.
There's is a cost trade of between this kind of "optimistic MVCC" and
rollback/recovery that one has to be aware of.
We get support issues about this at MariaDB every once in a while, but
it is not happening that often.
I can dig up some more info on this from the InnoDB side if you are
interested ...
--
hartmut
On Thu, Mar 1, 2018 at 9:00 PM, Satyanarayana Narlapuram
<Satyanarayana.Narlapuram@microsoft.com> wrote:
Cons
-----------
1. Deletes can be somewhat expensive.
2. Transaction aborts will be expensive.
3. Updates that update most of the indexed columns can be somewhat
expensive.Given transaction aborts are expensive, is there any impact on the crash
recovery?
I don't think there should be any direct impact of aborts on recovery
time as we start processing the undo records after recovery is done.
Basically, we invoke undo worker after recovery which performs the
aborts in the background.
Did you perform any tests on the recovery duration?
Not yet, but I think we will do it after making some more progress.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
On Thu, Mar 1, 2018 at 5:09 PM, Amit Kapila <amit.kapila16@gmail.com> wrote:
Preliminary performance results
-------------------------------------------*We’ve shown the performance improvement of zheap over heap in a few
different pgbench scenarios. All of these tests were run with data that
fits in shared_buffers (32GB), and 16 transaction slots per zheap page.
Scenario-1 and Scenario-2 has used synchronous_commit = off and Scenario-3
and Scenario-4 has used synchronous_commit = on*
What hardware did you use for benchmarks?
Also, I note that you have 4 transaction slots per zheap page in github
code while you use 16 in benchmarks.
#define MAX_PAGE_TRANS_INFO_SLOTS 4
I would also note that in the code you preserve only 3 bits for transaction
slot number. So, one have to redefine 3 macros to change transaction slot
number to the value you used in the benchmarks.
#define ZHEAP_XACT_SLOT 0x3800 /* 3 bits (12, 13 and 14) for transaction
slot */
#define ZHEAP_XACT_SLOT_MASK 0x000B /* 11 - mask to retrieve transaction
slot */
I'm only starting reviewing this, but it makes me think that we need
transaction slots number to be tunable (or even auto-tunable).
BTW, last two macros don't look properly named for me. I would rather
rename them in a following way:
ZHEAP_XACT_SLOT_MASK => ZHEAP_XACT_SLOT_OFFSET
ZHEAP_XACT_SLOT => ZHEAP_XACT_SLOT_MASK
*Scenario 1: A 15 minutes simple-update pgbench test with scale factor 100
shows 5.13% TPS improvement with 64 clients. The performance improvement
increases as we increase the scale factor; at scale factor 1000, it
reaches11.5% with 64 clients.Scale FactorHEAPZHEAP
(tables)*ImprovementBefore test1001281 MB1149 MB-10.3%100013 GB11
GB-15.38%After test1004.08 GB3 GB-26.47%100015 GB12.6 GB-16%* The size of
zheap tables increase because of the insertions in pgbench_history table.*
I think results representation should be improved. You show total size of
the database, but it's hard to understand how bloat degree was really
decreased, assuming that there are both update and append-only tables. So,
I propose to show the results in per table manner.
What is total number of transactions processed in both cases? It would be
also more fair to compare sizes for the same number of processed
transactions.
Also, what are index sizes? What are undo log sizes for zheap?
I also suggest to use Zipfian distribution in testing. It's more close to
real world workloads. And it would be a good stress test for both HOT and
transaction slots.
------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
On Fri, Mar 2, 2018 at 2:42 AM, Alexander Korotkov <
a.korotkov@postgrespro.ru> wrote:
On Thu, Mar 1, 2018 at 5:09 PM, Amit Kapila <amit.kapila16@gmail.com>
wrote:Preliminary performance results
-------------------------------------------*We’ve shown the performance improvement of zheap over heap in a few
different pgbench scenarios. All of these tests were run with data that
fits in shared_buffers (32GB), and 16 transaction slots per zheap page.
Scenario-1 and Scenario-2 has used synchronous_commit = off and Scenario-3
and Scenario-4 has used synchronous_commit = on*What hardware did you use for benchmarks?
Also, I note that you have 4 transaction slots per zheap page in github
code while you use 16 in benchmarks.
#define MAX_PAGE_TRANS_INFO_SLOTS 4
I would also note that in the code you preserve only 3 bits for
transaction slot number. So, one have to redefine 3 macros to change
transaction slot number to the value you used in the benchmarks.#define ZHEAP_XACT_SLOT 0x3800 /* 3 bits (12, 13 and 14) for transaction
slot */
#define ZHEAP_XACT_SLOT_MASK 0x000B /* 11 - mask to retrieve transaction
slot */I'm only starting reviewing this, but it makes me think that we need
transaction slots number to be tunable (or even auto-tunable).
Yeah, that is the plan. So, the idea is that for now we will give compile
time option to configure the number of slots (the patch for the same is
ready, currently we are testing it), later we can even give the option to
user at relation level or whatever we decides. Why I think it makes sense
to give an option at relation level is that for larger relations, we can do
with very few transaction slots considering that the chances of many
transactions operating on the same page are less, it is only for smaller
relations that we need more number of slots. OTOH, there could be
workloads where we can expect many concurrent transactions on the same
page. However, for now if you want to test, the patch to increase
transaction slots is attached, you need to change the value of few macros
according to the number of slots you want.
BTW, last two macros don't look properly named for me. I would rather
rename them in a following way:
ZHEAP_XACT_SLOT_MASK => ZHEAP_XACT_SLOT_OFFSET
How about ZHEAP_XACT_SLOT_SHIFT? I see similar things named with *_SHIFT
suffix in code .
ZHEAP_XACT_SLOT => ZHEAP_XACT_SLOT_MASK
makes sense. I will change it.
*Scenario 1: A 15 minutes simple-update pgbench test with scale factor
100 shows 5.13% TPS improvement with 64 clients. The performance
improvement increases as we increase the scale factor; at scale factor
1000, it reaches11.5% with 64 clients.Scale FactorHEAPZHEAP
(tables)*ImprovementBefore test1001281 MB1149 MB-10.3%100013 GB11
GB-15.38%After test1004.08 GB3 GB-26.47%100015 GB12.6 GB-16%* The size of
zheap tables increase because of the insertions in pgbench_history table.*I think results representation should be improved. You show total size of
the database, but it's hard to understand how bloat degree was really
decreased, assuming that there are both update and append-only tables. So,
I propose to show the results in per table manner.
Fair enough, Kuntal has done this testing. He will share the results as
you have requested.
What is total number of transactions processed in both cases? It would be
also more fair to compare sizes for the same number of processed
transactions.Also, what are index sizes? What are undo log sizes for zheap?
There shouldn't be any change in the index sizes and by the end of tests
undo is completely discarded. I think to see the impact of undo size, we
need some different tests where in we can keep the transaction open till
end of test or some such.
I also suggest to use Zipfian distribution in testing. It's more close to
real world workloads. And it would be a good stress test for both HOT and
transaction slots.
Yeah, we can do such tests, but keep in mid this code is still a work in
progress and lot of things are going to change and till now we have not
done much optimization in the code to improve the performance numbers.
Thanks a lot for showing interest in this work!
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
Attachments:
increase_slots_15.patchapplication/octet-stream; name=increase_slots_15.patchDownload
diff --git a/src/include/access/zheap.h b/src/include/access/zheap.h
index f463543..e9149bf 100644
--- a/src/include/access/zheap.h
+++ b/src/include/access/zheap.h
@@ -22,7 +22,7 @@
#include "utils/rel.h"
#include "utils/snapshot.h"
-#define MAX_PAGE_TRANS_INFO_SLOTS 4
+#define MAX_PAGE_TRANS_INFO_SLOTS 14
/*
* We need tansactionid and undo pointer to retrieve the undo information
diff --git a/src/include/access/zhtup.h b/src/include/access/zhtup.h
index 4dec7d7..2bb63f3 100644
--- a/src/include/access/zhtup.h
+++ b/src/include/access/zhtup.h
@@ -25,7 +25,7 @@
/* valid values for transaction slot is between 0 and MAX_PAGE_TRANS_INFO_SLOTS */
#define InvalidXactSlotId (-1)
/* we use frozen slot to indicate that the tuple is all visible now */
-#define ZHTUP_SLOT_FROZEN 0x007
+#define ZHTUP_SLOT_FROZEN 0x00F
/*
* Heap tuple header. To avoid wasting space, the fields should be
@@ -87,7 +87,7 @@ typedef ZHeapTupleData *ZHeapTuple;
* information stored in t_infomask2:
*/
#define ZHEAP_NATTS_MASK 0x07FF /* 11 bits for number of attributes */
-#define ZHEAP_XACT_SLOT 0x3800 /* 3 bits (12, 13 and 14) for transaction slot */
+#define ZHEAP_XACT_SLOT 0x7800 /* 4 bits (12, 13, 14 and 15) for transaction slot */
#define ZHEAP_XACT_SLOT_MASK 0x000B /* 11 - mask to retrieve transaction slot */
I think it was impolite to post this on the very same day the commitfest
started. We have enough patches as it is ...
--
�lvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
On 02/03/18 16:53, Alvaro Herrera wrote:
I think it was impolite to post this on the very same day the commitfest
started. We have enough patches as it is ...
To be fair - he did say things like "wanting feedback..." and "shows an
example of using pluggable storage.." and for PG 12. If he held onto the
patches and waited - he'd get criticism of the form "you should have
given a heads up earlier...".
This is earlier :-)
Best wishes
Mark
P.s: awesome work.
Hello Amit,
At EnterpriseDB, we (me and some of my colleagues) are working from more
than a year on the new storage format in which only the latest version of
the data is kept in main storage and the old versions are moved to an undo
log. [...]
This looks more than great!
*We’ve shown the performance improvement of zheap over heap in a few
different pgbench scenarios. [...]
2. Transaction aborts will be expensive.
ISTM that some scenarii should also test the performance impact when the
zheap storage is expected to be worse than the heap storage, i.e. with
some rollback which will exercise the undo stuff. There does not seem to
be any in your report, I apologise if I misread it.
I would suggest that you can use pgbench scripts such as:
-- commit.sql
\set aid random(1, 100000 * :scale)
BEGIN;
UPDATE pgbench_accounts
SET abalance = abalance + 1
WHERE aid = :aid;
COMMIT;
and
-- rollback.sql
\set aid random(1, 100000 * :scale)
BEGIN;
UPDATE pgbench_accounts
SET abalance = abalance + 1
WHERE aid = :aid;
ROLLBACK;
that can run with various weights to change how much rollback is injected,
eg 1% rollback rate is achieved with:
pgbench -T 10 -P 1 -M prepared -r \
-f SQL/commit.sql@99 -f SQL/rollback.sql@1
Also, I would be wary of doing only max speed test, and consider more
realistic --rate tests where the tps is fixed.
--
Fabien.
From: Amit Kapila [mailto:amit.kapila16@gmail.com]
At EnterpriseDB, we (me and some of my colleagues) are working from more
than a year on the new storage format in which only the latest version of
the data is kept in main storage and the old versions are moved to an undo
log. We call this new storage format "zheap". To be clear, this proposal
is for PG-12.
Wonderful! BTW, what "z" stand for? Ultimate?
Credits
------------
Robert did much of the basic design work. The design and development of
various subsystems of zheap have been done by a team comprising of me, Dilip
Kumar, Kuntal Ghosh, Mithun CY, Ashutosh Sharma, Rafia Sabih, Beena Emerson,
and Amit Khandekar. Thomas Munro wrote the undo storage system. Marc
Linster has provided unfailing management support, and Andres Freund has
provided some design input (and criticism). Neha Sharma and Tushar Ahuja
are helping with the testing of this project.
What a gorgeous star team!
Below are my first questions and comments.
(1)
This is a pure simple question from the user's perspective. What kind of workloads would you recommend zheap and heap respectively? Are you going to recommend zheap for all use cases, and will heap be deprecated? I think we need to be clear on this in the manual, at least before the final release.
I felt zheap would be better for update-intensive workloads. Then, how about insert-and-read-mostly databases like a data warehouse? zheap seems better for that, since the database size is reduced. Although data loading may generate more transaction logs for undo, that increase is offset by the reduction of the tuple header in WAL.
zheap allows us to run long-running analytics and reporting queries simultaneously with updates without the concern on database bloat, so zheap is a way toward HTAP, right?
(2)
Can zheap be used for system catalogs? If yes, we won't be bothered with system catalog bloat, e.g. as a result of repeated creation and deletion of temporary tables.
(3)
Scenario 1: A 15 minutes simple-update pgbench test with scale factor 100
shows 5.13% TPS improvement with 64 clients. The performance improvement
increases as we increase the scale factor; at scale factor 1000, it
reaches11.5% with 64 clients.
What was the fillfactor? What would be the comparison when HOT works effectively for heap?
(4)
"Undo logs are not yet crash-safe. Fsync and some recovery details are yet to be implemented."
"We also want to make FSM crash-safe, since we can’t count on
VACUUM to recover free space that we neglect to record."
Would these directly affect the response time of each transaction? Do you predict that the performance difference will get smaller when these are implemented?
)5)
"The tuple header is reduced from 24 bytes to 5 bytes (8 bytes with alignment):
2 bytes each for informask and infomask2, and one byte for t_hoff. I think we
might be able to squeeze some space from t_infomask, but for now, I have kept
it as two bytes. All transactional information is stored in undo, so fields
that store such information are not needed here."
"To check the visibility of a
tuple, we fetch the transaction slot number stored in the tuple header, and
then get the transaction id and undo record pointer from transaction slot."
Where in the tuple header is the transaction slot number stored?
(6)
"As of now, we have four transaction slots per
page, but this can be changed. Currently, this is a compile-time option; we
can decide later whether such an option is desirable in general for users."
"The one known problem with the fixed number of slots is that
it can lead to deadlock, so we are planning to add a mechanism to allow the
array of transactions slots to be continued on a separate overflow page. We
also need such a mechanism to support cases where a large number of
transactions acquire SHARE or KEY SHARE locks on a single page."
I wish for this. I was bothered with deadlocks with Oracle and had to tune INITRANS with CREATE TABLE. The fixed number of slots introduces a new configuration parameter, which adds something the DBA has to be worried about and monitor a statistics figure for tuning.
(7)
What index AMs does "indexes which lack delete-marking support" apply to?
Can we be freed from vacuum in a typical use case where only zheap and B-tree indexes are used?
(8)
How does rollback after subtransaction rollback work? Does the undo of a whole transaction skip the undo of the subtransaction?
(9)
Will the prepare of 2pc transactions be slower, as they have to safely save undo log?
Regards
Takayuki Tsunakawa
On Fri, Mar 2, 2018 at 9:23 AM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
I think it was impolite to post this on the very same day the commitfest
started. We have enough patches as it is ...
I can understand your concern, but honestly, I have no intention to
hinder the current commit fest work. We are preparing to post this
for more than a month, but it took some time to finish the
documentation and to fix some other issues. I could have posted this
after the CF as well, but I was not sure if there is any benefit in
delaying, because, at this stage, we are not expecting much of code
review, but some feedback on high-level design and I think it can
certainly help pluggable API project. I think the chances of getting
pluggable API in this release is remote, but maybe we can get some
small portion of it.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
On Fri, Mar 2, 2018 at 9:29 AM, Mark Kirkwood
<mark.kirkwood@catalyst.net.nz> wrote:
On 02/03/18 16:53, Alvaro Herrera wrote:
I think it was impolite to post this on the very same day the commitfest
started. We have enough patches as it is ...To be fair - he did say things like "wanting feedback..." and "shows an
example of using pluggable storage.." and for PG 12. If he held onto the
patches and waited - he'd get criticism of the form "you should have given a
heads up earlier...".P.s: awesome work.
Thanks.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
On Fri, Mar 2, 2018 at 1:35 PM, Fabien COELHO <coelho@cri.ensmp.fr> wrote:
Hello Amit,
At EnterpriseDB, we (me and some of my colleagues) are working from more
than a year on the new storage format in which only the latest version of
the data is kept in main storage and the old versions are moved to an undo
log. [...]This looks more than great!
Thanks.
*We’ve shown the performance improvement of zheap over heap in a few
different pgbench scenarios. [...]2. Transaction aborts will be expensive.
ISTM that some scenarii should also test the performance impact when the
zheap storage is expected to be worse than the heap storage, i.e. with some
rollback which will exercise the undo stuff. There does not seem to be any
in your report, I apologise if I misread it.
No, there isn't any. One idea, we have to mitigate this cost is to
allow rollbacks to happen in the background. Currently, the patch for
the same is being worked upon.
I would suggest that you can use pgbench scripts such as:
-- commit.sql
\set aid random(1, 100000 * :scale)
BEGIN;
UPDATE pgbench_accounts
SET abalance = abalance + 1
WHERE aid = :aid;
COMMIT;and
-- rollback.sql
\set aid random(1, 100000 * :scale)
BEGIN;
UPDATE pgbench_accounts
SET abalance = abalance + 1
WHERE aid = :aid;
ROLLBACK;that can run with various weights to change how much rollback is injected,
eg 1% rollback rate is achieved with:pgbench -T 10 -P 1 -M prepared -r \
-f SQL/commit.sql@99 -f SQL/rollback.sql@1Also, I would be wary of doing only max speed test, and consider more
realistic --rate tests where the tps is fixed.
Your suggestions are good, we will try to do some tests based on these
ideas after making some more progress in the Rollbacks (there is some
pending work in Rollbacks as mentioned in README.md).
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
On Fri, Mar 2, 2018 at 2:42 AM, Alexander Korotkov
<a.korotkov@postgrespro.ru> wrote:
I think results representation should be improved. You show total size of the database, but it's hard to understand how bloat degree was really decreased, assuming that there are both update and append-only tables. So, I propose to show the results in per table manner.
What is total number of transactions processed in both cases? It would be also more fair to compare sizes for the same number of processed transactions.
Also, what are index sizes? What are undo log sizes for zheap?
I've added the table sizes and TPS in the performance results. As of
now, we've just performed stress testing using pgbench. We've plans
for performing other tests including:
1. Introduce random delay in the transactions instead of keeping a
transaction open for 15 minutes.
2. Combination of ROLLBACK and COMMIT (As suggested by Fabien)
3. PGbench tests for fixed number of transaction.
4. Modify the distribution (As suggested by Alexander Korotkov)
Do let me know if any other tests are required.
--
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com
Attachments:
zheap_perf_data_1.pdfapplication/pdf; name=zheap_perf_data_1.pdfDownload
%PDF-1.4
% ����
4
0
obj
<<
/Type
/Catalog
/Names
<<
/JavaScript
3
0
R
>>
/PageLabels
<<
/Nums
[
0
<<
/S
/D
/St
1
>>
]
>>
/Outlines
2
0
R
/Pages
1
0
R
>>
endobj
5
0
obj
<<
/Creator
(�� G o o g l e S h e e t s)
/Title
()
>>
endobj
6
0
obj
<<
/Type
/Page
/Parent
1
0
R
/MediaBox
[
0
0
792
612
]
/Contents
7
0
R
/Resources
8
0
R
/Annots
10
0
R
/Group
<<
/S
/Transparency
/CS
/DeviceRGB
>>
>>
endobj
7
0
obj
<<
/Filter
/FlateDecode
/Length
9
0
R
>>
stream
x��\mo�^@lD��j9E?8@�T�})�
d���:�,YI�E�Dti��?��+9�Y�p�;���&������C�9\��4�e��w��&/�������l��P5�����e��C�����]5�������T����mbz�Q�KU�uM��PW� �WL���m�#P��������9�V�� �Y[JdZ������P���em��d�������r�Q�����������B����!�+zT�i+�i��Fy����2�d�������|�e`[pj����M�#�A���%�f4Y� Q]e����Ep��R,&��|u������5���.A#����\D
��#.���Id�z��M�#�MV��5��a3�,����zCaK�"8YMUq���E��G"j�(6��\��Rv�su%�����������:����q�yn�jK��K��h���A%�7+����xv$���XI���N�h1e���D����� ]pI5���<n��[L[�2�Z�Y��V]����������f�V"j��Y�Qhi�9�[JdZ�f���U#r�����>@)�])������De���Ue�������R"j�V]�L[�\�|4e���d����\%��(��y��d�B�:^l)�i��:�-D�k<��{��r�<2��
�A�u�?�����w�����{r���Y��dF���1��Gh:�l�+�R�.��ns+�Q���=����3�^�q�q�wv�Yf ��R�:w��l����tlF��K�����:��n�I�9��vl��Xg6@V�S����
c� 6G`�f�� �����~w�<s&��&�����-4/1E�n�g�$���#0�>g���Y�%f6�C"��d��`lB���J����tLgC� rk�t���*l�{��QRe�e@��%f��������`32�bX����|�=�s&��&���5�&/�K�W�K�q�
c� 6G`�-sn�?+1_A�n�g�$���#0��97����� p7�3g��n�m,pO������
# �N�v#d�+b�bh�O�C�8�w�1HP /A���hK�z�I�j��vlbF��������;��ss�e,�#�����I�����-�0g��n��a���g%f=Mc��N�V�M�9#���#�������� ��If� 6G`�6f���)���������#so:��` �fd���wi>L�vKm7�blh��R�A$]:f�TbS@e��oK�zlR��'�f�vlbCO����`��������Ny�)���W`��5�j�� ��S��2����/���$O����k.����������L�{~�F��{��'�L��#Q.�����G� yw&<�0Oe����H��
��\=:�K�
kN�W�o�36F.�u}I�.�=%�%�,�S�g�<,������h.=��%��'�*���?#���Jv��W��*��!q���� q�7<��w[�����u#4���:�$�@�ZA������- �P�NPv|����K������=M��.-G����j&h
�L��a�heR3C�!�}��c��9�d� ��rHW���C\���e-z;��u~���q s���/|�2����]�I��:�-�H+{����������Y&z;��Y~C�0Jr�����)|���.����2/�:�$V���]5 %9����}����DC4a};�o���r�/ezd}���S�f~�7�DS�sR.o!G0�L���q/�F'��2Ns|f����b��
q��7�AMf��������t �6cS�k�w|��=��g|U;����s����Z�/�����������oS��_<�=Bmo� �����g��H���d��s����1�3ND���q""�2+'"�DD���q"8�Ns�S1���/
��(���8k������q""ND���8��>;"�DD���8��#"N���������8����S��,'"�DD���q""N�]����8��#"ND�����.���U�N�5_O����B-m�6K �J5*��/�Y%B4�{�� ��0�����D%@{\�E%@k~�_:�w@�+���9/y%B~��+��:��+k�?����m�{�B���U"�]�����=��p�,���c^Y�L\�]��M�{vB�����J����+��?(�q/GKW��XW�Ce)���B�p5������*���:�J�~)�F��Q�#��!qTr�F�q�Du���!N�J�,�� ������%��L�������o~N?;�����������w�M[8Ju��.�2O��U��o��&H^$�I�T��u�*�H�J�U��*��.��Ur�~�J�H�U� �~������~�>���������}�Zl�W�d;�1���T�����\�v
�j��L^&� ���Z�@������N���O�����r_��o��V}6�����o`���[�}���4���P{��~���!}�&�����<WS�5E���J�xZ��m]�k�\?���s���A��~��&;������A����F���S_�/���D!��s��kUB-\�9�3{���TH�B��������kw`=�
��s���L�q���_.�"�&e#������C����U]����Z���P{�Osj���s<�������Q�HL�yOwC���yaJ�Hu=E8����i������L��N�^��N��������I.�t/���]�h\YS ]g�&Q<=�G����W��_��{��C���Fu7��6����V����!����K��W����kS���������(mD[���Lso{��������j���~�x�|�@x~��l�6U�Jo���A?g�-�T\>4����K�_x�1-�U\^�����'��m��G,�\�R��������&��A8��1���I��Z��j1+Z���D+��tm�{<���Q����
o��G�r��q����-����+t��Ky���8��YQ�y!4�ir�W^�q��s/�ju:�?�\'�4Xo����o�4J���]xFi��~b�8bR�=U�'�`�W�����>�O!�����]��.� =8���>��x��.�t��?�Rp���$l1V�Ug�����
�eVm���y��3����04��������������EQzF_��1� �����u�|��1W/��^c�^�<y�����&�U�z!����5a�sRM�����.�������f�Q���#��e����t�e]���%�L�f�c"^� L��i"-lGh����Z0�1��yxy7�����0�<��=a������'�_M���`�S����;�c���`o�n��zy�W�gW��[
(f�p`)����<_��p���a��z�u��@������7W?�e_'��"b���f's� ���yf��ZK����6�(K
(e��`>