Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita765db4

Browse files
committed
Add pgench: a TPC-B like benchmarking tool
1 parentbfbd58c commita765db4

File tree

5 files changed

+1079
-0
lines changed

5 files changed

+1079
-0
lines changed

‎contrib/README

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,7 @@ userlock -
8383
vacuumlo -
8484
Remove orphaned large objects
8585
by Peter T Mount <peter@retep.org.uk>
86+
87+
pgbench -
88+
TPC-B like benchmarking tool
89+
by Tatsuo Ishii <t-ishii@sra.co.jp>

‎contrib/pgbench/Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# $Header: /cvsroot/pgsql/contrib/pgbench/Makefile,v 1.1 2000/01/15 12:38:09 ishii Exp $
2+
3+
SRCDIR= ../../src
4+
5+
include$(SRCDIR)/Makefile.global
6+
7+
CFLAGS:= -I$(LIBPQDIR)$(CFLAGS)
8+
9+
TARGET = pgbench
10+
OBJS = pgbench.o
11+
12+
all::$(TARGET)
13+
14+
$(TARGET):$(OBJS)
15+
$(CC) -o$(TARGET)$(OBJS) -L$(LIBPQDIR) -lpq$(LDFLAGS)
16+
17+
install:$(TARGET)
18+
$(INSTALL)$(INSTL_EXE_OPTS)$(TARGET)$(X)$(BINDIR)/$(TARGET)$(X)
19+
20+
clean:
21+
$(RM)$(TARGET)$(X)$(OBJS)
22+
23+
distclean: clean

‎contrib/pgbench/README

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
pgbench 1.2 README2000/1/15 Tatsuo Ishii (t-ishii@sra.co.jp)
2+
3+
o What is pgbench?
4+
5+
pgbench is a simple program to run a benchmark test sort of
6+
"TPC-B". pgbench is a client application of PostgreSQL and runs
7+
with PostgreSQL only. It performs lots of small and simple
8+
transactions including select/update/insert operations then
9+
calculates number of transactions successfully completed within a
10+
second (transactions per second, tps). Targeting data includes a
11+
table with at least 100k tuples.
12+
13+
Example outputs from pgbench look like:
14+
15+
number of clients: 4
16+
number of transactions per client: 100
17+
number of processed transactions: 400/400
18+
tps = 19.875015(including connections establishing)
19+
tps = 20.098827(excluding connections establishing)
20+
21+
Similar program called "JDBCBench" already exists, but it requires
22+
Java that may not be available on every platform. Moreover some
23+
people concerned about the overhead of Java that might lead
24+
inaccurate results. So I decided to write in pure C, and named
25+
it "pgbench."
26+
27+
o features of pgbench
28+
29+
- pgbench is written in C using libpq only. So it is very portable
30+
and easy to install.
31+
32+
- pgbench can simulate concurrent connections using asynchronous
33+
capability of libpq. No threading is required.
34+
35+
o How to install pgbench
36+
37+
(1) Edit the first line in Makefile
38+
39+
POSTGRESHOME = /usr/local/pgsql
40+
41+
so that it points to the directory where PostgreSQL installed.
42+
43+
(2) Run configure
44+
45+
(3) Run make. You will see an executable file "pgbench" there.
46+
47+
o How to use pgbench?
48+
49+
(1) Initialize database by:
50+
51+
pgbench -i <dbname>
52+
53+
where <dbname> is the name of database. pgbench uses four tables
54+
accounts, branches, history and tellers. These tables will be
55+
destroyed. Be very carefully if you have tables having same
56+
names. Default test data contains:
57+
58+
table# of tuples
59+
-------------------------
60+
branches1
61+
tellers10
62+
accounts100000
63+
history0
64+
65+
You can increase the number of tuples by using -s option. See
66+
below.
67+
68+
(2) Run the benchmark test
69+
70+
pgbench <dbname>
71+
72+
The default configuration is:
73+
74+
number of clients: 1
75+
number of transactions per client: 10
76+
77+
o options
78+
79+
pgbench has number of options.
80+
81+
-h hostname
82+
hostname where the backend is running. If this option
83+
is omitted, pgbench will connect to the localhost via
84+
Unix domain socket.
85+
86+
-p port
87+
the port number that the backend is accepting. default is
88+
5432.
89+
90+
-c number_of_clients
91+
Number of clients simulated. default is 1.
92+
93+
-t number_of_transactions
94+
Number of transactions each client runs. default is 10.
95+
96+
-s scaling_factor
97+
this should be used with -i (initialize) option.
98+
number of tuples generated will be multiple of the
99+
scaling factor. For example, -s 100 will imply 10M
100+
(10,000,000) tuples in the accounts table.
101+
default is 1.
102+
103+
-n
104+
No vacuuming and cleaning the history table prior the
105+
test is performed.
106+
107+
-v
108+
Do vacuuming before testing. This will take some time.
109+
Without both -n and -v pgbench will vacuum tellers and
110+
branches tables only.
111+
112+
-S
113+
Perform select only transactions instead of TPC-B.
114+
115+
-d
116+
debug option.
117+
118+
119+
o What is the "transaction" actually performed in pgbench?
120+
121+
(1) begin;
122+
123+
(2) update accounts set abalance = abalance + :delta where aid = :aid;
124+
125+
(3) select abalance from accounts where aid = :aid;
126+
127+
(4) update tellers set tbalance = tbalance + :delta where tid = :tid;
128+
129+
(5) update branches set bbalance = bbalance + :delta where bid = :bid;
130+
131+
(6) insert into history(tid,bid,aid,delta) values(:tid,:bid,:aid,:delta);
132+
133+
(7) end;
134+
135+
o License?
136+
137+
Basically it is same as BSD license. See pgbench.c for more details.
138+
139+
o History
140+
141+
2000/1/15 pgbench-1.2 contributed to PostgreSQL
142+
* Add -v option
143+
144+
1999/09/29 pgbench-1.1 released
145+
* Apply cygwin patches contributed by Yutaka Tanida
146+
* More robust when backends die
147+
* Add -S option (select only)
148+
149+
1999/09/04 pgbench-1.0 released

