Download Adaptive Revisiting with Heritrix

Transcript
We need to have the CrawlURIs not only sorted by the time when they
should be processed next, but also by their URI (as a string). This means
that we need to have two indexes for the database. While each Berkley
database can only have one key/value pair and is indexed by the key, it is
possible to create, what is called, a secondary database that is linked to a
primary one. This secondary database simply indexes the data in the
primary database with another key. Entries are made into the secondary
database automatically when they are entered into the primary, once the
association between the databases has been made. The database can then
be accessed normally, either by looking up a value by its key or iterating
through the keys.
We decided to use the URI as the key in the primary database and create a
secondary database to act as the de facto priority queue. Because the
scheduling directive also influences this the secondary key needs to be a
composite of it and the time of next processing.
Fortunately, the Berkley DB API makes this relatively easy. The
secondary database is fed a custom written key creator. This key creator
receives the data being stored (the CrawlURI) and uses it to construct any
key it wishes, using information obtained from it. By basing the key
creator on the TupleSerialKeyCreator provided with Bdb, it is relatively
straight forward to access the scheduling directive and the time of next
processing and add each to the serial (or composite) key.
In addition to these primary and secondary databases, the ARHostQueue
also has a database to store URIs that are currently being processed. If
host valence higher than 1 were not allowed, this would not be needed,
since the queue would become busy and the issued URI can simply
remain at the front of the queue until the processing is completed, at
which time it would be assigned a new time of next processing. However,
with the possibility that multiple URIs are issued at the same time, this
becomes much more complicated. Moving the URIs temporarily to a
separate database was considered the simplest solution to this.
Alternatively the URIs could have been marked as being processed and
remained at the front of the queue, but this would have complicated the
issuing of URIs and the calculation of the time when the queue will next
be ready (which is based partly on the time when the ‘next’ URI will be
ready for processing. The database of in URIs being processed is indexed
by URI strings.
68