• Home
  • What's Tribler
  • Download
  • FAQ
  • Forum
Tribler

Wiki Navigation


Performance Test

DBs:

DB #peers#torrents#preferences#peers_have_pref
Huge 25K 125K 297859 22883
Big 20K 25K 235916 18247
Middle 10K 5K 118320 9191
Small 5K 1K 60618 4604
Tiny 1K 0.2K 12141 926

If the DB has no index:

CREATE UNIQUE INDEX permid_idx ON Peer(permid);
CREATE UNIQUE INDEX infohash_idx ON Infohash(infohash);
CREATE UNIQUE INDEX pref_idx ON Preference(peer_id, torrent_id);
CREATE UNIQUE INDEX bartercast_idx ON BarterCast(peer_id_from, peer_id_to);

If the DB has index:

CREATE UNIQUE INDEX permid_idx ON Peer(permid);
CREATE UNIQUE INDEX infohash_idx ON Infohash(infohash);
CREATE UNIQUE INDEX pref_idx ON Preference(peer_id, torrent_id);
CREATE UNIQUE INDEX bartercast_idx ON BarterCast(peer_id_from, peer_id_to);

CREATE INDEX Torrent_length_idx on Torrent(length);
CREATE INDEX Torrent_creation_date_idx on Torrent(creation_date);
CREATE INDEX Torrent_seeder_idx on Torrent(seeder);
CREATE INDEX Torrent_leecher_idx on Torrent(leecher);
CREATE INDEX Torrent_relevance_idx on Torrent(relevance);
CREATE INDEX Torrent_source_idx on Torrent(source);
CREATE INDEX Torrent_name_idx on Torrent(name);
CREATE INDEX Torrent_category_idx on Torrent(category);

CREATE INDEX Peer_last_connected_idx on Peer(last_connected);
CREATE INDEX Peer_ntorrents_idx on Peer(ntorrents);
CREATE INDEX Peer_npeers_idx on Peer(npeers);
CREATE INDEX Peer_similarity_idx on Peer(similarity);
CREATE INDEX Peer_name_idx on Peer(name);

CREATE INDEX Preference_peer_id_idx on Preference(peer_id);
CREATE INDEX Preference_torrent_id_idx on Preference(torrent_id);

create SQLite DB:

DB convert_time (no index) convert_time (no index) only create indexes Size (no index) Size (index)
Huge 59.4 267.6 20.857 54.6M 81.4M
Big 34.4 47.8 8.937 29.3M 39.8M
Middle 17.8 23.8 4.515 14.1M 18.3M
Small 10.4 14.7 2.500 7.2M 9.08M
Tiny 4.7 6.1 1.750 1.6M 1.94M

Speed of paging. (20 records per page)

SQL: SELECT * FROM ? ORDER BY ? LIMIT ? OFFSET ?;

Page Torrents (no index):

sort by tiny smallmiddlebighug
#Torrents 200 1000 5000 25000 125000
None 0.0016 0.0009 0.0031 0.0137 0.0531
length 0.0031 0.0150 0.1197 1.2813 29.7703
creation_date 0.0031 0.0153 0.1216 1.0492 22.3547
seeder 0.0032 0.0153 0.0884 0.5597 3.4765
leecher 0.0031 0.0153 0.0834 0.5047 3.3985
relevance 0.0031 0.0159 0.1094 1.1683 19.2765
source 0.0031 0.0128 0.0672 0.3500 2.0266
name 0.0032 0.0191 0.1738 1.9421 66.1547
avg sec/page 0.0031 0.0155 0.1091 0.9793 20.9225
avg pages/sec 319.6 64.4 9.2 1.0 0.0

Page Torrent (index):

