mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-30 03:20:36 +00:00
Run Performance bench on more platforms (#8312)
## Problem
https://github.com/neondatabase/cloud/issues/14721
## Summary of changes
add one more platform to benchmarking job
57535c039c/.github/workflows/benchmarking.yml (L57C3-L126)
Run with pg 16, provisioner k8-neonvm by default on the new platform.
Adjust some test cases to
- not depend on database client <-> database server latency by pushing
loops into server side pl/pgSQL functions
- increase statement and test timeouts
First successful run of these job steps
https://github.com/neondatabase/neon/actions/runs/9869817756/job/27254280428
This commit is contained in:
@@ -16,20 +16,34 @@ from pytest_lazyfixture import lazy_fixture
|
||||
)
|
||||
def test_hot_page(env: PgCompare):
|
||||
# Update the same page many times, then measure read performance
|
||||
num_writes = 1000000
|
||||
|
||||
with closing(env.pg.connect()) as conn:
|
||||
with conn.cursor() as cur:
|
||||
cur.execute("drop table if exists t, f;")
|
||||
num_writes = 1000000
|
||||
|
||||
# Write many updates to the same row
|
||||
# Use a PL/pgSQL block to perform many updates to the same row
|
||||
# without depending on the latency between database client and postgres
|
||||
# server
|
||||
# - however a single staement should not run into a timeout so we increase it
|
||||
cur.execute("SET statement_timeout = '4h';")
|
||||
with env.record_duration("write"):
|
||||
cur.execute("create table t (i integer);")
|
||||
cur.execute("insert into t values (0);")
|
||||
for i in range(num_writes):
|
||||
cur.execute(f"update t set i = {i};")
|
||||
cur.execute(
|
||||
f"""
|
||||
DO $$
|
||||
BEGIN
|
||||
create table t (i integer);
|
||||
insert into t values (0);
|
||||
|
||||
# Write 3-4 MB to evict t from compute cache
|
||||
FOR j IN 1..{num_writes} LOOP
|
||||
update t set i = j;
|
||||
END LOOP;
|
||||
END $$;
|
||||
"""
|
||||
)
|
||||
|
||||
# Write ca 350 MB to evict t from compute shared buffers (128 MB)
|
||||
# however it will still be in LFC, so I do not really understand the point of this test
|
||||
cur.execute("create table f (i integer);")
|
||||
cur.execute("insert into f values (generate_series(1,100000));")
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ from pytest_lazyfixture import lazy_fixture
|
||||
)
|
||||
def test_hot_table(env: PgCompare):
|
||||
# Update a small table many times, then measure read performance
|
||||
num_rows = 100000 # Slightly larger than shared buffers size TODO validate
|
||||
num_writes = 1000000
|
||||
num_rows = 100000 # initial table size only about 4 MB
|
||||
num_writes = 10000000 # write approximately 349 MB blocks > 128 MB shared_buffers
|
||||
num_reads = 10
|
||||
|
||||
with closing(env.pg.connect()) as conn:
|
||||
@@ -28,8 +28,21 @@ def test_hot_table(env: PgCompare):
|
||||
with env.record_duration("write"):
|
||||
cur.execute("create table t (i integer primary key);")
|
||||
cur.execute(f"insert into t values (generate_series(1,{num_rows}));")
|
||||
for i in range(num_writes):
|
||||
cur.execute(f"update t set i = {i + num_rows} WHERE i = {i};")
|
||||
# PL/pgSQL block to perform updates (and avoid latency between client and server)
|
||||
# - however a single staement should not run into a timeout so we increase it
|
||||
cur.execute("SET statement_timeout = '4h';")
|
||||
cur.execute(
|
||||
f"""
|
||||
DO $$
|
||||
DECLARE
|
||||
r integer := {num_rows};
|
||||
BEGIN
|
||||
FOR j IN 1..{num_writes} LOOP
|
||||
UPDATE t SET i = j + r WHERE i = j;
|
||||
END LOOP;
|
||||
END $$;
|
||||
"""
|
||||
)
|
||||
|
||||
# Read the table
|
||||
with env.record_duration("read"):
|
||||
|
||||
Reference in New Issue
Block a user