Skip to content

Commit 37880be

Browse files
committed
Add the script for automatic benchmarking
1 parent b03ecaf commit 37880be

12 files changed

Lines changed: 162 additions & 22 deletions

Core/SDSSECQClient.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Zr SDSSECQClient::Fp(uint8_t *input, size_t input_size, uint8_t *key) {
99
return Zr(*e, (void*) PRF, DIGEST_SIZE);
1010
}
1111

12-
SDSSECQClient::SDSSECQClient(int del_size) {
12+
SDSSECQClient::SDSSECQClient(int ins_size, int del_size) {
1313
// generate or load pairing
1414
FILE *sysParamFile = fopen("pairing.param", "r");
1515
e = new Pairing(sysParamFile);
@@ -35,8 +35,8 @@ SDSSECQClient::SDSSECQClient(int del_size) {
3535
fclose(saved_g);
3636

3737
// initialise SSE instance
38-
TEDB = new SSEClientHandler(del_size);
39-
XEDB = new SSEClientHandler(del_size);
38+
TEDB = new SSEClientHandler(ins_size, del_size);
39+
XEDB = new SSEClientHandler(ins_size, del_size);
4040
}
4141

4242
void SDSSECQClient::update(OP op, const string& keyword, int ind) {

Core/SDSSECQClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SDSSECQClient {
2929
Zr Fp(uint8_t *input, size_t input_size, uint8_t *key);
3030

3131
public:
32-
explicit SDSSECQClient(int del_size);
32+
explicit SDSSECQClient(int ins_size, int del_size);
3333
void update(OP op, const string& keyword, int ind);
3434
vector<int> search(int count, ...);
3535
};

Core/SDSSECQSClient.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Zr SDSSECQSClient::Fp(uint8_t *input, size_t input_size, uint8_t *key) {
1010
}
1111

1212

13-
SDSSECQSClient::SDSSECQSClient(int del_size) {
13+
SDSSECQSClient::SDSSECQSClient(int ins_size, int del_size) {
1414
// generate or load pairing
1515
FILE *sysParamFile = fopen("pairing.param", "r");
1616
e = new Pairing(sysParamFile);
@@ -36,8 +36,8 @@ SDSSECQSClient::SDSSECQSClient(int del_size) {
3636
fclose(saved_g);
3737

3838
// initialise SSE instance
39-
TEDB = new SSEClientHandler(del_size);
40-
XEDB = new SSEClientHandler(del_size);
39+
TEDB = new SSEClientHandler(ins_size, del_size);
40+
XEDB = new SSEClientHandler(ins_size, del_size);
4141
}
4242

4343
void SDSSECQSClient::update(OP op, const string& keyword, int ind) {

Core/SDSSECQSClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class SDSSECQSClient {
3535
Zr Fp(uint8_t *input, size_t input_size, uint8_t *key);
3636

3737
public:
38-
explicit SDSSECQSClient(int del_size);
38+
explicit SDSSECQSClient(int ins_size, int del_size);
3939
void update(OP op, const string& keyword, int ind);
4040
vector<int> search(int count, ...);
4141
};

Core/SSEClientHandler.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#include "SSEClientHandler.h"
22

3-
SSEClientHandler::SSEClientHandler(int del_size) {
4-
this->GGM_SIZE = get_BF_size(HASH_SIZE, del_size, GGM_FP);
3+
SSEClientHandler::SSEClientHandler(int ins_size, int del_size) {
4+
if (del_size == 0) {
5+
this->GGM_SIZE = get_BF_size(HASH_SIZE, ins_size, GGM_FP);
6+
} else {
7+
this->GGM_SIZE = get_BF_size(HASH_SIZE, del_size, GGM_FP);
8+
}
59
this->delete_bf = new BloomFilter<32, HASH_SIZE>(GGM_SIZE);
610
// init the GGM Tree
711
tree = new GGMTree(GGM_SIZE);

Core/SSEClientHandler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class SSEClientHandler {
1919

2020
SSEServerHandler *server;
2121
public:
22-
SSEClientHandler(int del_size);
22+
SSEClientHandler(int ins_size, int del_size);
2323
~SSEClientHandler();
2424
void update(OP op, const string& keyword, int ind, uint8_t* content, size_t content_len);
2525
vector<string> search(const string& keyword);

Data/Evaluation

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
#!/bin/bash
2+
3+
echo "Benchmark for SDSSE-CQ/SDSSE-CQ-S"
4+
5+
echo -e "\nExperiment: SDSSE-CQ Search Time with Constant |w1| (without deletion)"
6+
7+
echo -e "\nw1 = 10, w2 = 10"
8+
../build/SDSSECQ 10 10 0
9+
10+
echo -e "\nw1 = 10, w2 = 100"
11+
../build/SDSSECQ 10 100 0
12+
13+
echo -e "\nw1 = 10, w2 = 1000"
14+
../build/SDSSECQ 10 1000 0
15+
16+
echo -e "\nw1 = 10, w2 = 10000"
17+
../build/SDSSECQ 10 10000 0
18+
19+
echo -e "\nw1 = 10, w2 = 100000"
20+
../build/SDSSECQ 10 100000 0
21+
22+
echo -e "\nExperiment: SDSSE-CQ-S Search Time with Constant |w1| (without deletion)"
23+
24+
echo -e "\nw1 = 10, w2 = 10"
25+
../build/SDSSECQS 10 10 0
26+
27+
echo -e "\nw1 = 10, w2 = 100"
28+
../build/SDSSECQS 10 100 0
29+
30+
echo -e "\nw1 = 10, w2 = 1000"
31+
../build/SDSSECQS 10 1000 0
32+
33+
echo -e "\nw1 = 10, w2 = 10000"
34+
../build/SDSSECQS 10 10000 0
35+
36+
echo -e "\nw1 = 10, w2 = 100000"
37+
../build/SDSSECQS 10 100000 0
38+
39+
echo -e "\nExperiment: SDSSE-CQ Search Time with Constant |w1| (with 10% deletion)"
40+
41+
echo -e "\nw1 = 10, w2 = 10"
42+
../build/SDSSECQ 10 10 1
43+
44+
echo -e "\nw1 = 10, w2 = 100"
45+
../build/SDSSECQ 10 100 1
46+
47+
echo -e "\nw1 = 10, w2 = 1000"
48+
../build/SDSSECQ 10 1000 1
49+
50+
echo -e "\nw1 = 10, w2 = 10000"
51+
../build/SDSSECQ 10 10000 1
52+
53+
echo -e "\nw1 = 10, w2 = 100000"
54+
../build/SDSSECQ 10 100000 1
55+
56+
echo -e "\nExperiment: SDSSE-CQ-S Search Time with Constant |w1| (with 10% deletion)"
57+
58+
echo -e "\nw1 = 10, w2 = 10"
59+
../build/SDSSECQS 10 10 1
60+
61+
echo -e "\nw1 = 10, w2 = 100"
62+
../build/SDSSECQS 10 100 1
63+
64+
echo -e "\nw1 = 10, w2 = 1000"
65+
../build/SDSSECQS 10 1000 1
66+
67+
echo -e "\nw1 = 10, w2 = 10000"
68+
../build/SDSSECQS 10 10000 1
69+
70+
echo -e "\nw1 = 10, w2 = 100000"
71+
../build/SDSSECQS 10 100000 1
72+
73+
echo -e "\nExperiment: SDSSE-CQ Search Time with Constant |w2| (without deletion)"
74+
echo -e "\nw1 = 10, w2 = 10"
75+
../build/SDSSECQ 10 10 0
76+
77+
echo -e "\nw1 = 100, w2 = 10"
78+
../build/SDSSECQ 100 10 0
79+
80+
echo -e "\nw1 = 1000, w2 = 10"
81+
../build/SDSSECQ 1000 10 0
82+
83+
echo -e "\nw1 = 10000, w2 = 10"
84+
../build/SDSSECQ 10000 10 0
85+
86+
echo -e "\nw1 = 100000, w2 = 10"
87+
../build/SDSSECQ 100000 10 0
88+
89+
echo -e "\nExperiment: SDSSE-CQ-S Search Time with Constant |w2| (without deletion)"
90+
echo -e "\nw1 = 10, w2 = 10"
91+
../build/SDSSECQS 10 10 0
92+
93+
echo -e "\nw1 = 100, w2 = 10"
94+
../build/SDSSECQS 100 10 0
95+
96+
echo -e "\nw1 = 1000, w2 = 10"
97+
../build/SDSSECQS 1000 10 0
98+
99+
echo -e "\nw1 = 10000, w2 = 10"
100+
../build/SDSSECQS 10000 10 0
101+
102+
echo -e "\nw1 = 100000, w2 = 10"
103+
../build/SDSSECQS 100000 10 0
104+
105+
echo -e "\nExperiment: SDSSE-CQ Search Time with Constant |w2| (with 10% deletion)"
106+
echo -e "\nw1 = 10, w2 = 10"
107+
../build/SDSSECQ 10 10 1
108+
109+
echo -e "\nw1 = 100, w2 = 10"
110+
../build/SDSSECQ 100 10 10
111+
112+
echo -e "\nw1 = 1000, w2 = 10"
113+
../build/SDSSECQ 1000 10 100
114+
115+
echo -e "\nw1 = 10000, w2 = 10"
116+
../build/SDSSECQ 10000 10 1000
117+
118+
echo -e "\nw1 = 100000, w2 = 10"
119+
../build/SDSSECQ 100000 10 10000
120+
121+
echo -e "\nExperiment: SDSSE-CQ-S Search Time with Constant |w2| (with 10% deletion)"
122+
echo -e "\nw1 = 10, w2 = 10"
123+
../build/SDSSECQS 10 10 1
124+
125+
echo -e "\nw1 = 100, w2 = 10"
126+
../build/SDSSECQS 100 10 10
127+
128+
echo -e "\nw1 = 1000, w2 = 10"
129+
../build/SDSSECQS 1000 10 100
130+
131+
echo -e "\nw1 = 10000, w2 = 10"
132+
../build/SDSSECQS 10000 10 1000
133+
134+
echo -e "\nw1 = 100000, w2 = 10"
135+
../build/SDSSECQS 100000 10 10000

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,12 @@ As mentioned, the current implementation is a proof-of-concept prototype.To eval
105105
#### Dataset Size
106106
The source code of those test programs can be found in the root path of the project, namely `SDSSECQ.cpp` and `SDSSECQS.cpp`. The code in this repository inserts 1000 files with two keywords "Alice" and "Bob", deletes 100 files (10% deletion), and then executes the conjunctive query ("Alice" AND "Bob"). To enlarge the size of dataset, one can modify the above two files by increasing the numbers of insertions/deletions or adding more keywords.
107107

108-
Besides, as the number of keyword-id pairs increases, we should use a larger Bloom filter to keep the XSet for conjunctive queries. Hence, the `XSET_SIZE` and `XSET_HASH` in `Util
109-
/CommonUtil.h` should be updated accordingly. Note that the current parameters `XSET_SIZE=2875518` and `XSET_HASH=20` can support conjunctive queries against a dataset with 100k keyword-id pairs with less than 10^-7 false positive rate. We would refer our readers to [here](https://hur.st/bloomfilter/) to compute the new Bloom filter parameters as required.
108+
Besides, as the number of keyword-id pairs increases, we should use a larger Bloom filter to keep the XSet for conjunctive queries. Hence, the `MAX_DB_SIZE`, `XSET_FP`, and `XSET_HASH` in `Util
109+
/CommonUtil.h` should be updated accordingly. Note that the current parameters `MAX_DB_SIZE=100000`, `XSET_FP=0.0000001` and `XSET_HASH=20` can support conjunctive queries against a dataset with 100k keyword-id pairs with less than 10^-7 false positive rate.
110110

111111
#### Deletion
112-
Since the deletion is also based on Bloom filter, there are another two Bloom filter parameters, i.e., `GGM_SIZE` and `HASH_SIZE` to be set with the increasing number of deletion operations. The current parameters are `GGM_SIZE=579521` and `HASH_SIZE=5`, which are sufficient for 100 deletions (with only 10^-21 false positive rate) in the test code. Please also update these two parameters when the number of deletion increases by referring to the above Bloom filter calculator.
112+
Since the deletion is also based on Bloom filter, there are another two Bloom filter parameters, i.e., `GGM_FP` and `HASH_SIZE` to be set to help the code automatically derive the Bloom filter size for the GGM tree.
113+
The current parameters are `GGM_FP=0.0001` and `HASH_SIZE=5`, which is designed to achieve 10^-4 false positive rate with the 5 hash functions in the test code. Please also update these two parameters if you are looking for a smaller false positive rate or GGM tree size (more hash functions lead to a smaller tree).
113114

114115
### Main Results and Claims
115116

SDSSECQ.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ int main(int argc, char *argv[]) {
1515
int w2_size = atoi(argv[2]);
1616
int del_size = atoi(argv[3]);
1717

18-
SDSSECQClient client(del_size);
18+
SDSSECQClient client(1, del_size);
1919

2020
auto start = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
2121
for (int i = 0; i < w1_size; ++i) {
@@ -37,10 +37,10 @@ int main(int argc, char *argv[]) {
3737
start = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
3838
vector<int> single_results = client.search(1, "alice");
3939
end = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
40-
cout << "Single Keyword Search Time: " << (end - start) / 1000 << " ms" << endl;
40+
cout << "Single Keyword Search Time: " << (float)(end - start) / 1000 << " ms" << endl;
4141
start = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
4242
vector<int> conjunctive_results = client.search(2, "alice", "bob");
4343
end = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
44-
cout << "Two-Keyword Conjunctive Search Time: " << (end - start) / 1000 << " ms" << endl;
44+
cout << "Two-Keyword Conjunctive Search Time: " << (float)(end - start) / 1000 << " ms" << endl;
4545
return 0;
4646
}

SDSSECQS.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ int main(int argc, char *argv[]) {
1515
int w2_size = atoi(argv[2]);
1616
int del_size = atoi(argv[3]);
1717

18-
SDSSECQSClient client(del_size);
18+
SDSSECQSClient client(1, del_size);
1919

2020
auto start = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
2121
for (int i = 0; i < w1_size; ++i) {
@@ -37,10 +37,10 @@ int main(int argc, char *argv[]) {
3737
start = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
3838
vector<int> single_results = client.search(1, "alice");
3939
end = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
40-
cout << "Single Keyword Search Time: " << (end - start) / 1000 << " ms" << endl;
40+
cout << "Single Keyword Search Time: " << (float)(end - start) / 1000 << " ms" << endl;
4141
start = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
4242
vector<int> conjunctive_results = client.search(2, "alice", "bob");
4343
end = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
44-
cout << "Two-Keyword Conjunctive Search Time: " << (end - start) / 1000 << " ms" << endl;
44+
cout << "Two-Keyword Conjunctive Search Time: " << (float)(end - start) / 1000 << " ms" << endl;
4545
return 0;
4646
}

0 commit comments

Comments
 (0)