‎contrib/pgbench/README.jis

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
pgbench 1.2 README2000/1/15 Tatsuo Ishii (t-ishii@sra.co.jp)
2+
3+
$B"#(Bpgbench $B$H$O!)(B
4+
5+
pgbench $B$O(B TPC-B$B$K;w$?%Y%s%A%^!<%/%F%9%H$r9T$J$&%W%m%0%i%`$G$9!#:#$N$H(B
6+
$B$3$m(B PostgreSQL $B@lMQ$G$9!#(B
7+
8+
pgbench $B$O(B select/update/insert $B$r4^$`%H%i%s%6%/%7%g%s$r<B9T$7!"A4BN$N(B
9+
$B<B9T;~4V$H<B:]$K40N;$7$?%H%i%s%6%/%7%g%s$N?t$+$i(B 1 $BIC4V$K<B9T$G$-$?%H(B
10+
$B%i%s%6%/%7%g%s?t(B (tps) $B$rI=<($7$^$9!#=hM}$NBP>]$H$J$k%F!<%V%k$O%G%U%)(B
11+
$B%k%H$G$O(B 10$BK|%?%W%k$N%G!<%?$r4^$_$^$9!#(B
12+
13+
$B<B:]$NI=<($O0J2<$N$h$&$J46$8$G$9!#(B
14+
15+
number of clients: 4
16+
number of transactions per client: 100
17+
number of processed transactions: 400/400
18+
tps = 19.875015(including connections establishing)
19+
tps = 20.098827(excluding connections establishing)
20+
21+
pgbench $B$O(B JDBCBench $B$H$$$&!"$b$H$b$H$O(B MySQL $BMQ$K=q$+$l$?(B JDBC $BMQ$N%Y(B
22+
$B%s%A%^!<%/%W%m%0%i%`$r;29M$K:n@.$5$l$^$7$?!#(B
23+
24+
$B"#(Bpgbench $B$NFCD'(B
25+
26+
o C $B8@8l$H(B libpq $B$@$1$G=q$+$l$F$$$k$N$G0\?"@-$,9b$/!"4JC1$K%$%s%9%H!<(B
27+
$B%k$G$-$^$9!#(B
28+
29+
o pgbench $B$O(B libpq $B$NHsF14|=hM}5!G=$r;H$C$F%^%k%A%f!<%64D6-$r%7%_%e%l!<(B
30+
$B%H$7$^$9!#MF0W$KF1;~@\B34D6-$r%F%9%H$G$-$^$9!#(B
31+
32+
$B"#(Bpgbench $B$N%$%s%9%H!<%k(B
33+
34+
Makefile$B$N0lHV>e$K$"$k(B
35+
36+
POSTGRESHOME = /usr/local/pgsql
37+
38+
$B$rI,MW$K1~$8$F=$@5$7!"(Bconfigure;make $B$9$k$@$1$G$9!#(B
39+
40+
$B"#(Bpgbench $B$N;H$$J}(B
41+
42+
$B4pK\E*$J;H$$J}$O!"(B
43+
44+
$ pgbench [$B%G!<%?%Y!<%9L>(B]
45+
46+
$B$G$9!#%G!<%?%Y!<%9L>$r>JN,$9$k$H!"%f!<%6L>$HF1$8%G!<%?%Y!<%9$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9$k$?$a$K$O!"$"$i$+$8$a%G!<%?%Y!<%9(B
96+
$B$r=i4|2=$7!"%F%9%H%G!<%?$r:n$kI,MW$,$"$j$^$9!#(B
97+
98+
$ pgbench -i [$B%G!<%?%Y!<%9L>(B]
99+
100+
$B$3$l$K$h$j0J2<$N%F!<%V%k$,:n$i$l$^$9(B($B%9%1!<%j%s%0%U%!%/%?!<(B == 1 $B$N>l9g(B)$B!#(B
101+
102+
$B!vCm0U!v(B
103+
$BF1$8L>A0$N%F!<%V%k$,$"$k$H:o=|$5$l$F$7$^$&$N$G$4Cm0U2<$5$$!*!*(B
104+
105+
$B%F!<%V%kL>(B$B%?%W%k?t(B
106+
-------------------------
107+
branches1
108+
tellers10
109+
accounts100000
110+
history0
111+
112+
$B%9%1!<%j%s%0%U%!%/%?!<$r(B 10,100,1000 $B$J$I$KJQ99$9$k$H!">e5-%?%W%k?t$O(B
113+
$B$=$l$K1~$8$F(B10$BG\!"(B100$BG\!"(B1000$BG\$K$J$j$^$9!#$?$H$($P!"%9%1!<%j%s%0%U%!(B
114+
$B%/%?!<$r(B 10 $B$H$9$k$H!"(B
115+
116+
$B%F!<%V%kL>(B$B%?%W%k?t(B
117+
-------------------------
118+
branches10
119+
tellers100
120+
accounts1000000
121+
history0
122+
123+
$B$K$J$j$^$9!#(B
124+
125+
$B"#!V%H%i%s%6%/%7%g%s!W$NDj5A(B
126+
127+
pgbench $B$G$O!"0J2<$N%7!<%1%s%9$rA4It40N;$7$F(B1$B%H%i%s%6%/%7%g%s$H?t$($F(B
128+
$B$$$^$9!#(B
129+
130+
(1) begin;
131+
132+
(2) update accounts set abalance = abalance + :delta where aid = :aid;
133+
$B$3$3$G!"(B:delta$B$O(B1$B$+$i(B1000$B$^$G$NCM$r<h$kMp?t!"(B:aid $B$O(B 1$B$+$i(B100000$B$^$G(B
134+
$B$NCM$r<h$kMp?t$G$9!#0J2<!"Mp?t$NCM$O$=$l$>$l$3$N%H%i%s%6%/%7%g%s$N(B
135+
$BCf$G$OF1$8CM$r;H$$$^$9!#(B
136+
137+
(3) select abalance from accounts where aid = :aid;
138+
$B$3$3$G$O(B1$B7o$@$18!:w$5$l$^$9!#(B
139+
140+
(4) update tellers set tbalance = tbalance + :delta where tid = :tid;
141+
$B$3$3$G(B :tid $B$O(B 1$B$+$i(B10$B$N4V$NCM$r$H$kMp?t$G$9!#(B
142+
143+
(5) update branches set bbalance = bbalance + :delta where bid = :bid;
144+
$B$3$3$G(B :bid $B$O(B 1 $B$+$i(B[$B%9%1%j%s%0%U%!%/%?!<(B]$B$N4V$NCM$r<h$kMp?t$G$9!#(B
145+
146+
(6) insert into history(tid,bid,aid,delta) values(:tid,:bid,:aid,:delta);
147+
148+
(7) end;
149+
150+
$B"#:n<T$H%i%$%;%s%9>r7o(B
151+
152+
pgbench $B$O@P0f(B $BC#IW$K$h$C$F=q$+$l$^$7$?!#%i%$%;%s%9>r7o$O(B pgbench.c $B$N(B
153+
$BKAF,$K=q$$$F$"$j$^$9!#$3$N>r7o$r<i$k8B$jL5=~$GMxMQ$7!"$^$?<+M3$K:FG[IU(B
154+
$B$G$-$^$9!#(B
155+
156+
$B"#2~DjMzNr(B
157+
158+
2000/1/15 pgbench-1.2 $B$O(B PostgreSQL $B$K(B contribute $B$5$l$^$7$?!#(B
159+
* -v $B%*%W%7%g%sDI2C(B
160+
161+
1999/09/29 pgbench-1.1 $B%j%j!<%9(B
162+
* $BC+ED$5$s$K$h$k(Bcygwin$BBP1~%Q%C%A<h$j9~$_(B
163+
* $B%P%C%/%(%s%I%/%i%C%7%e;~$NBP1~(B
164+
* -S $B%*%W%7%g%sDI2C(B
165+
166+
1999/09/04 pgbench-1.0 $B%j%j!<%9(B

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp