Skip to content

Commit

Permalink
Database Service: Dummy template for SUT
Browse files Browse the repository at this point in the history
  • Loading branch information
perdelt committed Dec 13, 2024
1 parent 63d1d12 commit 0627175
Show file tree
Hide file tree
Showing 2 changed files with 198 additions and 6 deletions.
190 changes: 190 additions & 0 deletions k8s/deploymenttemplate-PostgreSQLService.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
apiVersion: v1
kind: Service
metadata:
labels: {app: bexhoma, component: sut, configuration: default, experiment: default}
name: bexhoma-service
spec:
ports:
- {port: 9091, protocol: TCP, name: port-dbms, targetPort: 5432}
- {port: 9300, protocol: TCP, name: port-monitoring, targetPort: 9300}
selector: {app: bexhoma, component: sut, configuration: default, experiment: default}
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels: {app: bexhoma, component: sut, configuration: default, experiment: default}
name: bexhoma-deployment-postgres
spec:
replicas: 1
selector:
matchLabels: {app: bexhoma, component: sut, configuration: default, experiment: default}
template:
metadata:
labels: {app: bexhoma, component: sut, configuration: default, experiment: default}
spec:
automountServiceAccountToken: false
imagePullSecrets:
- {name: dockerhub}
nodeSelector:
tolerations:
#- key: "nvidia.com/gpu"
# effect: "NoSchedule"
terminationGracePeriodSeconds: 180
containers:
- name: dbms
image: postgres:16.1
env:
- name: POSTGRES_HOST_AUTH_METHOD
value: trust
- name: PGDATA
value: /var/lib/postgresql/data/pgdata
# pg_ctl: cannot be run as root
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "echo 'Hello from the postStart handler' > /usr/share/message && cat /usr/share/message"]
preStop:
exec:
#command: ["/bin/sh", "-c", "gosu postgres pg_ctl stop -D /var/lib/postgresql/data -m fast"]
#command: ["/bin/sh", "-c", "gosu postgres pg_ctl stop -m fast"]
#command: ["echo 'PRESTOP' ;", "/bin/sh", "-c", "gosu postgres pg_ctl stop -m smart -t 120"]
#command: ["/bin/sh", "-c", "echo 'Hello from the preStop handler'; gosu postgres pg_ctl stop -m smart -t 120"]
#command: ["gosu postgres", "pg_ctl stop -m smart -t 120"]
#command: ["/bin/sh", "-c"]
#args: ["gosu postgres pg_ctl stop -m smart -t 120"]
#command: ["/bin/sh", "-c", "gosu postgres 'pg_ctl stop -m smart -t 120'"]
#command: ["/bin/sh", "-c", "gosu postgres '/usr/lib/postgresql/16/bin/pg_ctl stop -m smart -t 120'"]
#command: ["/bin/sh -c 'gosu postgres /usr/lib/postgresql/16/bin/pg_ctl stop -m smart -t 120'"]
command: ["/bin/sh", "-c", "gosu postgres /usr/lib/postgresql/16/bin/pg_ctl stop -m smart -t 120"]
#command: ["/bin/sh", "-c", "echo 'Hello from the preStop handler' > /usr/share/message && cat /usr/share/message"]
#command: ["sh", "-c", "trap 'gosu postgres pg_ctl stop -m smart' SIGTERM; gosu postgres postgres"] # trap: SIGTERM: bad trap
readinessProbe:
exec:
command:
- /bin/sh
- "-c"
- >
if pg_isready -h localhost -p 5432 > /dev/null; then
recovery_status=$(psql -h localhost -p 5432 -U postgres -t -c "SELECT pg_is_in_recovery();" | xargs);
[ "$recovery_status" = "f" ] && exit 0 || exit 1;
else
exit 1;
fi
#command:
#- pg_isready
#- -U
#- postgres
initialDelaySeconds: 15
periodSeconds: 60
successThreshold: 3
ports:
- {containerPort: 5432}
securityContext:
allowPrivilegeEscalation: false
#runAsNonRoot: true
#runAsUser: 1000
#runAsGroup: 1000
#capabilities:
# drop:
# - ALL
#readOnlyRootFilesystem: true #could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Read-only file system
resources:
limits: {cpu: 16000m, memory: 128Gi}
requests: {cpu: 1000m, memory: 1Gi}
#, ephemeral-storage: "1536Gi"}
volumeMounts:
- {mountPath: /dev/shm, name: dshm}
args: [
"-c", "max_worker_processes=64",
"-c", "max_parallel_workers=64",
"-c", "max_parallel_workers_per_gather=64",
"-c", "max_parallel_maintenance_workers=64", # only for PostgreSQL > 10 (?)
"-c", "max_wal_size=32GB",
"-c", "shared_buffers=64GB",
#"-c", "shared_memory_size=32GB", # read-only
"-c", "max_connections=2048",
"-c", "autovacuum_max_workers=10",
"-c", "autovacuum_vacuum_cost_limit=3000",
"-c", "vacuum_cost_limit=1000",
"-c", "checkpoint_completion_target=0.9",
"-c", "cpu_tuple_cost=0.03",
"-c", "effective_cache_size=64GB",
"-c", "maintenance_work_mem=2GB",
#"-c", "max_connections=1700",
#"-c", "random_page_cost=1.1",
"-c", "wal_buffers=1GB",
"-c", "work_mem=32GB",
#"-c", "huge_pages=on",
"-c", "temp_buffers=4GB",
"-c", "autovacuum_work_mem=-1",
"-c", "max_stack_depth=7MB",
"-c", "max_files_per_process=4000",
"-c", "effective_io_concurrency=32",
"-c", "wal_level=minimal",
"-c", "max_wal_senders=0",
"-c", "synchronous_commit=off",
"-c", "checkpoint_timeout=1h",
"-c", "checkpoint_warning=0",
"-c", "autovacuum=off",
"-c", "max_locks_per_transaction=64",
"-c", "max_pred_locks_per_transaction=64",
"-c", "default_statistics_target=1000",
"-c", "random_page_cost=60"
]
# , "-c", "listen_addresses='*'", "-c", "logging_collector=on"
# , "-c", "pg_stat_statements.save=off", "-c", "pg_stat_statements.track=all", "-c", "shared_preload_libraries='pg_stat_statements'"
- name: cadvisor
image: gcr.io/cadvisor/cadvisor:v0.47.0
args: ["--port", "9300", "--storage_duration", "20m0s", "--docker_only", "true", "--disable_metrics", "disk,network,tcp,advtcp,udp,sched,process,hugetlb", "--application_metrics_count_limit", "30", "--housekeeping_interval", "5s"]
ports:
- containerPort: 9300
#hostPort: 9300
name: http
protocol: TCP
securityContext:
allowPrivilegeEscalation: false
#runAsNonRoot: true
#runAsUser: 1000
#runAsGroup: 1000
#capabilities:
# drop:
# - ALL
readOnlyRootFilesystem: true
resources:
requests: {cpu: 150m, memory: 200Mi}
limits: {cpu: 16000m, memory: 128Gi}
volumeMounts:
- name: rootfs
mountPath: /rootfs
readOnly: true
- name: var-run
mountPath: /var/run
readOnly: true
- name: sys
mountPath: /sys
readOnly: true
- name: docker
mountPath: /var/lib/docker
readOnly: true
- name: disk
mountPath: /dev/disk
readOnly: true
volumes:
- name: rootfs
hostPath:
path: /
- name: var-run
hostPath:
path: /var/run
- name: sys
hostPath:
path: /sys
- name: docker
hostPath:
path: /var/lib/docker
- name: disk
hostPath:
path: /dev/disk
- name: dshm
emptyDir:
medium: Memory
14 changes: 8 additions & 6 deletions test-cloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -677,23 +677,23 @@ wait_process "tpcds"