sort by tiny smallmiddlebighug
#Torrents 200 1000 5000 25000 125000
None 0.0000 0.0009 0.0031 0.0131 0.0569
length 0.0000 0.0003 0.0013 0.0062 0.0234
creation_date 0.0000 0.0006 0.0012 0.0056 0.0228
seeder 0.0016 0.0006 0.0013 0.0047 0.0241
leecher 0.0000 0.0006 0.0012 0.0053 0.0228
relevance 0.0000 0.0006 0.0016 0.0063 0.0284
source 0.0000 0.0003 0.0009 0.0044 0.0244
name 0.0015 0.0009 0.0022 0.0106 0.0544
avg_sec/page 0.0004 0.0006 0.0014 0.0062 0.0286
avg_pages/sec 2258.1 1724.1 721.6 162.3 35.0

Page Peers (no index):

sort by tiny smallmiddlebighug
#Peers 1000 5000 10000 20000 25000
None 0.0006 0.0037 0.0066 0.0122 0.0138
last_connected 0.0159 0.1047 0.3050 0.7843 1.0400
ntorrents 0.0125 0.0762 0.1700 0.3369 0.4013
npeers 0.0131 0.0831 0.1647 0.3228 0.4122
similarity 0.0166 0.0922 0.2056 0.4428 0.5353
name 0.0178 0.1175 0.3209 0.7656 1.0449
avg sec/page 0.0152 0.0948 0.2332 0.5305 0.6867
avg pages/sec 65.8 10.6 4.3 1.9 1.5

Page Peer (index):

sort by tiny smallmiddlebighug
#Peers 1000 5000 10000 20000 25000
None 0.0006 0.0031 0.0081 0.0141 0.0134
last_connected 0.0003 0.0013 0.0022 0.0041 0.0047
ntorrents 0.0006 0.0016 0.0025 0.0041 0.0056
npeers 0.0003 0.0009 0.0019 0.0041 0.0062
similarity 0.0006 0.0012 0.0025 0.0044 0.0047
name 0.0006 0.0013 0.0025 0.0041 0.0062
avg sec/page 0.0005 0.0013 0.0023 0.0041 0.0055
avg pages/sec 2000.0 798.7 432.5 242.5 181.8

Select a category and sort by seeder (no index)

DB Type tiny small middle big huge
#Torrents 200 1000 5000 25000 125000
Video 0.0015 0.0066 0.0331 0.2219 1.5671
VideoClips? 0.0016 0.0019 0.0094 0.0381 0.1903
Audio 0.0015 0.0044 0.0203 0.1156 0.6821
Compressed 0.0000 0.0053 0.0256 0.1637 0.9284
Document 0.0016 0.0019 0.0094 0.0372 0.1665
Picture 0.0000 0.0019 0.0084 0.0334 0.1462
xxx 0.0016 0.0028 0.0141 0.0694 0.4465
other 0.0015 0.0034 0.0178 0.0975 0.5662
avg sec/page 0.0011 0.0031 0.0150 0.0793 0.4466
avg pages/sec 897.4 324.7 66.7 12.6 2.2

Select a category and sort by seeder (index):

DB Type tiny small middle big huge
#Torrents 200 1000 5000 25000 125000
Video 0.0016 0.0075 0.0359 0.2265 1.5196
VideoClips? 0.0000 0.0009 0.0028 0.0131 0.0840
Audio 0.0015 0.0041 0.0197 0.1112 0.6771
Compressed 0.0016 0.0056 0.0253 0.1640 0.8808
Document 0.0000 0.0009 0.0031 0.0106 0.0556
Picture 0.0016 0.0006 0.0016 0.0053 0.0287
xxx 0.0000 0.0022 0.0106 0.0553 0.3634
other 0.0015 0.0028 0.0150 0.0919 0.5118
avg sec/page 0.0009 0.0025 0.0112 0.0645 0.3716
avg pages/sec 1129.0 407.5 89.6 15.5 2.7

Recommend Torrents (average time to recommend torrents given a torrent, run 200 times)

DB Type Speed (no index on Preference) Speed (index on Preference)
tiny 0.0032 0.0001
small 0.0205 0.0006
middle 0.0490 0.0056
big 0.1397 0.0590
huge 2.0462 0.6309

Browse Peer Download History (average time to retrieve one peer's download history, run 2000 times)

DB Type Speed (no index on Preference) Speed (index on Preference)
tiny 0.0005 0.0005
small 0.0005 0.0005
middle 0.0006 0.0005
big 0.0006 0.0006
huge 0.0009 0.0007

SQLite vs. Transaction BSDDB

We already did some initial performance tests https://www.tribler.org/DatabaseMigration. This time I use log files from a normal and active peer, instead of a superpeer. For SQLite, I use PySQLite library, without any special setting such as share cache or performance tuning. For BSDDB transaction mode, I also only use the default setting, i.e., no performance tuning by special parameters.

I will study to the performance of the two databases based on 5 operations: receive and send buddycast messages, add and close overlay connections, and receive collected torrents. For the keyword search from others, the additional things to do is to get some candidates ip, port, which could be cached if the candidates are stable (friends and connected peers), so I think it's negligible.

In addition, I will test the speed of keyword search by SQLite (BSDDB is not used for keyword search since we store the metadata of torrents in memory).

SQLite has two setups. One with basic indexes, and the other with more indexes for GUI. The speed between them will be compared as well.

SQLITE with basic indexes:
CREATE UNIQUE INDEX permid_idx ON PeerDB(permid);
CREATE UNIQUE INDEX infohash_idx ON InfohashDB(infohash);
CREATE UNIQUE INDEX pref_idx ON PreferenceDB(peer_id, torrent_id);

SQLITE with more indexes (it also includes the basic indexes):
Indexes in PeerDB: ip, last_connected, last_seen, ntorrents, npeers, similarity, name
Indexes in TorrentDB: length, creation_date, seeder, leecher, relevance, name, category
Indexes in PreferenceDB: peer_id, torrent_id

Average time per operation, after executed 1000 the same operations with different data

DB SEND_BC RECV_BC CONN_ADD CONN_DEL COLLECT_TORRENT
TransBSDDB 0.00229 0.02326 0.00181 0.00172 ?
SQLite basic 0.01314 0.25102 0.11437 0.00038
SQLite more indexes 0.01344 0.40737 0.18140 0.00073

Average time per operation, after executed 10000 the same operations with different data

DB SEND_BC RECV_BC CONN_ADD CONN_DEL
TransBSDDB 0.00101 0.02610 0.00078 0.00068
SQLite basic 0.01429 0.23774 0.11309 0.00054
SQLite more indexes 0.01396 0.46806 0.18220 0.00065

Average time to write DB when collected a torrent, after collected 4847 torrents.

DB min average max
SQLite basic 0.0620 0.08494 0.4540
SQLite more indexes 0.0620 0.10655 0.7510

Average time per keyword search over 5000 torrents, run 100 times per query.
There are 9723 terms in 4847 torrents' titles, after removed stop words.

popularity rank frequency query more indexes (5K) basic indexes (5K) more indexes (125K) basic index (125)
1 1877 xvid 0.01600 0.01600 0.28100 0.28200
2 1813 2007 0.01500 0.00000 0.26600 0.28100
3 1466 avi 0.00000 0.01600 0.28100 0.28200
4 1296 dvdrip 0.01600 0.01500 0.28200 0.28100
5 767 hdtv 0.00000 0.00000 0.25000 0.22000
6 600 rar 0.01600 0.00000 0.28200 0.29700
7 548 eng 0.00000 0.01600 0.26600 0.25000
8 337 xxx 0.01500 0.00000 0.23500 0.23500
9 336 axxo 0.00000 0.01600 0.23500 0.23500
10 324 wmv 0.00000 0.00000 0.26600 0.25000
11 276 dvd 0.01600 0.01500 0.31300 0.29700
12 261 sex 0.00000 0.00000 0.25000 0.28200
13 233 xor 0.01600 0.01600 0.21900 0.25000
14 226 zip 0.00000 0.00000 0.23500 0.26600
15 224 heroes 0.01500 0.00000 0.21900 0.21900
16 217 2006 0.00000 0.01600 0.23500 0.26600
17 189 keygen 0.01600 0.00000 0.23400 0.23500
18 175 edition 0.00000 0.00000 0.23500 0.28200
19 174 ts 0.01600 0.01500 0.28200 0.26600
20 171 english 0.00000 0.00000 0.23400 0.28100
21 162 pro 0.00000 0.01600 0.25100 0.25100
22 160 ac3 0.01500 0.00000 0.23400 0.23400
23 152 mp3 0.00000 0.01600 0.23500 0.23500
24 150 iso 0.01600 0.00000 0.25100 0.25000
25 148 cd 0.00000 0.00000 0.25000 0.25100
26 146 2008 0.00000 0.01500 0.23500 0.21900
27 144 break 0.01500 0.00000 0.21900 0.21900
28 143 prison 0.00000 0.01600 0.21900 0.23400
29 141 video 0.01600 0.00000 0.23400 0.23500
30 137 proper 0.00000 0.00000 0.21900 0.23500
31 137 movie 0.00000 0.01500 0.23500 0.25000
32 134 season 0.01600 0.00000 0.23500 0.23500
33 133 adobe 0.00000 0.00000 0.23500 0.23500
34 132 crack 0.00000 0.01600 0.23400 0.23400
35 131 pc 0.01500 0.00000 0.23500 0.23500
36 131 lol 0.00000 0.00000 0.21900 0.25000
37 125 german 0.01600 0.01600 0.23500 0.21900
38 123 divx 0.00000 0.00000 0.23400 0.23500
39 120 complete 0.00000 0.01500 0.23500 0.23500
40 117 dvdr 0.01600 0.00000 0.26600 0.26600
41 112 cam 0.00000 0.00000 0.23500 0.23400
42 111 hot 0.01500 0.01600 0.23400 0.22000
43 110 porn 0.00000 0.01600 0.23500 0.25000
44 110 notv 0.00000 0.00000 0.21900 0.21900
45 110 french 0.01600 0.00000 0.23500 0.23500
46 108 vtv 0.00000 0.01500 0.21900 0.21900
47 108 mpg 0.00000 0.00000 0.21900 0.23400
48 106 caph 0.01600 0.01600 0.21900 0.21900
49 103 dsr 0.00000 0.00000 0.23500 0.22000
50 100 transformers 0.01500 0.00000 0.21900 0.23400
51 98 va 0.00000 0.01600 0.25000 0.23500
52 96 house 0.00000 0.00000 0.25100 0.23500
53 95 windows 0.01600 0.00000 0.25000 0.21900
54 95 incl 0.00000 0.01500 0.23500 0.23400
55 94 dvdscr 0.01600 0.00000 0.23400 0.23500
56 93 07 0.00000 0.01600 0.29800 0.28200
57 91 pal 0.00000 0.00000 0.25000 0.29700
58 89 x264 0.01500 0.01600 0.25000 0.23500
59 89 simpsons 0.00000 0.00000 0.25100 0.21900
60 88 microsoft 0.01600 0.00000 0.25000 0.23400
61 88 collection 0.00000 0.01500 0.25000 0.21900
62 86 pdtv 0.00000 0.00000 0.25100 0.23500
63 85 american 0.01600 0.00000 0.25000 0.23500
64 84 home 0.00000 0.01600 0.23500 0.21900
65 84 girls 0.00000 0.00000 0.23400 0.25000
66 84 cs3 0.01500 0.01600 0.25100 0.21900
67 83 torrent 0.00000 0.00000 0.46900 0.25100
68 83 best 0.01600 0.00000 0.39100 0.23400
69 82 rip 0.00000 0.01500 0.31300 0.28200
70 80 ws 0.00000 0.00000 0.23500 0.25000
71 80 big 0.01500 0.01600 0.21900 0.25100
72 79 h33t 0.00000 0.00000 0.23500 0.23400
73 77 vostfr 0.01600 0.00000 0.21900 0.21900
74 76 tape 0.00000 0.01500 0.26600 0.29800
75 75 night 0.00000 0.00000 0.23400 0.23400
76 75 evil 0.01600 0.01600 0.23500 0.25100
77 74 psp 0.00000 0.00000 0.21900 0.25000
78 74 kvcd 0.00000 0.00000 0.23500 0.26600
79 74 die 0.01500 0.01600 0.23500 0.26600
80 73 resident 0.00000 0.00000 0.21900 0.28200
81 72 ultimate 0.01600 0.00000 0.23400 0.26600
82 72 office 0.00000 0.01500 0.21900 0.26600
83 71 torrentazos 0.00000 0.00000 0.23500 0.26600
84 70 world 0.01600 0.01600 0.21900 0.25000
85 69 game 0.00000 0.00000 0.23500 0.23500
86 68 vol 0.00000 0.00000 0.25000 0.23500
87 68 unrated 0.01500 0.01600 0.23500 0.23400
88 67 hard 0.00000 0.00000 0.21900 0.23500
89 66 weeds 0.01600 0.01500 0.25000 0.21900
90 66 release 0.01600 0.00000 0.26600 0.23500
91 66 r5 0.00000 0.01600 0.26600 0.23400
92 66 ntsc 0.01500 0.00000 0.25100 0.39200
93 66 live 0.01600 0.00000 0.23400 0.32800
94 65 teen 0.00000 0.01600 0.26600 0.23500
95 65 photoshop 0.01600 0.00000 0.26600 0.21900
96 65 anal 0.00000 0.00000 0.23500 0.23500
97 65 08 0.01500 0.01500 0.25000 0.23400
98 64 swesub 0.00000 0.00000 0.25100 0.21900
99 64 retail 0.00000 0.01600 0.23400 0.23500
100 64 black 0.01600 0.00000 0.23500 0.23500
min 0.0 0.0 0.21900 0.21900
avg 0.00635 0.00636 0.23718 0.24431
max 0.0160 0.0160 0.37500 0.39200
popularity rank frequency query more indexes (5K) basic indexes (5K) more indexes (125K) basic index (125)

Keyword search on phrases:

Phrase number of results more indexes (5K) basic indexes (5K) more indexes (125K) basic indexes (125K)
resident evil 47 0.00000 0.00000 0.250.219
prison break 81 0.00000 0.01600 0.2190.22
the simpsons 48 0.00000 0.00000 0.2350.234
harry potter 27 0.01500 0.00000 0.2350.219
desperate housewives 30 0.00000 0.01500 0.2660.235
american gangster 56 0.01600 0.00000 0.2340.235
AVERAGE 48.2 0.0052 0.0052 0.227 0. 240

Maximum memory usage: 8.7MB (main memory) + 7.8MB (virtual memory)

Open Questions

Store thumbnail in db or disk?

solution 1: on db:

1.1: on Peer table
1.2: on another table
1.3: on another db

solution 2: on disk

1.1: use one flag in Peer table
1.2: check disk every time

Attachments

  • pop_removed_stop_words.txt (144.1 kB) -Term frequency of about 5K collected torrents, added by jyang on 11/21/07 14:05:50.

Latest news

28 October 2008

The long-awaited Tribler 4.5 is here''

29 April 2008

Tribler Team organized a successful course on Advanced P2P Technology
Read More

17 February 2008

19 Million Euro for P2P research
Read More

Please contact us if you have found a news item that's not listed here.


  • News
  • Developers
  • Business
  • Research
  • Jobs
  • About Us
  • Press
  • Contact
Login