Skip to content

Commit

Permalink
Final Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
amallia committed Dec 11, 2015
1 parent e937cb2 commit 603e61c
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 43 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/target/
.project
.classpath
/target/
/target/
/target/
/target/
/target/
/target/
/target/
/target/
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ Three different benchmarks have been realized:
- Insert with deferred commit
- Select with a WHERE condition on a primary key

Results are presented as output of the command line. For each benchmark is printed number of query executed, total execution time and mean, maximum, minimum execution time per single query.
When execution starts whole benchmarks are attempted, 1000 queries per benchmarks.

Results are presented as output of the command line. For each benchmark is printed number of query executed, total execution time (in milliseconds) and mean, maximum, minimum execution time per single query.

### Prerequisites

Expand All @@ -21,10 +23,15 @@ docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=password -d postgre
N.B. In case you prefer to use an existing database you can use the init.sql file present inside db folder.

### Configuration
The only parameters to configure are inside db.properties file. You need to specify DB ip, port, name, user and password
The only parameters to configure are inside db.properties file. You need to specify DB ip, port, user and password. If use docker leave default user 'postgres'.

### Packaging and Run
```
mvn clean install
java -jar target/db-benchmark.jar
```
```

Tests
-------
Automatic tests are executed on query builder and prepared statement creation.
We don't provide full tests since this is an example project.
4 changes: 4 additions & 0 deletions db/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ SET default_tablespace = '';

SET default_with_oids = false;

create database bench owner postgres;

\connect bench

--
-- TOC entry 173 (class 1259 OID 16386)
-- Name: emails; Type: TABLE; Schema: public; Owner: postgres; Tablespace:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void run(int runs) {
connection.commit();
connection.close();
log.info(
"N. of Insert executed: {} Total Excution Time: {} us, Mean per query: {} us, Max: {} us, Min: {} us",
"N. of Insert with deferred commit executed: {} Total Excution Time: {} us, Mean per query: {} us, Max: {} us, Min: {} us",
total.getRight(), total.getLeft(),
total.getLeft() / total.getRight(), max, min);
} catch (Exception e) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/db.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dataSourceClassName=org.postgresql.ds.PGSimpleDataSource
minimumIdle=10
dataSource.databaseName=bench
dataSource.user=postgres
dataSource.databaseName=postgres
dataSource.password=password
dataSource.serverName=192.168.99.100
dataSource.portNumber=5432

This file was deleted.

0 comments on commit 603e61c

Please sign in to comment.