File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -10,22 +10,22 @@ import (
1010)
1111
1212const (
13- TRANSFER_CONNECTIONS = 10
13+ TRANSFER_CONNECTIONS = 4
1414 INIT_AMOUNT = 10000
15- N_ITERATIONS = 10000
16- N_ACCOUNTS = 100000
15+ N_ITERATIONS = 100000
16+ N_ACCOUNTS = 16
1717)
1818
1919
2020var cfg1 = pgx.ConnConfig {
21- Host : "astro9 " ,
22- Port : 15432 ,
21+ Host : "localhost " ,
22+ Port : 5432 ,
2323 Database : "postgres" ,
2424 }
2525
2626var cfg2 = pgx.ConnConfig {
27- Host : "astro9 " ,
28- Port : 15433 ,
27+ Host : "localhost " ,
28+ Port : 5433 ,
2929 Database : "postgres" ,
3030 }
3131
@@ -109,8 +109,8 @@ func transfer(id int, wg *sync.WaitGroup) {
109109
110110 gtid := strconv .Itoa (id ) + "." + strconv .Itoa (i )
111111 amount := 2 * rand .Intn (2 ) - 1
112- account1 := 2 * id + 1
113- account2 := 2 * id + 2
112+ account1 := rand . Intn ( N_ACCOUNTS )
113+ account2 := rand . Intn ( N_ACCOUNTS )
114114
115115 exec (conn1 , "begin transaction" )
116116 exec (conn2 , "begin transaction" )
You can’t perform that action at this time.
0 commit comments