#######################################################
############# YCSB Monitoring PostgreSQL ##############
#######################################################



#PostgreSQL
##################################### sidecar
nohup python ycsb.py -ms 1 -tr -sf 1 -sfo 1 --workload a -dbms PostgreSQL -rnn $BEXHOMA_NODE_SUT -rnl $BEXHOMA_NODE_LOAD -rnb $BEXHOMA_NODE_BENCHMARK -tb 16384 -nlp 8 -nlt 64 -nlf 4 -nbp 1 -nbt 64 -nbf 4 -ne 1 -nc 1 -m run </dev/null &>$LOG_DIR/test_ycsb_postgresql_sidecar.log &
#nohup python ycsb.py -ms 1 -tr -sf 1 -sfo 1 --workload a -dbms PostgreSQL -rnn $BEXHOMA_NODE_SUT -rnl $BEXHOMA_NODE_LOAD -rnb $BEXHOMA_NODE_BENCHMARK -tb 16384 -nlp 8 -nlt 64 -nlf 4 -nbp 1 -nbt 64 -nbf 4 -ne 1 -nc 1 -m run </dev/null &>$LOG_DIR/test_ycsb_postgresql_sidecar.log &
#-) ok

##################################### daemonset
nohup python ycsb.py -ms 1 -tr -sf 1 -sfo 1 --workload a -dbms PostgreSQL -rnn $BEXHOMA_NODE_SUT -rnl $BEXHOMA_NODE_LOAD -rnb $BEXHOMA_NODE_BENCHMARK -tb 16384 -nlp 8 -nlt 64 -nlf 4 -nbp 1 -nbt 64 -nbf 4 -ne 1 -nc 1 -m -mc -db run </dev/null &>$LOG_DIR/test_ycsb_postgresql_daemonset.log &
#nohup python ycsb.py -ms 1 -tr -sf 1 -sfo 1 --workload a -dbms PostgreSQL -rnn $BEXHOMA_NODE_SUT -rnl $BEXHOMA_NODE_LOAD -rnb $BEXHOMA_NODE_BENCHMARK -tb 16384 -nlp 8 -nlt 64 -nlf 4 -nbp 1 -nbt 64 -nbf 4 -ne 1 -nc 1 -m -mc -db run </dev/null &>$LOG_DIR/test_ycsb_postgresql_daemonset.log &
#-) ok

