AntufeevMaksim opened a new pull request, #2510:
URL: https://github.com/apache/age/pull/2510
# agtype performance optimizations
all scenarious discussed below can be found here:
### replace binary search in find_agtype_value_from_container() with linear
for small objects.
##### Motivation / Problem:
In the current implementation of find_agtype_value_from_container, searching
for a key in an agtype object always uses binary search. For each probe during
the binary search, we must call get_agtype_offset(). This function walks
backwards through the container's entry array to find the nearest preceding
element with a stored absolute offset (AGTE_HAS_OFF), summing lengths along the
way.
#### Solution
Linear search is now used for objects with pair counts <=
AGTYPE_OBJECT_LINEAR_SEARCH_THRESHOLD (default: 8).
During linear search, key offsets are calculated incrementally by adding the
size of previous elements via AGTE_ADVANCE_OFFSET, completely eliminating
backward walks and repeated get_agtype_offset() calls.
MessageContentQuery [before]
<img width="1198" height="1046" alt="image-37"
src="https://github.com/user-attachments/assets/772fab03-a077-42bb-90ea-87fea53ec640"
/>
MessageContentQuery [after]
<img width="1200" height="1022" alt="image-38"
src="https://github.com/user-attachments/assets/ccd7ed3d-9e5f-4e0b-8a53-fd73998fc3c8"
/>
CreateKnowsMutation [before]
<img width="1198" height="1074" alt="image-39"
src="https://github.com/user-attachments/assets/a90c2179-2a3f-40a3-98b5-fc68515b17c2"
/>
CreateKnowsMutation [after]
<img width="1196" height="1026" alt="image-40"
src="https://github.com/user-attachments/assets/095a5b7c-38db-4e2a-b0c3-ff1e89986dfe"
/>
AddForumMemberMutation [before]
<img width="1072" height="1070" alt="image-41"
src="https://github.com/user-attachments/assets/55957646-040f-4e1b-b253-d4eeec29841c"
/>
AddForumMemberMutation [after]
<img width="1198" height="1034" alt="image-42"
src="https://github.com/user-attachments/assets/d7bc50be-afea-442f-b9c0-9151a30effcf"
/>
blue - before
orange - after
<img width="1000" height="500" alt="image-34"
src="https://github.com/user-attachments/assets/681ec2d5-16a9-4bcd-a91e-f28f2c8cf36d"
/>
<img width="1000" height="500" alt="image-35"
src="https://github.com/user-attachments/assets/47fb90aa-a68e-4209-b365-b8ce47104e55"
/>
<img width="1000" height="500" alt="image-35"
src="https://github.com/user-attachments/assets/df2c7897-19bc-4788-b575-d90f5d1c89b6"
/>
```diff
before
after
===================================== |
=====================================
AddForumMemberMutation |
AddForumMemberMutation
===================================== |
=====================================
- 109008 iterations | [
+2.16%]- 111368 iterations
- 3710 tps (overall) | [
+3.15%]- 3827 tps (overall)
- 3882 tps (last 5 sec) | [
+2.45%]- 3977 tps (last 5 sec)
- 3217420 ns average latency | [
+3.07%]- 3118775 ns average latency
peak mem: 329.1064453125kb | [
-0.15%]peak mem: 329.615234375kb
avg mem: 297.72008850524475kb | [
+1.26%]avg mem: 293.9697133657095kb
===================================== |
=====================================
CreateKnowsMutation |
CreateKnowsMutation
===================================== |
=====================================
- 72530 iterations | [
+1.70%]- 73766 iterations
- 2440 tps (overall) | [
+3.77%]- 2532 tps (overall)
- 2540 tps (last 5 sec) | [
+3.58%]- 2631 tps (last 5 sec)
- 4893768 ns average latency | [
+3.74%]- 4710979 ns average latency
peak mem: 324.822265625kb | [
-0.17%]peak mem: 325.361328125kb
avg mem: 292.7277922453704kb | [
-0.02%]avg mem: 292.7764400652985kb
===================================== |
=====================================
MessageContentQuery |
MessageContentQuery
===================================== |
=====================================
- 18970 iterations | [
+2.55%]- 19454 iterations
- 633 tps (overall) | [
+4.74%]- 663 tps (overall)
- 650 tps (last 5 sec) | [
+4.46%]- 679 tps (last 5 sec)
- 18899376 ns average latency | [
+4.53%]- 18043070 ns average latency
peak mem: 268.1611328125kb | [
-0.10%]peak mem: 268.4248046875kb
avg mem: 238.71351412259617kb | [
+0.25%]avg mem: 238.1108856201172kb
```
### Optimize agtype_access_operator by avoiding variadic array construction
#### Motivation / Problem:
extract_variadic_args() took around 50% of agtype_access_operator execution
time.
ExecEvalArrayExpr(), which is used to construct the variadic array, also
accounted
for a significant part of transaction execution time.
#### Solution
To avoid these overheads, we replace the original
agtype_access_operator(VARIADIC agtype[])
with
agtype_access_operator(VARIADIC "any")
This allows the function to be called in a non-variadic way. In
particular, Cypher property and map access expressions now pass their
arguments directly instead of constructing an agtype array.
#### Note
There is an important difference between VARIADIC agtype[] and
VARIADIC "any". With VARIADIC agtype[], PostgreSQL automatically packs
arguments passed using the regular function-call syntax into an
agtype[] array. With VARIADIC "any", this automatic conversion to an
agtype array is no longer available for the non-variadic call path.
Therefore, agtype_access_operator now performs the required type
conversion itself for non-agtype arguments.
The original behavior is preserved: arguments are still converted to
agtype before being processed, and the variadic path remains available
for calls where the number of arguments is not known in advance.
Regression tests were also updated because the function signature and
the generated expression trees have changed. Expected EXPLAIN output
now contains non-variadic agtype_access_operator calls instead of
VARIADIC ARRAY expressions.
CreateCommentMutationWhere [before]
<img width="1198" height="1072" alt="image-43"
src="https://github.com/user-attachments/assets/ae9f7224-0a82-4e52-a39c-2dfbd07ff5d9"
/>
CreateCommentMutationWhere [after]
<img width="1198" height="1072" alt="image-44"
src="https://github.com/user-attachments/assets/4245e9de-3c95-44eb-81d8-8beaa0135fbc"
/>
CreateForumWithTagsMutationWhere [before]
<img width="1198" height="1072" alt="image-45"
src="https://github.com/user-attachments/assets/94a294ed-5512-4417-8037-68f0599149c5"
/>
CreateForumWithTagsMutationWhere [after]
<img width="1198" height="1072" alt="image-46"
src="https://github.com/user-attachments/assets/fe5488d2-bb6d-4938-8a48-174abb6479e3"
/>
```diff
before
after
===================================== |
=====================================
CreateCommentMutationWhere |
CreateCommentMutationWhere
===================================== |
=====================================
- 5535 iterations |
[+33.53%]- 7391 iterations
- 188 tps (overall) |
[+30.85%]- 246 tps (overall)
- 177 tps (last 5 sec) |
[+30.51%]- 231 tps (last 5 sec)
- 63703815 ns average latency |
[+23.76%]- 48568704 ns average latency
peak mem: 712.134765625kb | [
-3.45%]peak mem: 736.71484375kb
avg mem: 471.55885074013156kb | [
-8.95%]avg mem: 513.7577865735619kb
|
===================================== |
=====================================
CreateForumWithTagsMutationWhere |
CreateForumWithTagsMutationWhere
===================================== |
=====================================
- 29875 iterations |
[+32.09%]- 39462 iterations
- 1026 tps (overall) |
[+29.82%]- 1332 tps (overall)
- 1069 tps (last 5 sec) |
[+30.40%]- 1394 tps (last 5 sec)
- 11623780 ns average latency |
[+22.84%]- 8969228 ns average latency
peak mem: 536.537109375kb | [
-1.27%]peak mem: 543.3642578125kb
avg mem: 440.198734642094kb | [
-3.06%]avg mem: 453.679234375kb
```
blue - before
orange - after
<img width="1000" height="500" alt="image-9"
src="https://github.com/user-attachments/assets/7e1b537e-0d74-464e-b8df-d1b7c01eb44b"
/>
<img width="1000" height="500" alt="image-10"
src="https://github.com/user-attachments/assets/3144eaf5-0b4a-4752-9651-ac2d8917e7b4"
/>
## Replace per-iterator heap allocation with an inline iterator stack backed
by dynamically allocated chunks.
#### Motivation / Problem:
agtype_iterator objects were previously allocated individually with palloc()
during traversal.
#### Solution
The first AGI_INLINE_ITERS (default 8) iterators are stored directly in
agtype_traversal using stack memory
When the traversal depth exceeds the inline capacity, additional iterators
are stored in dynamically allocated chunks.
The heap-based part of the stack is organized as a linked list of chunks
with exponentially increasing capacity. Once a chunk is allocated, it is kept
for the lifetime of the traversal and reused when the traversal reaches the
same depth again. This avoids repeated palloc()/pfree() calls when moving
between nested containers.
MessageAutorQuery [before]
<img width="1200" height="1074" alt="image-12"
src="https://github.com/user-attachments/assets/0039c987-c18d-4334-8ae2-536c45afadf9"
/>
MessageAutorQuery [after]
<img width="1198" height="1056" alt="image-13"
src="https://github.com/user-attachments/assets/34fc50b6-5a61-4c49-9bc5-a55be9e48bb4"
/>
blue - before
orange - after
<img width="1000" height="500" alt="image-14"
src="https://github.com/user-attachments/assets/0abbb097-6d93-4477-a51d-ebf725199248"
/>
<img width="1000" height="500" alt="image-15"
src="https://github.com/user-attachments/assets/31459e33-1941-49ee-8357-ea4b4afe33ae"
/>
<img width="1000" height="500" alt="image-16"
src="https://github.com/user-attachments/assets/f4b026cb-7d34-4509-94e8-905368a70aed"
/>
<img width="1000" height="500" alt="image-17"
src="https://github.com/user-attachments/assets/323f24f1-351c-4ff9-89b0-f09c9050635b"
/>
<img width="1000" height="500" alt="image-18"
src="https://github.com/user-attachments/assets/18ca1705-836e-4c70-aafd-a355cb2edc4c"
/>
<img width="1000" height="500" alt="image-19"
src="https://github.com/user-attachments/assets/38653e9c-0dbe-4479-a45b-8b82a338d5a8"
/>
<img width="1000" height="500" alt="image-20"
src="https://github.com/user-attachments/assets/577b9dc1-73bf-43f4-9b56-12a462116f2b"
/>
<img width="1000" height="500" alt="image-21"
src="https://github.com/user-attachments/assets/c7fde583-bccc-4c2b-b350-1a3f4cc3f6fd"
/>
```diff
before
after
===================================== |
=====================================
LikeCommentMutation |
LikeCommentMutation
===================================== |
=====================================
- 32420 iterations |
[+15.90%]- 37575 iterations
- 1097 tps (overall) |
[+14.86%]- 1260 tps (overall)
- 1131 tps (last 5 sec) |
[+15.38%]- 1305 tps (last 5 sec)
- 10898230 ns average latency |
[+12.89%]- 9492943 ns average latency
peak mem: 316.8525390625kb | [
-0.12%]peak mem: 317.244140625kb
avg mem: 279.11435041756465kb | [
-0.31%]avg mem: 279.98338188559325kb
===================================== |
=====================================
LikePostMutation |
LikePostMutation
===================================== |
=====================================
- 29517 iterations |
[+16.89%]- 34502 iterations
- 1003 tps (overall) |
[+15.85%]- 1162 tps (overall)
- 1034 tps (last 5 sec) |
[+16.83%]- 1208 tps (last 5 sec)
- 11917714 ns average latency |
[+13.64%]- 10292022 ns average latency
peak mem: 319.1064453125kb | [
-0.30%]peak mem: 320.0498046875kb
avg mem: 279.390185546875kb | [
-1.27%]avg mem: 282.9513555021368kb
===================================== |
=====================================
MessageAuthorQuery |
MessageAuthorQuery
===================================== |
=====================================
- 16858 iterations |
[+17.18%]- 19754 iterations
- 577 tps (overall) |
[+15.42%]- 666 tps (overall)
- 595 tps (last 5 sec) |
[+15.97%]- 690 tps (last 5 sec)
- 20693969 ns average latency |
[+13.24%]- 17955045 ns average latency
peak mem: 336.0947265625kb | [
-0.03%]peak mem: 336.2099609375kb
avg mem: 291.8486328125kb | [
-0.79%]avg mem: 294.1560284269958kb
===================================== |
=====================================
MessageContentQuery |
MessageContentQuery
===================================== |
=====================================
- 18346 iterations |
[+21.01%]- 22201 iterations
- 632 tps (overall) |
[+18.51%]- 749 tps (overall)
- 645 tps (last 5 sec) |
[+19.53%]- 771 tps (last 5 sec)
- 18925681 ns average latency |
[+15.67%]- 15960851 ns average latency
peak mem: 268.3916015625kb | [
-0.00%]peak mem: 268.400390625kb
avg mem: 236.346282710874kb | [
-0.65%]avg mem: 237.88215095766128kb
```
## agtype_build_map()
#### Motivation / Problem:
agtype_categorize_type() accounted for around 31% of agtype_build_map()
execution time. Type categorization is based on the argument type OID, which is
obtained from the function expression stored in FmgrInfo. The expression tree
associated with a particular FmgrInfo does not change between its executions,
so the resulting type metadata can be safely cached for subsequent calls using
the same FmgrInfo.
extract_variadic_agrs() accounted for around 13% of agtype_build_map()
execution time.
pfree_agtype_value() accounted for around 4% of agtype_build_map() execution
time.
#### Solution
Add a per-function type cache backed by a hash table. The cache stores the
category and output function for each encountered type OID, avoiding repeated
calls to agtype_categorize_type() for the same types.
The change also adds a fast path for non-variadic calls. Previously,
extract_variadic_args() was used for both ordinary and VARIADIC calls. For a
non-variadic call, the arguments are already available in FunctionCallInfo, so
allocating and populating separate args, nulls, and types arrays is unnecessary.
Add a temporary memory context which give us a possibility to remove
pfree_agtype_value() calls.
CreateForumWithTagsMutation [before]
<img width="1196" height="1078" alt="image-22"
src="https://github.com/user-attachments/assets/37837889-235e-4cda-b4f5-abc01d916e16"
/>
CreateForumWithTagsMutation [after]
<img width="1196" height="1078" alt="image-23"
src="https://github.com/user-attachments/assets/27358838-27a3-477f-979e-942a4e9f3a7e"
/>
CreateCommentMutation [before]
<img width="1196" height="1078" alt="image-24"
src="https://github.com/user-attachments/assets/a6bcb302-89e5-4538-91cc-ef9382b85af1"
/>
CreateCommentMutation [after]
<img width="1196" height="1078" alt="image-25"
src="https://github.com/user-attachments/assets/bc8792ca-14ce-45b0-a0fd-e2d1ca7f92dd"
/>
blue - before
orange - after
<img width="1000" height="500" alt="image-26"
src="https://github.com/user-attachments/assets/275b578c-df59-46c6-b3e9-0c6629a596bf"
/>
<img width="1000" height="500" alt="image-27"
src="https://github.com/user-attachments/assets/c0be13ad-5e9f-4c41-be02-dc0b97467174"
/>
```diff
before
after
===================================== |
=====================================
CreateCommentMutation |
CreateCommentMutation
===================================== |
=====================================
- 10412 iterations |
[+12.13%]- 11675 iterations
- 352 tps (overall) |
[+12.50%]- 396 tps (overall)
- 357 tps (last 5 sec) |
[+14.29%]- 408 tps (last 5 sec)
- 33981716 ns average latency |
[+11.15%]- 30191071 ns average latency
peak mem: 546.3203125kb | [
-0.22%]peak mem: 547.5244140625kb
avg mem: 433.9193993283991kb | [
-0.66%]avg mem: 436.77863451086955kb
===================================== |
====================================
===================================== |
=====================================
CreateForumWithTagsMutation |
CreateForumWithTagsMutation
===================================== |
=====================================
- 10112 iterations |
[+38.29%]- 13984 iterations
- 345 tps (overall) |
[+35.07%]- 466 tps (overall)
- 354 tps (last 5 sec) |
[+35.31%]- 479 tps (last 5 sec)
- 34593060 ns average latency |
[+25.92%]- 25626475 ns average latency
peak mem: 510.61328125kb | [
-1.80%]peak mem: 519.79296875kb
avg mem: 370.85441147985534kb | [
-6.38%]avg mem: 394.5214111328125kb
```
## Replace get_ith_agtype_value_from_container with
get_ith_agtype_value_from_container_no_copy
#### Motivation / Problem:
get_ith_agtype_value_from_container performs a copy of strings, numerics,
vertices, edges, and paths. However, in some functions like
agtype_access_operator and agtype_add, we don't change the agtype_value
received from get_ith_agtype_value_from_container, which results in unnecessary
copy overhead.
#### Solution
Create a get_ith_agtype_value_from_container_no_copy function that uses
fill_agtype_value_no_copy, and replace calls to
get_ith_agtype_value_from_container with
get_ith_agtype_value_from_container_no_copy where possible.
CreateCommentMutationWhere [before]
<img width="1198" height="1074" alt="image-30"
src="https://github.com/user-attachments/assets/f7cbf323-7820-4c83-af30-177a41b41a6c"
/>
CreateCommentMutationWhere [after]
<img width="1198" height="1074" alt="image-31"
src="https://github.com/user-attachments/assets/f38027d3-567d-4325-989a-4d61eb32a055"
/>
CreateForumWithTagsMutationWhere [before]
<img width="1072" height="1078" alt="image-28"
src="https://github.com/user-attachments/assets/bf85753b-4c66-45fc-a5d8-3db125694603"
/>
CreateForumWithTagsMutationWhere [after]
<img width="1198" height="1074" alt="image-29"
src="https://github.com/user-attachments/assets/07082356-c39f-4688-835f-bfff15ff94c6"
/>
blue - before
orange - after
<img width="1000" height="500" alt="image-33"
src="https://github.com/user-attachments/assets/63ff2c30-9f4a-426d-8b9c-6abd309421d9"
/>
<img width="1000" height="500" alt="image-32"
src="https://github.com/user-attachments/assets/45772bc1-7e7c-4171-a3ab-01daf48d0f1b"
/>
```diff
before
after
===================================== |
=====================================
CreateCommentMutationWhere |
CreateCommentMutationWhere
===================================== |
=====================================
- 5482 iterations | [
+6.73%]- 5851 iterations
- 188 tps (overall) | [
+3.72%]- 195 tps (overall)
- 176 tps (last 5 sec) | [
+2.84%]- 181 tps (last 5 sec)
- 63695049 ns average latency | [
+3.71%]- 61331612 ns average latency
peak mem: 707.1669921875kb | [
-0.93%]peak mem: 713.7177734375kb
avg mem: 472.549072265625kb | [
-1.08%]avg mem: 477.6684689405488kb
===================================== |
=====================================
CreateForumWithTagsMutationWhere |
CreateForumWithTagsMutationWhere
===================================== |
=====================================
- 29875 iterations | [
+3.62%]- 30957 iterations
- 1026 tps (overall) | [
+3.61%]- 1063 tps (overall)
- 1069 tps (last 5 sec) | [
+2.62%]- 1097 tps (last 5 sec)
- 11623780 ns average latency | [
+3.38%]- 11231310 ns average latency
peak mem: 536.537109375kb | [
-0.13%]peak mem: 537.2314453125kb
avg mem: 440.198734642094kb | [
-1.46%]avg mem: 446.61580332880436kb
```
## final version
```diff
before
after
===================================== |
=====================================
AddForumMemberMutation |
AddForumMemberMutation
===================================== |
=====================================
- 109715 iterations |
[+13.34%]- 124354 iterations
- 3686 tps (overall) |
[+12.81%]- 4158 tps (overall)
- 3827 tps (last 5 sec) |
[+13.04%]- 4326 tps (last 5 sec)
- 3237355 ns average latency |
[+11.32%]- 2870948 ns average latency
peak mem: 329.1845703125kb | [
-0.80%]peak mem: 331.8056640625kb
avg mem: 297.2863680428832kb | [
-0.75%]avg mem: 299.5164264547414kb
===================================== |
=====================================
CreateCommentMutation |
CreateCommentMutation
===================================== |
=====================================
- 10412 iterations |
[+31.44%]- 13686 iterations
- 352 tps (overall) |
[+30.11%]- 458 tps (overall)
- 357 tps (last 5 sec) |
[+33.05%]- 475 tps (last 5 sec)
- 33981716 ns average latency |
[+23.15%]- 26114813 ns average latency
peak mem: 546.3203125kb | [
-0.45%]peak mem: 548.751953125kb
avg mem: 433.9193993283991kb | [
-3.46%]avg mem: 448.95097990117523kb
===================================== |
=====================================
CreateCommentMutationWhere |
CreateCommentMutationWhere
===================================== |
=====================================
- 5535 iterations |
[+51.20%]- 8369 iterations
- 188 tps (overall) |
[+48.94%]- 280 tps (overall)
- 177 tps (last 5 sec) |
[+45.76%]- 258 tps (last 5 sec)
- 63703815 ns average latency |
[+33.05%]- 42651839 ns average latency
peak mem: 712.134765625kb | [
-3.47%]peak mem: 736.810546875kb
avg mem: 471.55885074013156kb |
[-14.13%]avg mem: 538.2127766927083kb
===================================== |
=====================================
CreateForumWithTagsMutation |
CreateForumWithTagsMutation
===================================== |
=====================================
- 10112 iterations |
[+54.07%]- 15580 iterations
- 345 tps (overall) |
[+51.88%]- 524 tps (overall)
- 354 tps (last 5 sec) |
[+48.59%]- 526 tps (last 5 sec)
- 34593060 ns average latency |
[+34.05%]- 22815573 ns average latency
peak mem: 510.61328125kb | [
-2.30%]peak mem: 522.3349609375kb
avg mem: 370.85441147985534kb | [
-8.64%]avg mem: 402.9014227642276kb
===================================== |
=====================================
CreateForumWithTagsMutationWhere |
CreateForumWithTagsMutationWhere
===================================== |
=====================================
- 29875 iterations |
[+46.43%]- 43745 iterations
- 1026 tps (overall) |
[+43.57%]- 1473 tps (overall)
- 1069 tps (last 5 sec) |
[+45.74%]- 1558 tps (last 5 sec)
- 11623780 ns average latency |
[+30.27%]- 8105084 ns average latency
peak mem: 536.537109375kb | [
-1.94%]peak mem: 546.9580078125kb
avg mem: 440.198734642094kb | [
-5.36%]avg mem: 463.792724609375kb
===================================== |
=====================================
CreateKnowsMutation |
CreateKnowsMutation
===================================== |
=====================================
- 72147 iterations |
[+16.35%]- 83944 iterations
- 2418 tps (overall) |
[+17.33%]- 2837 tps (overall)
- 2500 tps (last 5 sec) |
[+18.08%]- 2952 tps (last 5 sec)
- 4942230 ns average latency |
[+14.83%]- 4209111 ns average latency
peak mem: 324.9716796875kb | [
-0.59%]peak mem: 326.89453125kb
avg mem: 292.2816344734252kb | [
-0.73%]avg mem: 294.40927442863807kb
===================================== |
=====================================
CreatePersonMutation |
CreatePersonMutation
===================================== |
=====================================
- 14619 iterations |
[+40.99%]- 20611 iterations
- 491 tps (overall) |
[+41.75%]- 696 tps (overall)
- 509 tps (last 5 sec) |
[+42.83%]- 727 tps (last 5 sec)
- 24329735 ns average latency |
[+29.46%]- 17162878 ns average latency
peak mem: 934.9287109375kb | [
-1.19%]peak mem: 946.0869140625kb
avg mem: 720.4496942934783kb | [
-4.02%]avg mem: 749.4276297433036kb
===================================== |
=====================================
LikeCommentMutation |
LikeCommentMutation
===================================== |
=====================================
- 32420 iterations |
[+20.40%]- 39034 iterations
- 1097 tps (overall) |
[+20.51%]- 1322 tps (overall)
- 1131 tps (last 5 sec) |
[+21.49%]- 1374 tps (last 5 sec)
- 10898230 ns average latency |
[+17.03%]- 9042019 ns average latency
peak mem: 316.8525390625kb | [
-0.19%]peak mem: 317.44140625kb
avg mem: 279.11435041756465kb | [
-0.85%]avg mem: 281.4940995929622kb
===================================== |
=====================================
LikePostMutation |
LikePostMutation
===================================== |
=====================================
- 29517 iterations |
[+20.44%]- 35551 iterations
- 1003 tps (overall) |
[+20.04%]- 1204 tps (overall)
- 1034 tps (last 5 sec) |
[+20.02%]- 1241 tps (last 5 sec)
- 11917714 ns average latency |
[+16.71%]- 9926633 ns average latency
peak mem: 319.1064453125kb | [
-0.38%]peak mem: 320.3095703125kb
avg mem: 279.390185546875kb | [
-0.62%]avg mem: 281.1136767174587kb
===================================== |
=====================================
MessageAuthorQuery |
MessageAuthorQuery
===================================== |
=====================================
- 16858 iterations |
[+20.68%]- 20344 iterations
- 577 tps (overall) |
[+19.93%]- 692 tps (overall)
- 595 tps (last 5 sec) |
[+20.17%]- 715 tps (last 5 sec)
- 20693969 ns average latency |
[+16.51%]- 17276481 ns average latency
peak mem: 336.0947265625kb | [
-0.04%]peak mem: 336.2177734375kb
avg mem: 291.8486328125kb | [
-0.74%]avg mem: 294.0003041752049kb
===================================== |
=====================================
MessageContentQuery |
MessageContentQuery
===================================== |
=====================================
- 18346 iterations |
[+25.64%]- 23050 iterations
- 632 tps (overall) |
[+24.37%]- 786 tps (overall)
- 645 tps (last 5 sec) |
[+25.43%]- 809 tps (last 5 sec)
- 18925681 ns average latency |
[+19.63%]- 15211222 ns average latency
peak mem: 268.3916015625kb | [
+0.07%]peak mem: 268.1904296875kb
avg mem: 236.346282710874kb | [
-1.40%]avg mem: 239.66357421875kb
===================================== |
=====================================
MessageForumAndModeratorsQuery |
MessageForumAndModeratorsQuery
===================================== |
=====================================
- 9293 iterations | [
+9.76%]- 10200 iterations
- 311 tps (overall) |
[+11.90%]- 348 tps (overall)
- 327 tps (last 5 sec) |
[+10.09%]- 360 tps (last 5 sec)
- 38378279 ns average latency |
[+10.57%]- 34322041 ns average latency
peak mem: 887.2958984375kb | [
-0.52%]peak mem: 891.9150390625kb
avg mem: 716.639769345238kb | [
-1.11%]avg mem: 724.6248726222826kb
===================================== |
=====================================
MessageRepliesQuery |
MessageRepliesQuery
===================================== |
=====================================
- 11727 iterations |
[+11.72%]- 13101 iterations
- 396 tps (overall) |
[+13.38%]- 449 tps (overall)
- 411 tps (last 5 sec) |
[+12.90%]- 464 tps (last 5 sec)
- 30210561 ns average latency |
[+11.91%]- 26611426 ns average latency
peak mem: 937.3115234375kb | [
+0.11%]peak mem: 936.2578125kb
avg mem: 727.313513764881kb | [
-2.42%]avg mem: 744.9095248518319kb
===================================== |
=====================================
PersonFriendsQuery |
PersonFriendsQuery
===================================== |
=====================================
- 2944 iterations | [
-0.14%]- 2940 iterations
- 100 tps (overall) | [
+1.00%]- 101 tps (overall)
- 101 tps (last 5 sec) | [
+0.99%]- 102 tps (last 5 sec)
- 119429174 ns average latency | [
+1.10%]- 118121288 ns average latency
peak mem: 300.0068359375kb | [
+0.75%]peak mem: 297.7509765625kb
avg mem: 194.2514122596154kb | [
+0.40%]avg mem: 193.47971980733084kb
===================================== |
=====================================
PersonProfileQuery |
PersonProfileQuery
===================================== |
=====================================
- 11971 iterations | [
+3.84%]- 12431 iterations
- 411 tps (overall) | [
+0.73%]- 414 tps (overall)
- 421 tps (last 5 sec) | [
+0.48%]- 423 tps (last 5 sec)
- 29095769 ns average latency | [
+0.75%]- 28878475 ns average latency
peak mem: 329.53125kb |
[+14.85%]peak mem: 280.6044921875kb
avg mem: 274.36148834228516kb |
[+12.10%]avg mem: 241.16934041030535kb
===================================== |
=====================================
PersonRecentMessagesQuery |
PersonRecentMessagesQuery
===================================== |
=====================================
- 40901 iterations | [
+6.54%]- 43574 iterations
- 1365 tps (overall) | [
+6.81%]- 1458 tps (overall)
- 1425 tps (last 5 sec) | [
+6.32%]- 1515 tps (last 5 sec)
- 8762729 ns average latency | [
+6.46%]- 8196441 ns average latency
peak mem: 1181.474609375kb | [
-0.86%]peak mem: 1191.6875kb
avg mem: 930.1805913397607kb | [
-0.64%]avg mem: 936.1678515625kb
```
<img width="1000" height="500" alt="AddForumMemberMutation"
src="https://github.com/user-attachments/assets/70763935-8e95-4bf8-ba34-673524fbc3cc"
/>
<img width="1000" height="500" alt="CreateCommentMutation"
src="https://github.com/user-attachments/assets/0539e47e-e916-4aca-98f9-77057be495ce"
/>
<img width="1000" height="500" alt="CreateCommentMutationWhere"
src="https://github.com/user-attachments/assets/cee1be92-d072-4a6e-9dde-9451aeeb7a30"
/>
<img width="1000" height="500" alt="CreateForumWithTagsMutation"
src="https://github.com/user-attachments/assets/9bd70e6f-ceac-47d9-b936-3f66fef6a4ae"
/>
<img width="1000" height="500" alt="CreateForumWithTagsMutationWhere"
src="https://github.com/user-attachments/assets/c40367cc-65d9-4ead-808c-efbc50fd8bca"
/>
<img width="1000" height="500" alt="CreateKnowsMutation"
src="https://github.com/user-attachments/assets/597c2d5f-9904-41ef-9f61-a58498434333"
/>
<img width="1000" height="500" alt="CreatePersonMutation"
src="https://github.com/user-attachments/assets/cea60286-6c60-4d2b-87d9-50f77a8a4ce1"
/>
<img width="1000" height="500" alt="LikeCommentMutation"
src="https://github.com/user-attachments/assets/c481d698-02b7-4787-a35a-a665cf8713eb"
/>
<img width="1000" height="500" alt="LikePostMutation"
src="https://github.com/user-attachments/assets/9c0c47bb-ad5c-4e0e-89e6-45c976534c2f"
/>
<img width="1000" height="500" alt="MessageAuthorQuery"
src="https://github.com/user-attachments/assets/ca326c25-aa95-4db0-ba6b-52668a60c7cf"
/>
<img width="1000" height="500" alt="MessageContentQuery"
src="https://github.com/user-attachments/assets/a7690d4a-4357-4b86-a701-370ec5feef72"
/>
<img width="1000" height="500" alt="MessageForumAndModeratorsQuery"
src="https://github.com/user-attachments/assets/bc4ea4bd-5e1e-48f1-9da7-e1da4db5fa71"
/>
<img width="1000" height="500" alt="MessageRepliesQuery"
src="https://github.com/user-attachments/assets/55a56866-3245-4062-98c0-4c766949ee12"
/>
<img width="1000" height="500" alt="PersonFriendsQuery"
src="https://github.com/user-attachments/assets/3c91e9b8-dcc4-4b1c-801b-36522fb62d4f"
/>
<img width="1000" height="500" alt="PersonProfileQuery"
src="https://github.com/user-attachments/assets/2a37e270-3e95-495b-bd98-12fece651413"
/>
<img width="1000" height="500" alt="PersonRecentMessagesQuery"
src="https://github.com/user-attachments/assets/a9994a76-1ffe-4630-8650-95ae8a92e719"
/>
1. Graph creation and population:
The sf parameter here defines the scale factor of the generated graph.
psql -d your_database -f generate_graph.sql -v sf=1
generate_graph.sql
2. Creating wrapper functions for the workload:
This script sets up the environment and creates functions with the correct
parameter mapping for Apache AGE.
psql -d your_database -f setup_func_for_workload.sql
setup_func_for_workload.sql
3. Running the load test:
Running 8 clients for 120 seconds.
pgbench -d your_database -f workload_update.sql -D sf=1 -c 8 -T 120 -P
workload_update.sql
Test scenarious:
[text](../tmp/age_pgbench/setup_AddForumMemberMutation.sql )
[text](../tmp/age_pgbench/setup_CreateCommentMutation.sql )
[text](../tmp/age_pgbench/setup_CreateCommentMutationWhere.sql )
[text](../tmp/age_pgbench/setup_CreateForumWithTagsMutation.sql )
[text](../tmp/age_pgbench/setup_CreateForumWithTagsMutationWhere.sql )
[text](../tmp/age_pgbench/setup_CreateKnowsMutation.sql )
[text](../tmp/age_pgbench/setup_CreatePersonMutation.sql )
[text](../tmp/age_pgbench/setup_LikeCommentMutation.sql )
[text](../tmp/age_pgbench/setup_LikePostMutation.sql )
[text](../tmp/age_pgbench/setup_MessageAuthorQuery.sql )
[text](../tmp/age_pgbench/setup_MessageContentQuery.sql )
[text](../tmp/age_pgbench/setup_MessageForumAndModeratorsQuery.sql )
[text](../tmp/age_pgbench/setup_MessageRepliesQuery.sql )
[text](../tmp/age_pgbench/setup_PersonFriendsQuery.sql )
[text](../tmp/age_pgbench/setup_PersonProfileQuery.sql )
[text](../tmp/age_pgbench/setup_PersonRecentMessagesQuery.sql )
[text](../tmp/age_pgbe
nch/workload_AddForumMemberMutation.sql )
[text](../tmp/age_pgbench/workload_CreateCommentMutation.sql )
[text](../tmp/age_pgbench/workload_CreateCommentMutationWhere.sql )
[text](../tmp/age_pgbench/workload_CreateForumWithTagsMutation.sql )
[text](../tmp/age_pgbench/workload_CreateForumWithTagsMutationWhere.sql )
[text](../tmp/age_pgbench/workload_CreateKnowsMutation.sql )
[text](../tmp/age_pgbench/workload_CreatePersonMutation.sql )
[text](../tmp/age_pgbench/workload_LikeCommentMutation.sql )
[text](../tmp/age_pgbench/workload_LikePostMutation.sql )
[text](../tmp/age_pgbench/workload_MessageAuthorQuery.sql )
[text](../tmp/age_pgbench/workload_MessageContentQuery.sql )
[text](../tmp/age_pgbench/workload_MessageForumAndModeratorsQuery.sql )
[text](../tmp/age_pgbench/workload_MessageRepliesQuery.sql )
[text](../tmp/age_pgbench/workload_PersonFriendsQuery.sql )
[text](../tmp/age_pgbench/workload_PersonProfileQuery.sql )
[text](../tmp/age_pgbench/workload_PersonRecentMessagesQuery.sql
)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]