Skip to content

Commit a60b4de

Browse files
committed
simplify temporal experiment
1 parent d8a4517 commit a60b4de

File tree

1 file changed

+73
-91
lines changed

1 file changed

+73
-91
lines changed

misc/experiments.md

Lines changed: 73 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,48 @@
11
# README
22

3-
This README elaborates how to reproduce the experiments for choke-points analysis.
3+
This README elaborates how to run the experiments for choke-points analysis.
44

5-
Note: These two experiments are conducted in docker.
5+
## Experiments Environment
66

7-
Docker image: tugraph/tugraph-compile-centos8:1.3.1
7+
These two experiments are conducted in docker.
8+
- Docker image: `tugraph/tugraph-compile-centos8:1.3.1`
9+
- Hardware: Alibaba Cloud `ecs.r6.8xlarge`, 32xIntel Xeon Platinum 8269CY vCPUs, 256GiB RAM
810

9-
Hardware: Alibaba Cloud ecs.r6.8xlarge 32xIntel Xeon Platinum 8269CY vCPUs, 256GiB RAM
11+
## FinBench Datasets
1012

11-
# Temporal Locality in Storage
13+
- [SF 0.1](oss://tugraph-web/tugraph/datasets/finbench/v0.2.0/sf0.1/sf0.1.tar.xz) with [md5
14+
checksum](oss://tugraph-web/tugraph/datasets/finbench/v0.2.0/sf0.1/sf0.1.tar.xz.md5sum)
15+
- [SF 1](oss://tugraph-web/tugraph/datasets/finbench/v0.2.0/sf1/sf1.tar.xz) with [md5
16+
checksum](oss://tugraph-web/tugraph/datasets/finbench/v0.2.0/sf1/sf1.tar.xz.md5sum)
17+
- [SF 3](oss://tugraph-web/tugraph/datasets/finbench/v0.2.0/sf3/sf3.tar.xz) with [md5
18+
checksum](oss://tugraph-web/tugraph/datasets/finbench/v0.2.0/sf3/sf3.tar.xz.md5sum)
19+
- [SF 10](oss://tugraph-web/tugraph/datasets/finbench/v0.2.0/sf10/sf10.tar.xz) with [md5
20+
checksum](oss://tugraph-web/tugraph/datasets/finbench/v0.2.0/sf10/sf10.tar.xz.md5sum)
21+
- [SF 30](oss://tugraph-web/tugraph/datasets/finbench/v0.2.0/sf30/sf30.tar.xz) with [md5
22+
checksum](oss://tugraph-web/tugraph/datasets/finbench/v0.2.0/sf30/sf30.tar.xz.md5sum)
23+
- [SF 100](oss://tugraph-web/tugraph/datasets/finbench/v0.2.0/sf100/sf100.tar.xz) with [md5
24+
checksum](oss://tugraph-web/tugraph/datasets/finbench/v0.2.0/sf100/sf100.tar.xz.md5sum)
1225

13-
The temporal loacality experiment is executed on TuGraph-DB with FinBench SF100 dataset.
26+
## Temporal Locality in Storage
1427

15-
## Resources
16-
17-
- Package: https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/datasets/finbench/v0.2.0/experiments/temporal_locality.zip
18-
19-
- Datasets: https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/datasets/finbench/v0.2.0/sf100/sf100.tar.xz
20-
21-
## Experiment Steps
22-
23-
Execute following steps under current doc's directory, `ldbc_finbench_transaction_impls/misc`.
28+
The temporal locality experiment is executed on TuGraph-DB with FinBench SF100 dataset. The following steps show how to reproduce the temporal locality experiment. Execute following steps under current doc's directory `ldbc_finbench_transaction_impls/misc`.
2429

2530
### Download Experiment Resources
2631

27-
#### Download Experiment Package
28-
Download temporal locality experiment package into current directory.
32+
Download temporal locality experiment package into current directory and download the FinBench sf100 dataset into experiment package directory.
2933

3034
```shell
3135
$ wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/datasets/finbench/v0.2.0/experiments/temporal_locality.zip
3236
$ unzip temporal_locality.zip
33-
```
34-
35-
#### Download FinBench SF100 Dataset
36-
Download the FinBench sf100 dataset into experiment package directory
37-
38-
```shell
3937
$ cd ./temporal_locality
4038
$ wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/datasets/finbench/v0.2.0/sf100/sf100.tar.xz
4139
$ tar -xf ./sf100.tar.xz
4240
$ cd ..
4341
```
4442

45-
### Run Experiment
46-
47-
The following steps show how to reproduce the temporal locality experiment.
43+
### Update Source Code in Query Implementation
4844

49-
#### Update Source Code and Compile Benchmark
50-
51-
The temporal locality experiment uses procedure instead of cypher to execute ComplexRead1, this requires a modification in the source code of tugraph's implementation. Please update the ComplexRead1Handler in `ldbc_finbench_transaction_impls/tugraph/src/main/java/org/ldbcouncil/finbench/impls/tugraph/TuGraphTransactionDb.java`(start from line: 100) with the following code.
45+
The experiment uses procedure to execute `ComplexRead1` instead of Cypher, which requires a modification in the `ComplexRead1Handler` in `ldbc_finbench_transaction_impls/tugraph/src/main/java/org/ldbcouncil/finbench/impls/tugraph/TuGraphTransactionDb.java:100` with the following code.
5246

5347
```java
5448
public static class ComplexRead1Handler implements OperationHandler<ComplexRead1, TuGraphDbConnectionState> {
@@ -90,56 +84,39 @@ public static class ComplexRead1Handler implements OperationHandler<ComplexRead1
9084
}
9185
```
9286

93-
Compile the implementation.
87+
### Compile Benchmark Implementation
88+
89+
compile the implementation.
9490

9591
```shell
9692
$ cd ..
9793
$ mvn clean package
9894
$ cd ./misc
9995
```
10096

101-
#### Start Docker Container
97+
### Start TuGraph-DB in Docker Container
10298

103-
Docker image `tugraph/tugraph-compile-centos8:1.3.1` is required to run tugraph-db for temporal locality experiment.
99+
To run temporal locality experiment in docker `tugraph/tugraph-compile-centos8:1.3.1`, install `tugraph-4.0.0-1.el8.x86_64.rpm` first.
104100

105101
```shell
106102
$ docker pull tugraph/tugraph-compile-centos8:1.3.1
107103
$ docker run -it -v ./temporal_locality:/root/temporal_locality -p 7071:7071 -p 9091:9091 --name=finbench_temporal_loaclity tugraph/tugraph-compile-centos8:1.3.1 /bin/bash
108-
$ exit
109-
```
110-
111-
#### Install TuGraph-DB
112-
113-
Install tugraph-db with `tugraph-4.0.0-1.el8.x86_64.rpm` inside docker container.
114-
115-
```shell
116-
$ docker exec -it finbench_temporal_loaclity /bin/bash
117104
$ cd /root/temporal_locality/
118105
$ rpm -ivh tugraph-4.0.0-1.el8.x86_64.rpm --nodeps
119106
```
120107

121-
use the following command to test if tugraph-db is successfully compile and installed.
122-
```shell
123-
$ lgraph_server --version
124-
```
125-
126-
the output should be like this.
108+
Use the following command to check if it is successfully installed, whose output is like this.
127109

128110
```shell
111+
$ lgraph_server --version
129112
TuGraph v4.0.0, compiled from "finbench" branch, commit "335335f" (web commit "8253763").
130113
CPP compiler version: "GNU" "8.4.0".
131114
Python version : "3.6.9".
132115
```
133116

134-
if installed successfully, exit current container
135-
136-
```shell
137-
$ exit
138-
```
139-
140-
#### Import FinBench SF100 Data
117+
### Preprocess SF100 Dataset
141118

142-
To import sf100 dataset into tugraph-db,the snapshot of sf100 dataset must be converted into compatible data format. This can be done outside of docker container.
119+
Before importing SF100 dataset,we need to preprocess the snapshot of SF100 dataset in terms of the data format. This can be done outside of docker container.
143120

144121
```shell
145122
$ cd ./temporal_locality/sf100
@@ -150,65 +127,73 @@ $ python convert_data.py ./sf100/snapshot.bak ./sf100/snapshot
150127
$ cd ..
151128
```
152129

153-
##### Baseline Mode Data Import
154-
Import the snapshot of sf100 dataset into tugraph-db(baseline).
130+
131+
### Run Baseline Version
132+
133+
Import SF100 dataset with temporal sorting feature disabled. Then start TuGraph-DB server.
155134

156135
```shell
157136
$ docker exec -it finbench_temporal_loaclity /bin/bash
158137
$ cd /root/temporal_locality/sf100/snapshot
159138
$ lgraph_import -c /root/temporal_locality/baseline/import.conf --overwrite 1 --dir /root/lgraph_db_sf100 --delimiter "|" --v3 0
160-
$ exit
139+
$ cd /root/temporal_locality/
140+
$ lgraph_server -c /root/temporal_locality/lgraph_sf100.json -d start
141+
$ exit # exit from the container
161142
```
162143

163-
##### Optimized Mode Data Import
164-
Import the snapshot of sf100 dataset into tugraph-db(optimized).
144+
Load `ComplexRead1` procedure (baseline version) for baseline experiment. Then link sf100 dataset to `./data` directory, and run benchmark
165145

166146
```shell
167-
$ docker exec -it finbench_temporal_loaclity /bin/bash
168-
$ cd /root/temporal_locality/sf100/snapshot
169-
$ lgraph_import -c /root/temporal_locality/optimized/import.conf --overwrite 1 --dir /root/lgraph_db_sf100 --delimiter "|" --v3 0
170-
$ exit
147+
$ cp ./temporal_locality/load_procedure_temporal.sh ../tugraph/scripts
148+
$ chmod u+x ../tugraph/scripts/load_procedure_temporal.sh
149+
$ cp ./temporal_locality/baseline/tcr1.cpp ../tugraph/procedures/cpp
150+
$ ../tugraph/scripts/load_procedure_temporal.sh
151+
$ cd ../tugraph/
152+
$ cd ./data
153+
$ ln -s ../../misc/temporal_locality/sf100 ./sf100
154+
$ cd ..
155+
$ bash run.sh ../misc/temporal_locality/benchmark.properties > temporal_locality.log
156+
$ cd ../misc
171157
```
172158

173-
#### Start TuGraph-DB
159+
The execution and iteration time in `ComplexRead1` is recorded in `temporal_locality.log`.
160+
Collect and analyze the elapsed time with `./temporal_locality/log_data_collector.py`
161+
162+
```shell
163+
$ cd ./temporal_locality
164+
$ python log_data_collector.py ../../tugraph/temporal_locality.log
165+
$ cd ..
166+
```
174167

175-
Start tugraph-db server.
168+
Stop tugraph-db server.
176169

177170
```shell
178171
$ docker exec -it finbench_temporal_loaclity /bin/bash
179172
$ cd /root/temporal_locality/
180-
$ lgraph_server -c /root/temporal_locality/lgraph_sf100.json -d start
173+
$ lgraph_server -d stop
181174
$ exit
182175
```
183176

184-
#### Load Procedure
177+
### Run Optimized Version
185178

186-
Load ComplexRead1's procedure for temporal locality experiment. First copy `load_procedure_temporal.sh` to `ldbc_finbench_transaction_impls/tugraph/scripts`
179+
Import SF100 dataset with temporal sorting feature enabled. Then start TuGraph-DB server.
187180

188181
```shell
189-
$ cp ./temporal_locality/load_procedure_temporal.sh ../tugraph/scripts
190-
$ chmod u+x ../tugraph/scripts/load_procedure_temporal.sh
191-
```
192-
193-
##### Load Baseline Procedure
194-
195-
```shell
196-
$ cp ./temporal_locality/baseline/tcr1.cpp ../tugraph/procedures/cpp
197-
$ ../tugraph/scripts/load_procedure_temporal.sh
182+
$ docker exec -it finbench_temporal_loaclity /bin/bash
183+
$ cd /root/temporal_locality/sf100/snapshot
184+
$ lgraph_import -c /root/temporal_locality/optimized/import.conf --overwrite 1 --dir /root/lgraph_db_sf100 --delimiter "|" --v3 0
185+
$ cd /root/temporal_locality/
186+
$ lgraph_server -c /root/temporal_locality/lgraph_sf100.json -d start
187+
$ exit # exit from the container
198188
```
199189

200-
##### Load Optimized Procedure
190+
Load `ComplexRead1` procedure (optimized version) for optimized experiment. Then link sf100 dataset to `./data` directory, then run temporal locality benchmark.
201191

202192
```shell
193+
$ cp ./temporal_locality/load_procedure_temporal.sh ../tugraph/scripts
194+
$ chmod u+x ../tugraph/scripts/load_procedure_temporal.sh
203195
$ cp ./temporal_locality/optimized/tcr1.cpp ../tugraph/procedures/cpp
204196
$ ../tugraph/scripts/load_procedure_temporal.sh
205-
```
206-
207-
#### Run Benchmark
208-
209-
Go to `ldbc_finbench_transaction_impls/tugraph`, link sf100 dataset to `./data` directory, then run temporal locality benchmark
210-
211-
```shell
212197
$ cd ../tugraph/
213198
$ cd ./data
214199
$ ln -s ../../misc/temporal_locality/sf100 ./sf100
@@ -217,18 +202,15 @@ $ bash run.sh ../misc/temporal_locality/benchmark.properties > temporal_locality
217202
$ cd ../misc
218203
```
219204

220-
#### Collect Log Data
221-
222-
The execution time and iteration time in ComplexRead1 is recorded in `temporal_locality.log`, collect and analyze the information with `./temporal_locality/log_data_collector.py`
205+
The execution and iteration time in `ComplexRead1` is recorded in `temporal_locality.log`.
206+
Collect and analyze the information with `./temporal_locality/log_data_collector.py`
223207

224208
```shell
225209
$ cd ./temporal_locality
226210
$ python log_data_collector.py ../../tugraph/temporal_locality.log
227211
$ cd ..
228212
```
229213

230-
#### Stop TuGraph-DB
231-
232214
Stop tugraph-db server.
233215

234216
```shell

0 commit comments

Comments
 (0)