| Issue |
124601
|
| Summary |
[BOLT] Regression of ~20% when BOLT is used on Postgres17.2
|
| Labels |
BOLT
|
| Assignees |
|
| Reporter |
salvatoredipietro
|
### Description
Attempted to use optimize Postgres17.2 with BOLT but noticed regression of ~20% on throughput and latency
### Environment
- Operating System: Amazon Linux 2023
- Hardware: AWS m7g.2xlarge instance (ARM-based)
- BOLT version: c118864223c6309378cd704f3406533474c2759f
- Application used: PostgreSQL 17.2 (build locally)
### Steps to Reproduce
```bash
### SUT and DRV (2x m7g.2xl with AL2023)
# Update the system and install required dependencies
sudo dnf update -y && sudo dnf groupinstall -y "Development Tools" && sudo dnf install -y git readline-devel zlib-devel bison flex libicu-devel perf cmake ninja-build htop
# Clone and build Postgres 17.2 repo
cd ${HOME} && git clone -b REL_17_2 https://github.com/postgres/postgres.git
cd ${HOME}/postgres
# in case of BOLT instrumentation
# export LDFLAGS="$LDFLAGS -Wl,--emit-relocs"; export CFLAGS="$CFLAGS -fno-reorder-blocks-and-partition"
# Build and install
./configure && make -j8 && sudo make install
### SUT only
# Create postgres user and group on the system and data directory
sudo groupadd postgres
sudo useradd -c "PostgreSQL Server" -g postgres postgres
sudo mkdir -p /usr/local/pgsql/{data,log}
sudo chown -R postgres:postgres /usr/local/pgsql/{data,log}
# Initialize the database cluster and open port to remote DRV instance (change the subnet with your CIDR)
sudo -u postgres /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
sudo sed -E -i "s/^#?listen_addresses = .+$/listen_addresses = '*'/" /usr/local/pgsql/data/postgresql.conf
echo "host all all 172.31.0.0/16 password" | sudo tee -a /usr/local/pgsql/data/pg_hba.conf > /dev/null
# Start the server
sudo -u postgres /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /usr/local/pgsql/log/logfile start
# Create pgbench database and user and grant privileges
sudo -u postgres /usr/local/pgsql/bin/psql -c "CREATE USER pgbenchuser WITH PASSWORD 'pgbench123';"
sudo -u postgres /usr/local/pgsql/bin/psql -c "CREATE DATABASE pgbench OWNER pgbenchuser;"
sudo -u postgres /usr/local/pgsql/bin/psql -d pgbench -c "GRANT ALL PRIVILEGES ON DATABASE pgbench TO pgbenchuser;"
sudo -u postgres /usr/local/pgsql/bin/psql -d pgbench -c "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO pgbenchuser;"
sudo -u postgres /usr/local/pgsql/bin/psql -d pgbench -c "ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO pgbenchuser;"
### DRV only
# Setting Postgres credential to connect to it
export PGHOST=172.31.x.x # Change IP
export PGPORT=5432
export PGUSER=pgbenchuser
export PGPASSWORD=pgbench123
export PGDATABASE=pgbench
# To run pgbench:
/usr/local/pgsql/bin/pgbench -i -s 1000 pgbench # Initialize
# Run workload
/usr/local/pgsql/bin/pgbench --client=64 --jobs=8 --time=600 --select-only --progress=10 pgbench
```
BOLT profile gathered with `sudo perf record -e cycles:u -u postgres -o ${HOME}/perf.data -a -F4999 -- sleep 300`
### Results
Throughput results:
```bash
tps = 91k # baseline
tps = 73k # BOLT optimized
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs