Details
OpenLink Software
Burlington, United States
Subscribe
Post Categories
Recent Articles
Community Member Blogs
Display Settings
Translate
|
Showing posts in all categories Refresh
Benchmarks, Redux (part 6): BSBM and I/O, continued
[
Orri Erling
]
In the words of Jim Gray, disks have become tapes. By this he means that a disk is really only good for sequential access. For this reason, the SSD extent read ahead was incomparably better. We note that in the experiment, every page in the general area of the database the experiment touched would in time be touched, and that the whole working set would end up in memory. Therefore no speculative read would be wasted. Therefore it stands to reason to read whole extents.
So I changed the default behavior to use a very long window for triggering read-ahead as long as the buffer pool was not full. After the initial filling of the buffer pool, the read ahead would require more temporal locality before kicking in.
Still, the scheme was not really good since the rest of the extent would go for background-read and the triggering read would be done right then, leading to extra seeks. Well, this is good for latency but bad for throughput. So I changed this too, going to an "elevator only" scheme where reads that triggered read-ahead would go with the read-ahead batch. Reads that did not trigger read-ahead would still be done right in place, thus favoring latency but breaking any sequentiality with its attendant 10+ ms penalty.
We keep in mind that the test we target is BSBM warm-up time, which is purely a throughput business. One could have timeouts and could penalize queries that sacrificed too much latency to throughput.
We note that even for this very simple metric, just reading the allocated database pages from start to end is not good since a large number of pages in fact never get read during a run.
We further note that the vectored read-ahead without any speculation will be useful as-is for cases with few threads and striping, since at least one thread's random I/Os get to go to multiple threads. The benefit is less in multiuser situations where disks are randomly busy anyhow.
In the previous I/O experiments, we saw that with vectored read ahead and no speculation, there were around 50 pages waiting for I/O at all times. With an easily-triggered extent read-ahead, there were around 4000 pages waiting. The more pages are waiting for I/O, the greater the benefit from the elevator algorithm of servicing I/O in order of file offset.
In Virtuoso 5 we had a trick that would, if the buffer pool was not full, speculatively read every uncached sibling of every index tree node it visited. This filled the cache quite fast, but was useless after the cache was full. The extent read ahead first implemented in 6 was less aggressive, but would continue working with full cache and did in fact help with shifts in the working set.
The next logical step is to combine the vector and extent read-ahead modes. We see what pages we will be getting, then take the distinct extents; if we have been to this extent within the time window, we just add all the uncached allocated pages of the extent to the batch.
With this setting, especially at the start of the run, we get large read-ahead batches and maintain I/O queues of 5000 to 20000 pages. The SSD starting time drops to about 120 seconds from cold start to reach 1200% CPU. We see transfer rates of up to 150 MB/s per SSD. With HDDs, we see transfer rates around 14 MB/s per drive, mostly reading chunks of an average of seventy-one (71) 8K pages.
The BSBM workload does not offer better possibilities for optimization, short of pre-reading the whole database, which is not practical at large scales.
Some Details
First we start from cold disk, with and without mandatory read of the whole extent on the touch.
Without any speculation but with vectored read-ahead, here are the times for the first 11 query mixes:
0: 151560.82 ms, total: 151718 ms
1: 179589.08 ms, total: 179648 ms
2: 71974.49 ms, total: 72017 ms
3: 102701.73 ms, total: 102729 ms
4: 58834.41 ms, total: 58856 ms
5: 65926.34 ms, total: 65944 ms
6: 68244.69 ms, total: 68274 ms
7: 39197.15 ms, total: 39215 ms
8: 45654.93 ms, total: 45674 ms
9: 34850.30 ms, total: 34878 ms
10: 100061.30 ms, total: 100079 ms
The average CPU during this time was 5%. The best read throughput was 2.5 MB/s; the average was 1.35 MB/s. The average disk read was 16 ms.
With vectored read-ahead and full extents only, i.e., max speculation:
0: 178854.23 ms, total: 179034 ms
1: 110826.68 ms, total: 110887 ms
2: 19896.11 ms, total: 19941 ms
3: 36724.43 ms, total: 36753 ms
4: 21253.70 ms, total: 21285 ms
5: 18417.73 ms, total: 18439 ms
6: 21668.92 ms, total: 21690 ms
7: 12236.49 ms, total: 12267 ms
8: 14922.74 ms, total: 14945 ms
9: 11502.96 ms, total: 11523 ms
10: 15762.34 ms, total: 15792 ms
...
90: 1747.62 ms, total: 1761 ms
91: 1701.01 ms, total: 1714 ms
92: 1300.62 ms, total: 1318 ms
93: 1873.15 ms, total: 1886 ms
94: 1508.24 ms, total: 1524 ms
95: 1748.15 ms, total: 1761 ms
96: 2076.92 ms, total: 2090 ms
97: 2199.38 ms, total: 2212 ms
98: 2305.75 ms, total: 2319 ms
99: 1771.91 ms, total: 1784 ms
Scale factor: 2848260
Number of warmup runs: 0
Seed: 808080
Number of query mix runs
(without warmups): 100 times
min/max Querymix runtime: 1.3006s / 178.8542s
Elapsed runtime: 872.993 seconds
QMpH: 412.374 query mixes per hour
The peak throughput is 91 MB/s, with average around 50 MB/s; CPU average around 50%.
We note that the latency of the first query mix is hardly greater than in the non-speculative run, but starting from mix 3 the speed is clearly better.
Then the same with cold SSDs. First with no speculation:
0: 5177.68 ms, total: 5302 ms
1: 2570.16 ms, total: 2614 ms
2: 1353.06 ms, total: 1391 ms
3: 1957.63 ms, total: 1978 ms
4: 1371.13 ms, total: 1386 ms
5: 1765.55 ms, total: 1781 ms
6: 1658.23 ms, total: 1673 ms
7: 1273.87 ms, total: 1289 ms
8: 1355.19 ms, total: 1380 ms
9: 1152.78 ms, total: 1167 ms
10: 1787.91 ms, total: 1802 ms
...
90: 1116.25 ms, total: 1128 ms
91: 989.50 ms, total: 1001 ms
92: 833.24 ms, total: 844 ms
93: 1137.83 ms, total: 1150 ms
94: 969.47 ms, total: 982 ms
95: 1138.04 ms, total: 1149 ms
96: 1155.98 ms, total: 1168 ms
97: 1178.15 ms, total: 1193 ms
98: 1120.18 ms, total: 1132 ms
99: 1013.16 ms, total: 1025 ms
Scale factor: 2848260
Number of warmup runs: 0
Seed: 808080
Number of query mix runs
(without warmups): 100 times
min/max Querymix runtime: 0.8201s / 5.1777s
Elapsed runtime: 127.555 seconds
QMpH: 2822.321 query mixes per hour
The peak I/O is 45 MB/s, with average 28.3 MB/s; CPU average is 168%.
Now, SSDs with max speculation.
0: 44670.34 ms, total: 44809 ms
1: 18490.44 ms, total: 18548 ms
2: 7306.12 ms, total: 7353 ms
3: 9452.66 ms, total: 9485 ms
4: 5648.56 ms, total: 5668 ms
5: 5493.21 ms, total: 5511 ms
6: 5951.48 ms, total: 5970 ms
7: 3815.59 ms, total: 3834 ms
8: 4560.71 ms, total: 4579 ms
9: 3523.74 ms, total: 3543 ms
10: 4724.04 ms, total: 4741 ms
...
90: 673.53 ms, total: 685 ms
91: 534.62 ms, total: 545 ms
92: 730.81 ms, total: 742 ms
93: 1358.14 ms, total: 1370 ms
94: 1098.64 ms, total: 1110 ms
95: 1232.20 ms, total: 1243 ms
96: 1259.57 ms, total: 1273 ms
97: 1298.95 ms, total: 1310 ms
98: 1156.01 ms, total: 1166 ms
99: 1025.45 ms, total: 1034 ms
Scale factor: 2848260
Number of warmup runs: 0
Seed: 808080
Number of query mix runs
(without warmups): 100 times
min/max Querymix runtime: 0.4725s / 44.6703s
Elapsed runtime: 269.323 seconds
QMpH: 1336.683 query mixes per hour
The peak I/O is 339 MB/s, with average 192 MB/s; average CPU is 121%.
The above was measured with the read-ahead thread doing single-page reads. We repeated the test with merging reads with small differences. The max IO was 353 MB/s, and average 173 MB/s; average CPU 113%.
We see that the start latency is quite a bit longer than without speculation and the CPU % is lower due to higher latency of individual I/O. The I/O rate is fair. We would expect more throughput however.
We find that a supposedly better use of the API, doing single requests of up to 100 pages instead of consecutive requests of 1 page, does not make a lot of difference. The peak I/O is a bit higher; overall throughput is a bit lower.
We will have to retry these experiments with a better controller. We have at no point seen anything like the 50K 4KB random I/Os promised for the SSDs by the manufacturer. We know for a fact that the controller gives about 700 MB/s sequential read with cat file /dev/null and two drives busy. With 4 drives busy, this does not get better. The best 30 second stretch we saw in a multiuser BSBM warm-up was 590 MB/s, which is consistent with the cat to /dev/null figure. We will later test with 8 SSDs with better controllers.
Note that the average I/O and CPU are averages over 30 second measurement windows; thus for short running tests, there is some error from the window during which the activity ended.
Let us now see if we can make a BSBM instance warm up from disk in a reasonable time. We run 16 users with max speculation. We note that after reading 7,500,000 buffers we are not entirely free of disk. The max speculation read-ahead filled the cache in 17 minutes, with an average of 58 MB/s. After the cache is filled, the system shifts to a more conservative policy on extent read-ahead; one which in fact never gets triggered with the BSBM Explore in steady state. The vectored read-ahead is kept on since this by itself does not read pages that are not needed. However, the vectored read-ahead does not run either, because the data that is accessed in larger batches is already in memory. Thus there remains a trickle of an average 0.49 MB/s from disk. This keeps CPU around 350%. With SSDs, the trickle is about 1.5 MB/s and CPU is around 1300% in steady state. Thus SSDs give approximately triple the throughput in a situation where there is a tiny amount of continuous random disk access. The disk access in question is 80% for retrieving RDF literal strings, presumably on behalf of the DESCRIBE query in the mix. This query touches things no other query touches and does so one subject at a time, in a way that can neither be anticipated nor optimized.
The Virtuoso 7 column store will deal with this better because it is more space efficient overall. If we apply stream-compression to literals, these will go in under half the space, while quads will go in maybe one-quarter the space. Thus 3000 Mt all from memory should be possible with 72 GB RAM. 1000 Mt row-wise did fit in in 72 GB RAM except for the random literals accessed by the the DESCRIBE. This alone drops throughput to under a third of the memory-only throughput if using HDDs. SSDs, on the other hand, can largely neutralize this effect.
Conclusions
We have looked at basics of I/O. SSDs have been found to be a readily available solution to I/O bottlenecks without need for reconfiguration or complex I/O policies. We have been able to get a decent read rate under conditions of server warm-up or shift of working set even with HDDs.
More advanced I/O matters will be covered with the column store. We note that the techniques discussed here apply identically to rows and columns.
As concerns BSBM, it seems appropriate to include a warm-up time. In practice, this means that the store just must eagerly pre-read. This is not hard to do and can be quite useful.
Benchmarks, Redux Series
- Benchmarks, Redux (part 1): On RDF Benchmarks
-
Benchmarks, Redux (part 2): A Benchmarking Story
-
Benchmarks, Redux (part 3): Virtuoso 7 vs 6 on BSBM Load and Explore
-
Benchmarks, Redux (part 4): Benchmark Tuning Questionnaire
-
Benchmarks, Redux (part 5): BSBM and I/O; HDDs and SSDs
-
Benchmarks, Redux (part 6): BSBM and I/O, continued (this post)
-
Benchmarks, Redux (part 7): What Does BSBM Explore Measure?
-
Benchmarks, Redux (part 8): BSBM Explore and Update
-
Benchmarks, Redux (part 9): BSBM With Cluster
-
Benchmarks, Redux (part 10): LOD2 and the Benchmark Process
-
Benchmarks, Redux (part 11): On the Substance of RDF Benchmarks
-
Benchmarks, Redux (part 12): Our Own BSBM Results Report
-
Benchmarks, Redux (part 13): BSBM BI Modifications
-
Benchmarks, Redux (part 14): BSBM BI Mix
-
Benchmarks, Redux (part 15): BSBM Test Driver Enhancements
|
03/07/2011 17:36 GMT
|
Modified:
03/14/2011 17:16 GMT
|
Benchmarks, Redux (part 6): BSBM and I/O, continued
[
Orri Erling
]
In the words of Jim Gray, disks have become tapes. By this he means that a disk is really only good for sequential access. For this reason, the SSD extent read ahead was incomparably better. We note that in the experiment, every page in the general area of the database the experiment touched would in time be touched, and that the whole working set would end up in memory. Therefore no speculative read would be wasted. Therefore it stands to reason to read whole extents.
So I changed the default behavior to use a very long window for triggering read-ahead as long as the buffer pool was not full. After the initial filling of the buffer pool, the read ahead would require more temporal locality before kicking in.
Still, the scheme was not really good since the rest of the extent would go for background-read and the triggering read would be done right then, leading to extra seeks. Well, this is good for latency but bad for throughput. So I changed this too, going to an "elevator only" scheme where reads that triggered read-ahead would go with the read-ahead batch. Reads that did not trigger read-ahead would still be done right in place, thus favoring latency but breaking any sequentiality with its attendant 10+ ms penalty.
We keep in mind that the test we target is BSBM warm-up time, which is purely a throughput business. One could have timeouts and could penalize queries that sacrificed too much latency to throughput.
We note that even for this very simple metric, just reading the allocated database pages from start to end is not good since a large number of pages in fact never get read during a run.
We further note that the vectored read-ahead without any speculation will be useful as-is for cases with few threads and striping, since at least one thread's random I/Os get to go to multiple threads. The benefit is less in multiuser situations where disks are randomly busy anyhow.
In the previous I/O experiments, we saw that with vectored read ahead and no speculation, there were around 50 pages waiting for I/O at all times. With an easily-triggered extent read-ahead, there were around 4000 pages waiting. The more pages are waiting for I/O, the greater the benefit from the elevator algorithm of servicing I/O in order of file offset.
In Virtuoso 5 we had a trick that would, if the buffer pool was not full, speculatively read every uncached sibling of every index tree node it visited. This filled the cache quite fast, but was useless after the cache was full. The extent read ahead first implemented in 6 was less aggressive, but would continue working with full cache and did in fact help with shifts in the working set.
The next logical step is to combine the vector and extent read-ahead modes. We see what pages we will be getting, then take the distinct extents; if we have been to this extent within the time window, we just add all the uncached allocated pages of the extent to the batch.
With this setting, especially at the start of the run, we get large read-ahead batches and maintain I/O queues of 5000 to 20000 pages. The SSD starting time drops to about 120 seconds from cold start to reach 1200% CPU. We see transfer rates of up to 150 MB/s per SSD. With HDDs, we see transfer rates around 14 MB/s per drive, mostly reading chunks of an average of seventy-one (71) 8K pages.
The BSBM workload does not offer better possibilities for optimization, short of pre-reading the whole database, which is not practical at large scales.
Some Details
First we start from cold disk, with and without mandatory read of the whole extent on the touch.
Without any speculation but with vectored read-ahead, here are the times for the first 11 query mixes:
0: 151560.82 ms, total: 151718 ms
1: 179589.08 ms, total: 179648 ms
2: 71974.49 ms, total: 72017 ms
3: 102701.73 ms, total: 102729 ms
4: 58834.41 ms, total: 58856 ms
5: 65926.34 ms, total: 65944 ms
6: 68244.69 ms, total: 68274 ms
7: 39197.15 ms, total: 39215 ms
8: 45654.93 ms, total: 45674 ms
9: 34850.30 ms, total: 34878 ms
10: 100061.30 ms, total: 100079 ms
The average CPU during this time was 5%. The best read throughput was 2.5 MB/s; the average was 1.35 MB/s. The average disk read was 16 ms.
With vectored read-ahead and full extents only, i.e., max speculation:
0: 178854.23 ms, total: 179034 ms
1: 110826.68 ms, total: 110887 ms
2: 19896.11 ms, total: 19941 ms
3: 36724.43 ms, total: 36753 ms
4: 21253.70 ms, total: 21285 ms
5: 18417.73 ms, total: 18439 ms
6: 21668.92 ms, total: 21690 ms
7: 12236.49 ms, total: 12267 ms
8: 14922.74 ms, total: 14945 ms
9: 11502.96 ms, total: 11523 ms
10: 15762.34 ms, total: 15792 ms
...
90: 1747.62 ms, total: 1761 ms
91: 1701.01 ms, total: 1714 ms
92: 1300.62 ms, total: 1318 ms
93: 1873.15 ms, total: 1886 ms
94: 1508.24 ms, total: 1524 ms
95: 1748.15 ms, total: 1761 ms
96: 2076.92 ms, total: 2090 ms
97: 2199.38 ms, total: 2212 ms
98: 2305.75 ms, total: 2319 ms
99: 1771.91 ms, total: 1784 ms
Scale factor: 2848260
Number of warmup runs: 0
Seed: 808080
Number of query mix runs
(without warmups): 100 times
min/max Querymix runtime: 1.3006s / 178.8542s
Elapsed runtime: 872.993 seconds
QMpH: 412.374 query mixes per hour
The peak throughput is 91 MB/s, with average around 50 MB/s; CPU average around 50%.
We note that the latency of the first query mix is hardly greater than in the non-speculative run, but starting from mix 3 the speed is clearly better.
Then the same with cold SSDs. First with no speculation:
0: 5177.68 ms, total: 5302 ms
1: 2570.16 ms, total: 2614 ms
2: 1353.06 ms, total: 1391 ms
3: 1957.63 ms, total: 1978 ms
4: 1371.13 ms, total: 1386 ms
5: 1765.55 ms, total: 1781 ms
6: 1658.23 ms, total: 1673 ms
7: 1273.87 ms, total: 1289 ms
8: 1355.19 ms, total: 1380 ms
9: 1152.78 ms, total: 1167 ms
10: 1787.91 ms, total: 1802 ms
...
90: 1116.25 ms, total: 1128 ms
91: 989.50 ms, total: 1001 ms
92: 833.24 ms, total: 844 ms
93: 1137.83 ms, total: 1150 ms
94: 969.47 ms, total: 982 ms
95: 1138.04 ms, total: 1149 ms
96: 1155.98 ms, total: 1168 ms
97: 1178.15 ms, total: 1193 ms
98: 1120.18 ms, total: 1132 ms
99: 1013.16 ms, total: 1025 ms
Scale factor: 2848260
Number of warmup runs: 0
Seed: 808080
Number of query mix runs
(without warmups): 100 times
min/max Querymix runtime: 0.8201s / 5.1777s
Elapsed runtime: 127.555 seconds
QMpH: 2822.321 query mixes per hour
The peak I/O is 45 MB/s, with average 28.3 MB/s; CPU average is 168%.
Now, SSDs with max speculation.
0: 44670.34 ms, total: 44809 ms
1: 18490.44 ms, total: 18548 ms
2: 7306.12 ms, total: 7353 ms
3: 9452.66 ms, total: 9485 ms
4: 5648.56 ms, total: 5668 ms
5: 5493.21 ms, total: 5511 ms
6: 5951.48 ms, total: 5970 ms
7: 3815.59 ms, total: 3834 ms
8: 4560.71 ms, total: 4579 ms
9: 3523.74 ms, total: 3543 ms
10: 4724.04 ms, total: 4741 ms
...
90: 673.53 ms, total: 685 ms
91: 534.62 ms, total: 545 ms
92: 730.81 ms, total: 742 ms
93: 1358.14 ms, total: 1370 ms
94: 1098.64 ms, total: 1110 ms
95: 1232.20 ms, total: 1243 ms
96: 1259.57 ms, total: 1273 ms
97: 1298.95 ms, total: 1310 ms
98: 1156.01 ms, total: 1166 ms
99: 1025.45 ms, total: 1034 ms
Scale factor: 2848260
Number of warmup runs: 0
Seed: 808080
Number of query mix runs
(without warmups): 100 times
min/max Querymix runtime: 0.4725s / 44.6703s
Elapsed runtime: 269.323 seconds
QMpH: 1336.683 query mixes per hour
The peak I/O is 339 MB/s, with average 192 MB/s; average CPU is 121%.
The above was measured with the read-ahead thread doing single-page reads. We repeated the test with merging reads with small differences. The max IO was 353 MB/s, and average 173 MB/s; average CPU 113%.
We see that the start latency is quite a bit longer than without speculation and the CPU % is lower due to higher latency of individual I/O. The I/O rate is fair. We would expect more throughput however.
We find that a supposedly better use of the API, doing single requests of up to 100 pages instead of consecutive requests of 1 page, does not make a lot of difference. The peak I/O is a bit higher; overall throughput is a bit lower.
We will have to retry these experiments with a better controller. We have at no point seen anything like the 50K 4KB random I/Os promised for the SSDs by the manufacturer. We know for a fact that the controller gives about 700 MB/s sequential read with cat file /dev/null and two drives busy. With 4 drives busy, this does not get better. The best 30 second stretch we saw in a multiuser BSBM warm-up was 590 MB/s, which is consistent with the cat to /dev/null figure. We will later test with 8 SSDs with better controllers.
Note that the average I/O and CPU are averages over 30 second measurement windows; thus for short running tests, there is some error from the window during which the activity ended.
Let us now see if we can make a BSBM instance warm up from disk in a reasonable time. We run 16 users with max speculation. We note that after reading 7,500,000 buffers we are not entirely free of disk. The max speculation read-ahead filled the cache in 17 minutes, with an average of 58 MB/s. After the cache is filled, the system shifts to a more conservative policy on extent read-ahead; one which in fact never gets triggered with the BSBM Explore in steady state. The vectored read-ahead is kept on since this by itself does not read pages that are not needed. However, the vectored read-ahead does not run either, because the data that is accessed in larger batches is already in memory. Thus there remains a trickle of an average 0.49 MB/s from disk. This keeps CPU around 350%. With SSDs, the trickle is about 1.5 MB/s and CPU is around 1300% in steady state. Thus SSDs give approximately triple the throughput in a situation where there is a tiny amount of continuous random disk access. The disk access in question is 80% for retrieving RDF literal strings, presumably on behalf of the DESCRIBE query in the mix. This query touches things no other query touches and does so one subject at a time, in a way that can neither be anticipated nor optimized.
The Virtuoso 7 column store will deal with this better because it is more space efficient overall. If we apply stream-compression to literals, these will go in under half the space, while quads will go in maybe one-quarter the space. Thus 3000 Mt all from memory should be possible with 72 GB RAM. 1000 Mt row-wise did fit in in 72 GB RAM except for the random literals accessed by the the DESCRIBE. This alone drops throughput to under a third of the memory-only throughput if using HDDs. SSDs, on the other hand, can largely neutralize this effect.
Conclusions
We have looked at basics of I/O. SSDs have been found to be a readily available solution to I/O bottlenecks without need for reconfiguration or complex I/O policies. We have been able to get a decent read rate under conditions of server warm-up or shift of working set even with HDDs.
More advanced I/O matters will be covered with the column store. We note that the techniques discussed here apply identically to rows and columns.
As concerns BSBM, it seems appropriate to include a warm-up time. In practice, this means that the store just must eagerly pre-read. This is not hard to do and can be quite useful.
Benchmarks, Redux Series
- Benchmarks, Redux (part 1): On RDF Benchmarks
-
Benchmarks, Redux (part 2): A Benchmarking Story
-
Benchmarks, Redux (part 3): Virtuoso 7 vs 6 on BSBM Load and Explore
-
Benchmarks, Redux (part 4): Benchmark Tuning Questionnaire
-
Benchmarks, Redux (part 5): BSBM and I/O; HDDs and SSDs
-
Benchmarks, Redux (part 6): BSBM and I/O, continued (this post)
-
Benchmarks, Redux (part 7): What Does BSBM Explore Measure?
-
Benchmarks, Redux (part 8): BSBM Explore and Update
-
Benchmarks, Redux (part 9): BSBM With Cluster
-
Benchmarks, Redux (part 10): LOD2 and the Benchmark Process
-
Benchmarks, Redux (part 11): On the Substance of RDF Benchmarks
-
Benchmarks, Redux (part 12): Our Own BSBM Results Report
-
Benchmarks, Redux (part 13): BSBM BI Modifications
-
Benchmarks, Redux (part 14): BSBM BI Mix
-
Benchmarks, Redux (part 15): BSBM Test Driver Enhancements
|
03/07/2011 17:36 GMT
|
Modified:
03/14/2011 17:16 GMT
|
Benchmarks, Redux (part 6): BSBM and I/O, continued
[
Virtuso Data Space Bot
]
In the words of Jim Gray, disks have become tapes. By this he means that a disk is really only good for sequential access. For this reason, the SSD extent read ahead was incomparably better. We note that in the experiment, every page in the general area of the database the experiment touched would in time be touched, and that the whole working set would end up in memory. Therefore no speculative read would be wasted. Therefore it stands to reason to read whole extents.
So I changed the default behavior to use a very long window for triggering read-ahead as long as the buffer pool was not full. After the initial filling of the buffer pool, the read ahead would require more temporal locality before kicking in.
Still, the scheme was not really good since the rest of the extent would go for background-read and the triggering read would be done right then, leading to extra seeks. Well, this is good for latency but bad for throughput. So I changed this too, going to an "elevator only" scheme where reads that triggered read-ahead would go with the read-ahead batch. Reads that did not trigger read-ahead would still be done right in place, thus favoring latency but breaking any sequentiality with its attendant 10+ ms penalty.
We keep in mind that the test we target is BSBM warm-up time, which is purely a throughput business. One could have timeouts and could penalize queries that sacrificed too much latency to throughput.
We note that even for this very simple metric, just reading the allocated database pages from start to end is not good since a large number of pages in fact never get read during a run.
We further note that the vectored read-ahead without any speculation will be useful as-is for cases with few threads and striping, since at least one thread's random I/Os get to go to multiple threads. The benefit is less in multiuser situations where disks are randomly busy anyhow.
In the previous I/O experiments, we saw that with vectored read ahead and no speculation, there were around 50 pages waiting for I/O at all times. With an easily-triggered extent read-ahead, there were around 4000 pages waiting. The more pages are waiting for I/O, the greater the benefit from the elevator algorithm of servicing I/O in order of file offset.
In Virtuoso 5 we had a trick that would, if the buffer pool was not full, speculatively read every uncached sibling of every index tree node it visited. This filled the cache quite fast, but was useless after the cache was full. The extent read ahead first implemented in 6 was less aggressive, but would continue working with full cache and did in fact help with shifts in the working set.
The next logical step is to combine the vector and extent read-ahead modes. We see what pages we will be getting, then take the distinct extents; if we have been to this extent within the time window, we just add all the uncached allocated pages of the extent to the batch.
With this setting, especially at the start of the run, we get large read-ahead batches and maintain I/O queues of 5000 to 20000 pages. The SSD starting time drops to about 120 seconds from cold start to reach 1200% CPU. We see transfer rates of up to 150 MB/s per SSD. With HDDs, we see transfer rates around 14 MB/s per drive, mostly reading chunks of an average of seventy-one (71) 8K pages.
The BSBM workload does not offer better possibilities for optimization, short of pre-reading the whole database, which is not practical at large scales.
Some Details
First we start from cold disk, with and without mandatory read of the whole extent on the touch.
Without any speculation but with vectored read-ahead, here are the times for the first 11 query mixes:
0: 151560.82 ms, total: 151718 ms
1: 179589.08 ms, total: 179648 ms
2: 71974.49 ms, total: 72017 ms
3: 102701.73 ms, total: 102729 ms
4: 58834.41 ms, total: 58856 ms
5: 65926.34 ms, total: 65944 ms
6: 68244.69 ms, total: 68274 ms
7: 39197.15 ms, total: 39215 ms
8: 45654.93 ms, total: 45674 ms
9: 34850.30 ms, total: 34878 ms
10: 100061.30 ms, total: 100079 ms
The average CPU during this time was 5%. The best read throughput was 2.5 MB/s; the average was 1.35 MB/s. The average disk read was 16 ms.
With vectored read-ahead and full extents only, i.e., max speculation:
0: 178854.23 ms, total: 179034 ms
1: 110826.68 ms, total: 110887 ms
2: 19896.11 ms, total: 19941 ms
3: 36724.43 ms, total: 36753 ms
4: 21253.70 ms, total: 21285 ms
5: 18417.73 ms, total: 18439 ms
6: 21668.92 ms, total: 21690 ms
7: 12236.49 ms, total: 12267 ms
8: 14922.74 ms, total: 14945 ms
9: 11502.96 ms, total: 11523 ms
10: 15762.34 ms, total: 15792 ms
...
90: 1747.62 ms, total: 1761 ms
91: 1701.01 ms, total: 1714 ms
92: 1300.62 ms, total: 1318 ms
93: 1873.15 ms, total: 1886 ms
94: 1508.24 ms, total: 1524 ms
95: 1748.15 ms, total: 1761 ms
96: 2076.92 ms, total: 2090 ms
97: 2199.38 ms, total: 2212 ms
98: 2305.75 ms, total: 2319 ms
99: 1771.91 ms, total: 1784 ms
Scale factor: 2848260
Number of warmup runs: 0
Seed: 808080
Number of query mix runs
(without warmups): 100 times
min/max Querymix runtime: 1.3006s / 178.8542s
Elapsed runtime: 872.993 seconds
QMpH: 412.374 query mixes per hour
The peak throughput is 91 MB/s, with average around 50 MB/s; CPU average around 50%.
We note that the latency of the first query mix is hardly greater than in the non-speculative run, but starting from mix 3 the speed is clearly better.
Then the same with cold SSDs. First with no speculation:
0: 5177.68 ms, total: 5302 ms
1: 2570.16 ms, total: 2614 ms
2: 1353.06 ms, total: 1391 ms
3: 1957.63 ms, total: 1978 ms
4: 1371.13 ms, total: 1386 ms
5: 1765.55 ms, total: 1781 ms
6: 1658.23 ms, total: 1673 ms
7: 1273.87 ms, total: 1289 ms
8: 1355.19 ms, total: 1380 ms
9: 1152.78 ms, total: 1167 ms
10: 1787.91 ms, total: 1802 ms
...
90: 1116.25 ms, total: 1128 ms
91: 989.50 ms, total: 1001 ms
92: 833.24 ms, total: 844 ms
93: 1137.83 ms, total: 1150 ms
94: 969.47 ms, total: 982 ms
95: 1138.04 ms, total: 1149 ms
96: 1155.98 ms, total: 1168 ms
97: 1178.15 ms, total: 1193 ms
98: 1120.18 ms, total: 1132 ms
99: 1013.16 ms, total: 1025 ms
Scale factor: 2848260
Number of warmup runs: 0
Seed: 808080
Number of query mix runs
(without warmups): 100 times
min/max Querymix runtime: 0.8201s / 5.1777s
Elapsed runtime: 127.555 seconds
QMpH: 2822.321 query mixes per hour
The peak I/O is 45 MB/s, with average 28.3 MB/s; CPU average is 168%.
Now, SSDs with max speculation.
0: 44670.34 ms, total: 44809 ms
1: 18490.44 ms, total: 18548 ms
2: 7306.12 ms, total: 7353 ms
3: 9452.66 ms, total: 9485 ms
4: 5648.56 ms, total: 5668 ms
5: 5493.21 ms, total: 5511 ms
6: 5951.48 ms, total: 5970 ms
7: 3815.59 ms, total: 3834 ms
8: 4560.71 ms, total: 4579 ms
9: 3523.74 ms, total: 3543 ms
10: 4724.04 ms, total: 4741 ms
...
90: 673.53 ms, total: 685 ms
91: 534.62 ms, total: 545 ms
92: 730.81 ms, total: 742 ms
93: 1358.14 ms, total: 1370 ms
94: 1098.64 ms, total: 1110 ms
95: 1232.20 ms, total: 1243 ms
96: 1259.57 ms, total: 1273 ms
97: 1298.95 ms, total: 1310 ms
98: 1156.01 ms, total: 1166 ms
99: 1025.45 ms, total: 1034 ms
Scale factor: 2848260
Number of warmup runs: 0
Seed: 808080
Number of query mix runs
(without warmups): 100 times
min/max Querymix runtime: 0.4725s / 44.6703s
Elapsed runtime: 269.323 seconds
QMpH: 1336.683 query mixes per hour
The peak I/O is 339 MB/s, with average 192 MB/s; average CPU is 121%.
The above was measured with the read-ahead thread doing single-page reads. We repeated the test with merging reads with small differences. The max IO was 353 MB/s, and average 173 MB/s; average CPU 113%.
We see that the start latency is quite a bit longer than without speculation and the CPU % is lower due to higher latency of individual I/O. The I/O rate is fair. We would expect more throughput however.
We find that a supposedly better use of the API, doing single requests of up to 100 pages instead of consecutive requests of 1 page, does not make a lot of difference. The peak I/O is a bit higher; overall throughput is a bit lower.
We will have to retry these experiments with a better controller. We have at no point seen anything like the 50K 4KB random I/Os promised for the SSDs by the manufacturer. We know for a fact that the controller gives about 700 MB/s sequential read with cat file /dev/null and two drives busy. With 4 drives busy, this does not get better. The best 30 second stretch we saw in a multiuser BSBM warm-up was 590 MB/s, which is consistent with the cat to /dev/null figure. We will later test with 8 SSDs with better controllers.
Note that the average I/O and CPU are averages over 30 second measurement windows; thus for short running tests, there is some error from the window during which the activity ended.
Let us now see if we can make a BSBM instance warm up from disk in a reasonable time. We run 16 users with max speculation. We note that after reading 7,500,000 buffers we are not entirely free of disk. The max speculation read-ahead filled the cache in 17 minutes, with an average of 58 MB/s. After the cache is filled, the system shifts to a more conservative policy on extent read-ahead; one which in fact never gets triggered with the BSBM Explore in steady state. The vectored read-ahead is kept on since this by itself does not read pages that are not needed. However, the vectored read-ahead does not run either, because the data that is accessed in larger batches is already in memory. Thus there remains a trickle of an average 0.49 MB/s from disk. This keeps CPU around 350%. With SSDs, the trickle is about 1.5 MB/s and CPU is around 1300% in steady state. Thus SSDs give approximately triple the throughput in a situation where there is a tiny amount of continuous random disk access. The disk access in question is 80% for retrieving RDF literal strings, presumably on behalf of the DESCRIBE query in the mix. This query touches things no other query touches and does so one subject at a time, in a way that can neither be anticipated nor optimized.
The Virtuoso 7 column store will deal with this better because it is more space efficient overall. If we apply stream-compression to literals, these will go in under half the space, while quads will go in maybe one-quarter the space. Thus 3000 Mt all from memory should be possible with 72 GB RAM. 1000 Mt row-wise did fit in in 72 GB RAM except for the random literals accessed by the the DESCRIBE. This alone drops throughput to under a third of the memory-only throughput if using HDDs. SSDs, on the other hand, can largely neutralize this effect.
Conclusions
We have looked at basics of I/O. SSDs have been found to be a readily available solution to I/O bottlenecks without need for reconfiguration or complex I/O policies. We have been able to get a decent read rate under conditions of server warm-up or shift of working set even with HDDs.
More advanced I/O matters will be covered with the column store. We note that the techniques discussed here apply identically to rows and columns.
As concerns BSBM, it seems appropriate to include a warm-up time. In practice, this means that the store just must eagerly pre-read. This is not hard to do and can be quite useful.
Benchmarks, Redux Series
- Benchmarks, Redux (part 1): On RDF Benchmarks
-
Benchmarks, Redux (part 2): A Benchmarking Story
-
Benchmarks, Redux (part 3): Virtuoso 7 vs 6 on BSBM Load and Explore
-
Benchmarks, Redux (part 4): Benchmark Tuning Questionnaire
-
Benchmarks, Redux (part 5): BSBM and I/O; HDDs and SSDs
-
Benchmarks, Redux (part 6): BSBM and I/O, continued (this post)
-
Benchmarks, Redux (part 7): What Does BSBM Explore Measure?
-
Benchmarks, Redux (part 8): BSBM Explore and Update
-
Benchmarks, Redux (part 9): BSBM With Cluster
-
Benchmarks, Redux (part 10): LOD2 and the Benchmark Process
-
Benchmarks, Redux (part 11): On the Substance of RDF Benchmarks
-
Benchmarks, Redux (part 12): Our Own BSBM Results Report
-
Benchmarks, Redux (part 13): BSBM BI Modifications
-
Benchmarks, Redux (part 14): BSBM BI Mix
-
Benchmarks, Redux (part 15): BSBM Test Driver Enhancements
|
03/07/2011 17:36 GMT
|
Modified:
03/14/2011 17:57 GMT
|
Simple Virtuoso Installation & Utilization Guide for SPARQL Users (Update 5)
[
Kingsley Uyi Idehen
]
A declarative query language from the W3C for querying structured propositional data (in the form of 3-tuple [triples] or 4-tuple [quads] records) stored in a deductive database (colloquially referred to as triple or quad stores in Semantic Web and Linked Data parlance).
SPARQL is inherently platform independent. Like SQL, the query language and the backend database engine are distinct. Database clients capture SPARQL queries which are then passed on to compliant backend databases.
Why is it important?
Like SQL for relational databases, it provides a powerful mechanism for accessing and joining data across one or more data partitions (named graphs identified by IRIs). The aforementioned capability also enables the construction of sophisticated Views, Reports (HTML or those produced in native form by desktop productivity tools), and data streams for other services.
Unlike SQL, SPARQL includes result serialization formats and an HTTP based wire protocol. Thus, the ubiquity and sophistication of HTTP is integral to SPARQL i.e., client side applications (user agents) only need to be able to perform an HTTP GET against a URL en route to exploiting the power of SPARQL.
How do I use it, generally?
- Locate a SPARQL endpoint (DBpedia, LOD Cloud Cache, Data.Gov, URIBurner, others), or;
- Install a SPARQL compliant database server (quad or triple store) on your desktop, workgroup server, data center, or cloud (e.g., Amazon EC2 AMI)
- Start the database server
- Execute SPARQL Queries via the SPARQL endpoint.
How do I use SPARQL with Virtuoso?
What follows is a very simple guide for using SPARQL against your own instance of Virtuoso:
- Software Download and Installation
- Data Loading from Data Sources exposed at Network Addresses (e.g. HTTP URLs) using very simple methods
- Actual SPARQL query execution via SPARQL endpoint.
Installation Steps
-
Download Virtuoso Open Source or Virtuoso Commercial Editions
-
Run installer (if using Commercial edition of Windows Open Source Edition, otherwise follow build guide)
-
Follow post-installation guide and verify installation by typing in the command: virtuoso -? (if this fails check you've followed installation and setup steps, then verify environment variables have been set)
-
Start the Virtuoso server using the command: virtuoso-start.sh
-
Verify you have a connection to the Virtuoso Server via the command: isql localhost (assuming you're using default DB settings) or the command: isql localhost:1112 (assuming demo database) or goto your browser and type in: http://<virtuoso-server-host-name>:[port]/conductor (e.g. http://localhost:8889/conductor for default DB or http://localhost:8890/conductor if using Demo DB)
-
Go to SPARQL endpoint which is typically -- http://<virtuoso-server-host-name>:[port]/sparql
-
Run a quick sample query (since the database always has system data in place): select distinct * where {?s ?p ?o} limit 50 .
Troubleshooting
- Ensure environment settings are set and functional -- if using Mac OS X or Windows, so you don't have to worry about this, just start and stop your Virtuoso server using native OS services applets
- If using the Open Source Edition, follow the getting started guide -- it covers PATH and startup directory location re. starting and stopping Virtuoso servers.
- Sponging (HTTP GETs against external Data Sources) within SPARQL queries is disabled by default. You can enable this feature by assigning "SPARQL_SPONGE" privileges to user "SPARQL". Note, more sophisticated security exists via WebID based ACLs.
Data Loading Steps
-
Identify an RDF based structured data source of interest -- a file that contains 3-tuple / triples available at an address on a public or private HTTP based network
- Determine the Address (URL) of the RDF data source
- Go to your Virtuoso SPARQL endpoint and type in the following SPARQL query: DEFINE GET:SOFT "replace" SELECT DISTINCT * FROM <RDFDataSourceURL> WHERE {?s ?p ?o}
-
All the triples in the RDF resource (data source accessed via URL) will be loaded into the Virtuoso Quad Store (using RDF Data Source URL as the internal quad store Named Graph IRI) as part of the SPARQL query processing pipeline.
Note: the data source URL doesn't even have to be RDF based -- which is where the Virtuoso Sponger Middleware comes into play (download and install the VAD installer package first) since it delivers the following features to Virtuoso's SPARQL engine:
-
Transformation of data from non RDF data sources (file content, hypermedia resources, web services output etc..) into RDF based 3-tuples (triples)
-
Cache Invalidation Scheme Construction -- thus, subsequent queries (without the define get:soft "replace" pragma will not be required bar when you forcefully want to override cache).
-
If you have very large data sources like DBpedia etc. from CKAN, simply use our bulk loader .
SPARQL Endpoint Discovery
Public SPARQL endpoints are emerging at an ever increasing rate. Thus, we've setup up a DNS lookup service that provides access to a large number of SPARQL endpoints. Of course, this doesn't cover all existing endpoints, so if our endpoint is missing please ping me.
Here are a collection of commands for using DNS-SD to discover SPARQL endpoints:
- dns-sd -B _sparql._tcp sparql.openlinksw.com -- browse for services instances
- dns-sd -Z _sparql._tcp sparql.openlinksw.com -- output results in Zone File format
Related
-
Using HTTP from Ruby -- you can just make SPARQL Protocol URLs re. SPARQL
-
Using SPARQL Endpoints via Ruby -- Ruby example using DBpedia endpoint
-
Interactive SPARQL Query By Example (QBE) tool -- provides a graphical user interface (as is common in SQL realm re. query building against RDBMS engines) that works with any SPARQL endpoint
-
Other methods of loading RDF data into Virtuoso
-
Virtuoso Sponger -- architecture and how it turns a wide variety of non RDF data sources into SPARQL accessible data
-
Using OpenLink Data Explorer (ODE) to populate Virtuoso -- locate a resource of interest; click on a bookmarklet or use context menus (if using ODE extensions for Firefox, Safari, or Chrome); and you'll have SPARQL accessible data automatically inserted into your Virtuoso instance.
-
W3C's SPARQLing Data Access Ingenuity -- an older generic SPARQL introduction post
-
Collection of SPARQL Query Examples -- GoodRelations (Product Offers), FOAF (Profiles), SIOC (Data Spaces -- Blogs, Wikis, Bookmarks, Feed Collections, Photo Galleries, Briefcase/DropBox, AddressBook, Calendars, Discussion Forums)
-
Collection of Live SPARQL Queries against LOD Cloud Cache -- simple and advanced queries.
|
01/16/2011 02:06 GMT
|
Modified:
01/19/2011 10:43 GMT
|
Simple Virtuoso Installation & Utilization Guide for SPARQL Users (Update 5)
[
Kingsley Uyi Idehen
]
A declarative query language from the W3C for querying structured propositional data (in the form of 3-tuple [triples] or 4-tuple [quads] records) stored in a deductive database (colloquially referred to as triple or quad stores in Semantic Web and Linked Data parlance).
SPARQL is inherently platform independent. Like SQL, the query language and the backend database engine are distinct. Database clients capture SPARQL queries which are then passed on to compliant backend databases.
Why is it important?
Like SQL for relational databases, it provides a powerful mechanism for accessing and joining data across one or more data partitions (named graphs identified by IRIs). The aforementioned capability also enables the construction of sophisticated Views, Reports (HTML or those produced in native form by desktop productivity tools), and data streams for other services.
Unlike SQL, SPARQL includes result serialization formats and an HTTP based wire protocol. Thus, the ubiquity and sophistication of HTTP is integral to SPARQL i.e., client side applications (user agents) only need to be able to perform an HTTP GET against a URL en route to exploiting the power of SPARQL.
How do I use it, generally?
- Locate a SPARQL endpoint (DBpedia, LOD Cloud Cache, Data.Gov, URIBurner, others), or;
- Install a SPARQL compliant database server (quad or triple store) on your desktop, workgroup server, data center, or cloud (e.g., Amazon EC2 AMI)
- Start the database server
- Execute SPARQL Queries via the SPARQL endpoint.
How do I use SPARQL with Virtuoso?
What follows is a very simple guide for using SPARQL against your own instance of Virtuoso:
- Software Download and Installation
- Data Loading from Data Sources exposed at Network Addresses (e.g. HTTP URLs) using very simple methods
- Actual SPARQL query execution via SPARQL endpoint.
Installation Steps
-
Download Virtuoso Open Source or Virtuoso Commercial Editions
-
Run installer (if using Commercial edition of Windows Open Source Edition, otherwise follow build guide)
-
Follow post-installation guide and verify installation by typing in the command: virtuoso -? (if this fails check you've followed installation and setup steps, then verify environment variables have been set)
-
Start the Virtuoso server using the command: virtuoso-start.sh
-
Verify you have a connection to the Virtuoso Server via the command: isql localhost (assuming you're using default DB settings) or the command: isql localhost:1112 (assuming demo database) or goto your browser and type in: http://<virtuoso-server-host-name>:[port]/conductor (e.g. http://localhost:8889/conductor for default DB or http://localhost:8890/conductor if using Demo DB)
-
Go to SPARQL endpoint which is typically -- http://<virtuoso-server-host-name>:[port]/sparql
-
Run a quick sample query (since the database always has system data in place): select distinct * where {?s ?p ?o} limit 50 .
Troubleshooting
- Ensure environment settings are set and functional -- if using Mac OS X or Windows, so you don't have to worry about this, just start and stop your Virtuoso server using native OS services applets
- If using the Open Source Edition, follow the getting started guide -- it covers PATH and startup directory location re. starting and stopping Virtuoso servers.
- Sponging (HTTP GETs against external Data Sources) within SPARQL queries is disabled by default. You can enable this feature by assigning "SPARQL_SPONGE" privileges to user "SPARQL". Note, more sophisticated security exists via WebID based ACLs.
Data Loading Steps
-
Identify an RDF based structured data source of interest -- a file that contains 3-tuple / triples available at an address on a public or private HTTP based network
- Determine the Address (URL) of the RDF data source
- Go to your Virtuoso SPARQL endpoint and type in the following SPARQL query: DEFINE GET:SOFT "replace" SELECT DISTINCT * FROM <RDFDataSourceURL> WHERE {?s ?p ?o}
-
All the triples in the RDF resource (data source accessed via URL) will be loaded into the Virtuoso Quad Store (using RDF Data Source URL as the internal quad store Named Graph IRI) as part of the SPARQL query processing pipeline.
Note: the data source URL doesn't even have to be RDF based -- which is where the Virtuoso Sponger Middleware comes into play (download and install the VAD installer package first) since it delivers the following features to Virtuoso's SPARQL engine:
-
Transformation of data from non RDF data sources (file content, hypermedia resources, web services output etc..) into RDF based 3-tuples (triples)
-
Cache Invalidation Scheme Construction -- thus, subsequent queries (without the define get:soft "replace" pragma will not be required bar when you forcefully want to override cache).
-
If you have very large data sources like DBpedia etc. from CKAN, simply use our bulk loader .
SPARQL Endpoint Discovery
Public SPARQL endpoints are emerging at an ever increasing rate. Thus, we've setup up a DNS lookup service that provides access to a large number of SPARQL endpoints. Of course, this doesn't cover all existing endpoints, so if our endpoint is missing please ping me.
Here are a collection of commands for using DNS-SD to discover SPARQL endpoints:
- dns-sd -B _sparql._tcp sparql.openlinksw.com -- browse for services instances
- dns-sd -Z _sparql._tcp sparql.openlinksw.com -- output results in Zone File format
Related
-
Using HTTP from Ruby -- you can just make SPARQL Protocol URLs re. SPARQL
-
Using SPARQL Endpoints via Ruby -- Ruby example using DBpedia endpoint
-
Interactive SPARQL Query By Example (QBE) tool -- provides a graphical user interface (as is common in SQL realm re. query building against RDBMS engines) that works with any SPARQL endpoint
-
Other methods of loading RDF data into Virtuoso
-
Virtuoso Sponger -- architecture and how it turns a wide variety of non RDF data sources into SPARQL accessible data
-
Using OpenLink Data Explorer (ODE) to populate Virtuoso -- locate a resource of interest; click on a bookmarklet or use context menus (if using ODE extensions for Firefox, Safari, or Chrome); and you'll have SPARQL accessible data automatically inserted into your Virtuoso instance.
-
W3C's SPARQLing Data Access Ingenuity -- an older generic SPARQL introduction post
-
Collection of SPARQL Query Examples -- GoodRelations (Product Offers), FOAF (Profiles), SIOC (Data Spaces -- Blogs, Wikis, Bookmarks, Feed Collections, Photo Galleries, Briefcase/DropBox, AddressBook, Calendars, Discussion Forums)
-
Collection of Live SPARQL Queries against LOD Cloud Cache -- simple and advanced queries.
|
01/16/2011 02:06 GMT
|
Modified:
01/19/2011 10:43 GMT
|
Simple Virtuoso Installation & Utilization Guide for SPARQL Users (Update 5)
[
Kingsley Uyi Idehen
]
A declarative query language from the W3C for querying structured propositional data (in the form of 3-tuple [triples] or 4-tuple [quads] records) stored in a deductive database (colloquially referred to as triple or quad stores in Semantic Web and Linked Data parlance).
SPARQL is inherently platform independent. Like SQL, the query language and the backend database engine are distinct. Database clients capture SPARQL queries which are then passed on to compliant backend databases.
Why is it important?
Like SQL for relational databases, it provides a powerful mechanism for accessing and joining data across one or more data partitions (named graphs identified by IRIs). The aforementioned capability also enables the construction of sophisticated Views, Reports (HTML or those produced in native form by desktop productivity tools), and data streams for other services.
Unlike SQL, SPARQL includes result serialization formats and an HTTP based wire protocol. Thus, the ubiquity and sophistication of HTTP is integral to SPARQL i.e., client side applications (user agents) only need to be able to perform an HTTP GET against a URL en route to exploiting the power of SPARQL.
How do I use it, generally?
- Locate a SPARQL endpoint (DBpedia, LOD Cloud Cache, Data.Gov, URIBurner, others), or;
- Install a SPARQL compliant database server (quad or triple store) on your desktop, workgroup server, data center, or cloud (e.g., Amazon EC2 AMI)
- Start the database server
- Execute SPARQL Queries via the SPARQL endpoint.
How do I use SPARQL with Virtuoso?
What follows is a very simple guide for using SPARQL against your own instance of Virtuoso:
- Software Download and Installation
- Data Loading from Data Sources exposed at Network Addresses (e.g. HTTP URLs) using very simple methods
- Actual SPARQL query execution via SPARQL endpoint.
Installation Steps
-
Download Virtuoso Open Source or Virtuoso Commercial Editions
-
Run installer (if using Commercial edition of Windows Open Source Edition, otherwise follow build guide)
-
Follow post-installation guide and verify installation by typing in the command: virtuoso -? (if this fails check you've followed installation and setup steps, then verify environment variables have been set)
-
Start the Virtuoso server using the command: virtuoso-start.sh
-
Verify you have a connection to the Virtuoso Server via the command: isql localhost (assuming you're using default DB settings) or the command: isql localhost:1112 (assuming demo database) or goto your browser and type in: http://<virtuoso-server-host-name>:[port]/conductor (e.g. http://localhost:8889/conductor for default DB or http://localhost:8890/conductor if using Demo DB)
-
Go to SPARQL endpoint which is typically -- http://<virtuoso-server-host-name>:[port]/sparql
-
Run a quick sample query (since the database always has system data in place): select distinct * where {?s ?p ?o} limit 50 .
Troubleshooting
- Ensure environment settings are set and functional -- if using Mac OS X or Windows, so you don't have to worry about this, just start and stop your Virtuoso server using native OS services applets
- If using the Open Source Edition, follow the getting started guide -- it covers PATH and startup directory location re. starting and stopping Virtuoso servers.
- Sponging (HTTP GETs against external Data Sources) within SPARQL queries is disabled by default. You can enable this feature by assigning "SPARQL_SPONGE" privileges to user "SPARQL". Note, more sophisticated security exists via WebID based ACLs.
Data Loading Steps
-
Identify an RDF based structured data source of interest -- a file that contains 3-tuple / triples available at an address on a public or private HTTP based network
- Determine the Address (URL) of the RDF data source
- Go to your Virtuoso SPARQL endpoint and type in the following SPARQL query: DEFINE GET:SOFT "replace" SELECT DISTINCT * FROM <RDFDataSourceURL> WHERE {?s ?p ?o}
-
All the triples in the RDF resource (data source accessed via URL) will be loaded into the Virtuoso Quad Store (using RDF Data Source URL as the internal quad store Named Graph IRI) as part of the SPARQL query processing pipeline.
Note: the data source URL doesn't even have to be RDF based -- which is where the Virtuoso Sponger Middleware comes into play (download and install the VAD installer package first) since it delivers the following features to Virtuoso's SPARQL engine:
-
Transformation of data from non RDF data sources (file content, hypermedia resources, web services output etc..) into RDF based 3-tuples (triples)
-
Cache Invalidation Scheme Construction -- thus, subsequent queries (without the define get:soft "replace" pragma will not be required bar when you forcefully want to override cache).
-
If you have very large data sources like DBpedia etc. from CKAN, simply use our bulk loader .
SPARQL Endpoint Discovery
Public SPARQL endpoints are emerging at an ever increasing rate. Thus, we've setup up a DNS lookup service that provides access to a large number of SPARQL endpoints. Of course, this doesn't cover all existing endpoints, so if our endpoint is missing please ping me.
Here are a collection of commands for using DNS-SD to discover SPARQL endpoints:
- dns-sd -B _sparql._tcp sparql.openlinksw.com -- browse for services instances
- dns-sd -Z _sparql._tcp sparql.openlinksw.com -- output results in Zone File format
Related
-
Using HTTP from Ruby -- you can just make SPARQL Protocol URLs re. SPARQL
-
Using SPARQL Endpoints via Ruby -- Ruby example using DBpedia endpoint
-
Interactive SPARQL Query By Example (QBE) tool -- provides a graphical user interface (as is common in SQL realm re. query building against RDBMS engines) that works with any SPARQL endpoint
-
Other methods of loading RDF data into Virtuoso
-
Virtuoso Sponger -- architecture and how it turns a wide variety of non RDF data sources into SPARQL accessible data
-
Using OpenLink Data Explorer (ODE) to populate Virtuoso -- locate a resource of interest; click on a bookmarklet or use context menus (if using ODE extensions for Firefox, Safari, or Chrome); and you'll have SPARQL accessible data automatically inserted into your Virtuoso instance.
-
W3C's SPARQLing Data Access Ingenuity -- an older generic SPARQL introduction post
-
Collection of SPARQL Query Examples -- GoodRelations (Product Offers), FOAF (Profiles), SIOC (Data Spaces -- Blogs, Wikis, Bookmarks, Feed Collections, Photo Galleries, Briefcase/DropBox, AddressBook, Calendars, Discussion Forums)
-
Collection of Live SPARQL Queries against LOD Cloud Cache -- simple and advanced queries.
|
01/16/2011 02:06 GMT
|
Modified:
01/19/2011 10:43 GMT
|
5 Very Important Things to Note about HTTP based Linked Data
[
Kingsley Uyi Idehen
]
- It isn't World Wide Web Specific (HTTP != World Wide Web)
- It isn't Open Data Specific
- It isn't about "Free" (Beer or Speech)
- It isn't about Markup (so don't expect to grok it via "markup first" approach)
- It's about Hyperdata - the use of HTTP and REST to deliver a powerful platform agnostic mechanism for Data Reference, Access, and Integration.
When trying to understand HTTP based Linked Data, especially if you're well versed in DBMS technology use (User, Power User, Architect, Analyst, DBA, or Programmer) think:
- Open Database Connectivity (ODBC) without operating system, data model, or wire-protocol specificity or lock-in potential
- Java Database Connectivity (JDBC) without programming language specificity
- ADO.NET without .NET runtime specificity and .NET bound language specificity
- OLE-DB without Windows operating system & programming language specificity
- XMLA without XML format specificity - with Tabular and Multidimensional results formats expressible in a variety of data representation formats.
- All of the above scoped to the Record rather than Container level, with Generic HTTP scheme URIs associated with each Record, Field, and Field value (optionally)
Remember the need for Data Access & Integration technology is the by product of the following realities: - Human curated data is ultimately dirty, because:
- our thick thumbs, inattention, distractions, and general discomfort with typing, make typos prevalent
- database engines exist for a variety of data models - Graph, Relational, Hierarchical;
- within databases you have different record container/partition names e.g. Table Names;
- within a database record container you have records that are really aspects of the same thing (different keys exist in a plethora of operational / line of business systems that expose aspects of the same entity e.g., customer data that spans Accounts, CRM, ERP application databases);
- different field names (one database has "EMP" while another has "Employee") for the same record
. - Units of measurement is driven by locale, the UK office wants to see sales in Pounds Sterling while the French office prefers Euros etc.
- All of the above is subject to context halos which can be quite granular re. sensitivity e.g. staff travel between locations that alter locales and their roles; basically, profiles matters a lot.
Related
|
01/31/2010 17:31 GMT
|
Modified:
02/01/2010 09:00 GMT
|
Live Virtuoso instance hosting Linked Open Data (LOD) Cloud
[
Kingsley Uyi Idehen
]
We have reached a beachead re. the Virtuoso instance hosting the Linked Open Data (LOD) Cloud; meaning, we are not going to be performing any major updates and deletions short-term, bar incorporation of fresh data sets from the Freebase and Bio2RDF projects (both communities a prepping new RDF data sets). At the current time we have loaded 100% of all the very large data sets from the LOD Cloud. As result, we can start the process of exposing Linked Data virtues in a manner that's palatable to users, developers, and database professionals across the Web 1.0, 2.0, and 3.0 spectrums. What does this mean? You can use the "Search & Find" or"URI Lookup" or SPARQL endpoint associated with the LOD cloud hosting instance to perform the following tasks: - Find entities associated with full text search patterns -- Google Style, but with Entity & Text proximity Rank instead of Page Rank, since we are dealing with Entities rather than documents about entities
- Find and Lookup entities by Identifier (URI) -- which is helpful when locating URIs to use for identify entities in your own linked data spaces on the Web
- View entity descriptions via a variety of representation formats (HTML, RDFa, RDF/XML, N3, Turtle etc.)
- Determine uses of entity identifiers across the LOD cloud -- which helps you select preferred URIs based on usage statistics.
What does it offer Web 1.0 and 2.0 developers? If you don't want to use the SPARQL based Web Service, or other Linked Data Web oriented APIs for interacting with the LOD cloud programmatically, you can simply use the powerful REST style Web Service that provides URL parameters for performing full text oriented "Search", entity oriented "Find" queries, and faceted navigation over the huge data corpus with results data returned in JSON and XML formats. Next Steps: Amazon have agreed to add all the LOD Cloud data sets to their existing public data sets collective. Thus, the data sets we are loading will be available in "raw data" (RDF) format on the public data sets page via Named Elastic Block Storage (EBS) Snapshots); meaning, you can make an EC2 AMI (e.g. a Linux, Windows, Solaris) and install an RDF quad or triple store of choice into your AMI, then simply load data from the LOD cloud based on your needs. In addition to the above, we are also going to offer a Virtuoso 6.0 Cluster Edition based LOD Cloud AMI (as we've already done with DBpedia, MusicBrainz, NeuroCommons, and Bio2Rdf) that will enable you to simply instantiate a personal and service specific edition of Virtuoso with all the LOD data in place and fully tuned for performance and scalability; basically, you will simply press "Instantiate AMI" and a LOD cloud data space, in true Linked Data from, will be at your disposal within minutes (i.e. the time it takes the DB to start). Work on the migration of the LOD data to EC2 starts this week. Thus, if you are interested in contributing an RDF based data set to the LOD cloud now is the time to get your archive links in place on the (see: ESW Wiki page for LOD Data Sets).
|
03/30/2009 11:27 GMT
|
Modified:
04/01/2009 14:26 GMT
|
Live Virtuoso instance hosting Linked Open Data (LOD) Cloud
[
Kingsley Uyi Idehen
]
We have reached a beachead re. the Virtuoso instance hosting the Linked Open Data (LOD) Cloud; meaning, we are not going to be performing any major updates and deletions short-term, bar incorporation of fresh data sets from the Freebase and Bio2RDF projects (both communities a prepping new RDF data sets). At the current time we have loaded 100% of all the very large data sets from the LOD Cloud. As result, we can start the process of exposing Linked Data virtues in a manner that's palatable to users, developers, and database professionals across the Web 1.0, 2.0, and 3.0 spectrums. What does this mean? You can use the "Search & Find" or"URI Lookup" or SPARQL endpoint associated with the LOD cloud hosting instance to perform the following tasks: - Find entities associated with full text search patterns -- Google Style, but with Entity & Text proximity Rank instead of Page Rank, since we are dealing with Entities rather than documents about entities
- Find and Lookup entities by Identifier (URI) -- which is helpful when locating URIs to use for identify entities in your own linked data spaces on the Web
- View entity descriptions via a variety of representation formats (HTML, RDFa, RDF/XML, N3, Turtle etc.)
- Determine uses of entity identifiers across the LOD cloud -- which helps you select preferred URIs based on usage statistics.
What does it offer Web 1.0 and 2.0 developers? If you don't want to use the SPARQL based Web Service, or other Linked Data Web oriented APIs for interacting with the LOD cloud programmatically, you can simply use the powerful REST style Web Service that provides URL parameters for performing full text oriented "Search", entity oriented "Find" queries, and faceted navigation over the huge data corpus with results data returned in JSON and XML formats. Next Steps: Amazon have agreed to add all the LOD Cloud data sets to their existing public data sets collective. Thus, the data sets we are loading will be available in "raw data" (RDF) format on the public data sets page via Named Elastic Block Storage (EBS) Snapshots); meaning, you can make an EC2 AMI (e.g. a Linux, Windows, Solaris) and install an RDF quad or triple store of choice into your AMI, then simply load data from the LOD cloud based on your needs. In addition to the above, we are also going to offer a Virtuoso 6.0 Cluster Edition based LOD Cloud AMI (as we've already done with DBpedia, MusicBrainz, NeuroCommons, and Bio2Rdf) that will enable you to simply instantiate a personal and service specific edition of Virtuoso with all the LOD data in place and fully tuned for performance and scalability; basically, you will simply press "Instantiate AMI" and a LOD cloud data space, in true Linked Data from, will be at your disposal within minutes (i.e. the time it takes the DB to start). Work on the migration of the LOD data to EC2 starts this week. Thus, if you are interested in contributing an RDF based data set to the LOD cloud now is the time to get your archive links in place on the (see: ESW Wiki page for LOD Data Sets).
|
03/30/2009 11:27 GMT
|
Modified:
04/01/2009 14:26 GMT
|
Live Virtuoso instance hosting Linked Open Data (LOD) Cloud
[
Kingsley Uyi Idehen
]
We have reached a beachead re. the Virtuoso instance hosting the Linked Open Data (LOD) Cloud; meaning, we are not going to be performing any major updates and deletions short-term, bar incorporation of fresh data sets from the Freebase and Bio2RDF projects (both communities a prepping new RDF data sets). At the current time we have loaded 100% of all the very large data sets from the LOD Cloud. As result, we can start the process of exposing Linked Data virtues in a manner that's palatable to users, developers, and database professionals across the Web 1.0, 2.0, and 3.0 spectrums. What does this mean? You can use the "Search & Find" or"URI Lookup" or SPARQL endpoint associated with the LOD cloud hosting instance to perform the following tasks: - Find entities associated with full text search patterns -- Google Style, but with Entity & Text proximity Rank instead of Page Rank, since we are dealing with Entities rather than documents about entities
- Find and Lookup entities by Identifier (URI) -- which is helpful when locating URIs to use for identify entities in your own linked data spaces on the Web
- View entity descriptions via a variety of representation formats (HTML, RDFa, RDF/XML, N3, Turtle etc.)
- Determine uses of entity identifiers across the LOD cloud -- which helps you select preferred URIs based on usage statistics.
What does it offer Web 1.0 and 2.0 developers? If you don't want to use the SPARQL based Web Service, or other Linked Data Web oriented APIs for interacting with the LOD cloud programmatically, you can simply use the powerful REST style Web Service that provides URL parameters for performing full text oriented "Search", entity oriented "Find" queries, and faceted navigation over the huge data corpus with results data returned in JSON and XML formats. Next Steps: Amazon have agreed to add all the LOD Cloud data sets to their existing public data sets collective. Thus, the data sets we are loading will be available in "raw data" (RDF) format on the public data sets page via Named Elastic Block Storage (EBS) Snapshots); meaning, you can make an EC2 AMI (e.g. a Linux, Windows, Solaris) and install an RDF quad or triple store of choice into your AMI, then simply load data from the LOD cloud based on your needs. In addition to the above, we are also going to offer a Virtuoso 6.0 Cluster Edition based LOD Cloud AMI (as we've already done with DBpedia, MusicBrainz, NeuroCommons, and Bio2Rdf) that will enable you to simply instantiate a personal and service specific edition of Virtuoso with all the LOD data in place and fully tuned for performance and scalability; basically, you will simply press "Instantiate AMI" and a LOD cloud data space, in true Linked Data from, will be at your disposal within minutes (i.e. the time it takes the DB to start). Work on the migration of the LOD data to EC2 starts this week. Thus, if you are interested in contributing an RDF based data set to the LOD cloud now is the time to get your archive links in place on the (see: ESW Wiki page for LOD Data Sets).
|
03/30/2009 11:27 GMT
|
Modified:
04/01/2009 14:26 GMT
|
|
|