summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-04-29 11:52:11 -0600
committermo khan <mo.khan@gmail.com>2020-04-29 11:52:11 -0600
commit4984ccc6c2fe3e336a2cd2d3b85d8cda52b68225 (patch)
treeeb8b92686d8512b48c8fb4e770b2ebd236427ad3
parentde2efaf72ab26f3a66368c732023e41ea5966bda (diff)
Add some notes on pgbench
-rw-r--r--README.md15
-rwxr-xr-xbin/bench5
2 files changed, 19 insertions, 1 deletions
diff --git a/README.md b/README.md
index 5a99d9a..d58003a 100644
--- a/README.md
+++ b/README.md
@@ -2031,6 +2031,7 @@ Try to keep `max_connections` down. How? use a connection pooler
```text
+------------------
| app | app | app |
------------------
| pool|pool| pool | <- not needed anymore with a connection pooler
@@ -2038,7 +2039,7 @@ Try to keep `max_connections` down. How? use a connection pooler
| | | | | | | | |
| | | | | | | | |
---------------------
-| connection pooler | <- re-use connections
+| connection pooler | <- re-use connections (pgbouncer)
---------------------
| | |
| | |
@@ -2046,3 +2047,15 @@ Try to keep `max_connections` down. How? use a connection pooler
| db | <- limit the # of connections
----------
```
+
+* You don't want more processes than CPU cores. CPU bound.
+* You don't want more `work_mem` * `max_connections` to be more than the available RAM.
+
+## pgbench
+
+```bash
+$ pgbench -h $PWD/tmp/sockets -i -s 100 dbname
+$ pgbench -c 10 -T 30
+# simulate an application that opens and closes connections constantly
+$ pgbench -C -c 10 -T 30
+```
diff --git a/bin/bench b/bin/bench
new file mode 100755
index 0000000..4a7aa1e
--- /dev/null
+++ b/bin/bench
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+pgbench -h $PWD/tmp/sockets -i -s 100 course
+pgbench -h $PWD/tmp/sockets -c 10 -T 30 course
+# pgbench -h $PWD/tmp/sockets -C -c 10 -T 30 course