##################################### cluster preinstalled
nohup python ycsb.py -ms 1 -tr -sf 1 -sfo 1 --workload a -dbms PostgreSQL -rnn $BEXHOMA_NODE_SUT -rnl $BEXHOMA_NODE_LOAD -rnb $BEXHOMA_NODE_BENCHMARK -tb 16384 -nlp 8 -nlt 64 -nlf 4 -nbp 1 -nbt 64 -nbf 4 -ne 1 -nc 1 -m -mc -db run </dev/null &>$LOG_DIR/test_ycsb_postgresql_cluster.log &
#nohup python ycsb.py -ms 1 -tr -sf 1 -sfo 1 --workload a -dbms PostgreSQL -rnn $BEXHOMA_NODE_SUT -rnl $BEXHOMA_NODE_LOAD -rnb $BEXHOMA_NODE_BENCHMARK -tb 16384 -nlp 8 -nlt 64 -nlf 4 -nbp 1 -nbt 64 -nbf 4 -ne 1 -nc 1 -m -mc -db run </dev/null &>$LOG_DIR/test_ycsb_postgresql_cluster.log &
#-) ok


Expand Down Expand Up @@ -899,6 +899,8 @@ sleep 30
# start database service
kubectl create -f k8s/deploymenttemplate-PostgreSQLService.yml

# login into database service
# kubectl port-forward svc/bexhoma-service 9091:9091

#### TCP-H Monitoring (Example-TPC-H.md)
nohup python tpch.py -ms 2 -dt -tr \
Expand Down

0 comments on commit 0627175

Please sign in to comment.