From: Cameron Dale Date: Fri, 29 Aug 2008 21:51:08 +0000 (-0700) Subject: More work on the paper, almost done now. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=34beb828d688e5cd4b42aafafdb1b0580f926d62;p=quix0rs-apt-p2p.git More work on the paper, almost done now. --- diff --git a/docs/paper/apt-p2p-paper.kilepr b/docs/paper/apt-p2p-paper.kilepr index 34ec89d..d094d73 100644 --- a/docs/paper/apt-p2p-paper.kilepr +++ b/docs/paper/apt-p2p-paper.kilepr @@ -33,8 +33,8 @@ open=false [item:paper.tex] archive=true -column=0 +column=39 encoding=UTF-8 highlight=LaTeX -line=927 +line=198 open=true diff --git a/docs/paper/model_simple.eps b/docs/paper/model_simple.eps index 760075a..95bd29c 100644 --- a/docs/paper/model_simple.eps +++ b/docs/paper/model_simple.eps @@ -1,7 +1,7 @@ %!PS-Adobe-2.0 EPSF-2.0 %%Title: model_simple.fig %%Creator: fig2dev Version 3.2 Patchlevel 4 -%%CreationDate: Thu Aug 28 13:02:50 2008 +%%CreationDate: Fri Aug 29 14:30:22 2008 %%For: camerond@quesnel (Cameron Dale,galat,2008/09) %%BoundingBox: 0 0 371 470 %%Magnification: 1.0000 @@ -505,12 +505,6 @@ gs 1 -1 sc (6 Hash) col35 sh gr 1845 2925 m gs 1 -1 sc (5 Pkg?) col35 sh gr /Helvetica ff 210.00 scf sf -3105 3240 m -gs 1 -1 sc (7 Hash?) col35 sh gr -/Helvetica ff 210.00 scf sf -3015 4005 m -gs 1 -1 sc (8 Peers) col35 sh gr -/Helvetica ff 210.00 scf sf 4365 3240 m gs 1 -1 sc (Hash?) col35 sh gr /Helvetica ff 210.00 scf sf @@ -531,6 +525,15 @@ gs 1 -1 sc (1 File?) col35 sh gr /Helvetica ff 210.00 scf sf 3150 945 m gs 1 -1 sc (4 File) col35 sh gr +/Helvetica ff 210.00 scf sf +3015 3150 m +gs 1 -1 sc (7/9 Hash?) col35 sh gr +/Helvetica ff 210.00 scf sf +3015 4005 m +gs 1 -1 sc (8 Peers/) col35 sh gr +/Helvetica ff 210.00 scf sf +2835 4230 m +gs 1 -1 sc (10 Pieces) col35 sh gr % here ends figure; $F2psEnd rs diff --git a/docs/paper/model_simple.fig b/docs/paper/model_simple.fig index 96dfefa..4ca45e8 100644 --- a/docs/paper/model_simple.fig +++ b/docs/paper/model_simple.fig @@ -168,8 +168,6 @@ Single 4 0 35 50 -1 16 14 0.0000 4 150 510 4770 6930 Store\001 4 0 35 50 -1 16 14 0.0000 4 150 675 2385 3375 6 Hash\001 4 0 35 50 -1 16 14 0.0000 4 195 660 1845 2925 5 Pkg?\001 -4 0 35 50 -1 16 14 0.0000 4 150 795 3105 3240 7 Hash?\001 -4 0 35 50 -1 16 14 0.0000 4 150 735 3015 4005 8 Peers\001 4 0 35 50 -1 16 14 0.0000 4 150 615 4365 3240 Hash?\001 4 0 35 50 -1 16 14 0.0000 4 150 615 4680 3825 Hash?\001 4 0 35 50 -1 16 14 0.0000 4 150 615 4725 4455 Hash?\001 @@ -177,3 +175,6 @@ Single 4 0 35 50 -1 16 14 0.0000 4 150 645 1980 1170 2 File?\001 4 0 35 50 -1 16 14 0.0000 4 150 645 2160 855 1 File?\001 4 0 35 50 -1 16 14 0.0000 4 150 525 3150 945 4 File\001 +4 0 35 50 -1 16 14 0.0000 4 150 975 3015 3150 7/9 Hash?\001 +4 0 35 50 -1 16 14 0.0000 4 150 795 3015 4005 8 Peers/\001 +4 0 35 50 -1 16 14 0.0000 4 150 930 2835 4230 10 Pieces\001 diff --git a/docs/paper/paper.tex b/docs/paper/paper.tex index 0bf3df7..9f8e58a 100644 --- a/docs/paper/paper.tex +++ b/docs/paper/paper.tex @@ -34,8 +34,8 @@ Email: jcliu@cs.sfu.ca}} \maketitle \begin{abstract} -The Internet has become an cost-effective -vehicle for software development and release, particular in the free software society. +The Internet has become a cost-effective +vehicle for software development and release, particular in the free software community. Given the free nature of these software, there are often a number of users motivated by altruism to help out with the distribution, so as to promote the healthy development of this voluntary society. It is thus naturally expected that peer-to-peer distribution can be implemented, @@ -43,19 +43,19 @@ which scale well with large user bases and can easily explore the network resour the volunteers. Unfortunately, this application scenario has many unique characteristics, which -make a straightforward adoption of such existing peer-to-peer systems for file sharing as BitTorrent suboptimal. In particular, +make a straightforward adoption of existing peer-to-peer systems for file sharing such as BitTorrent suboptimal. In particular, a software release often consists of a large number of packages, which are difficult to be distributed individually, but the archive is too large to be distributed in its entirety. The packages are also being constantly -updated by the loosely-managed developed; yet the interest in a particular version of a package can be very +updated by the loosely-managed developers, and the interest in a particular version of a package can be very limited depending on the computer platforms and operating systems used. -In this paper, we propose a novel peer-to-peer assisted distributor design that +In this paper, we propose a novel peer-to-peer assisted distribution system design that addresses the above challenges. It enhances the existing distribution systems by providing compatible and yet more efficient downloading and updating services for software packages. Our design leads to \texttt{apt-p2p}, a practical implementation that extends the popular \texttt{apt} distributor. \texttt{apt-p2p} has been used in conjuction with Debian-based distribution of Linux software packages and will also be available in the next release of Ubuntu. We have addressed the key design issues in \texttt{apt-p2p}, including indexing table customization, response time reduction, and multi-value extension. They together ensure -that the altruistic users' resources be effectively utilized and thus significantly reduce the currently -sheer bandwidth requirements of hosting the software, as confirmed by our existing real user statistics. +that the altruistic users' resources are effectively utilized and thus significantly reduces the currently +large bandwidth requirements of hosting the software, as confirmed by our existing real user statistics. \end{abstract} %%%%%%%%%%%%%%%%%%%%%%%%%%% Section %%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -63,42 +63,42 @@ sheer bandwidth requirements of hosting the software, as confirmed by our existi \section{Introduction} \label{intro} -With the widespread penetration of broadband accesses, the Internet has become an cost-effective +With the widespread penetration of broadband access, the Internet has become a cost-effective vehicle for software development and release. This is particularly true for the free software -society whose developers and users are worldwide distributed and work asynchronously. The ever increasing power of -modern programming languages, computer platforms, and operating systems has made these software extremely large and complex, -which are often divided into a huge number of small packages. +community whose developers and users are distributed worldwide and work asynchronously. The ever increasing power of +modern programming languages, computer platforms, and operating systems has made this software extremely large and complex, +though it is often divided into a huge number of small packages. Together with their popularity among users, -an efficient and reliable management and distribution of these software over the Internet has become a challenging task. +an efficient and reliable management and distribution of these software packages over the Internet has become a challenging task. -The existing distributor for free software are mostly based on the client/server model, e.g., +The existing distribution for free software is mostly based on the client/server model, e.g., the Advanced Package Tool (\texttt{apt}) for Linux, which suffers from the well-known bottleneck problem. -Given the free nature of these software, there are often a number of users +Given the free nature of this software, there are often a number of users motivated by altruism to help out with the distribution, so as to promote the healthy development of this voluntary society. We thus naturally expect that peer-to-peer distribution can be implemented in -this context, which scale well with large user bases and can easily explore the network resources made available by +this context, which will scale well with the currently large user bases and can easily explore the network resources made available by the volunteers. Unfortunately, this application scenario has many unique characteristics, which -make a straightforward adoption of such existing peer-to-peer systems for file sharing as BitTorrent suboptimal. In particular, +make a straightforward adoption of existing peer-to-peer systems for file sharing such as BitTorrent suboptimal. In particular, there are too many packages to distribute each individually, but the archive is too large to distribute in its entirety. The packages are also being constantly -updated by the loosely-managed developed; yet the interest in a particular version of a package can be very +updated by the loosely-managed developers, and the interest in a particular version of a package can be very limited. They together make it very difficult to efficiently create and manage torrents/trackers. The random downloading nature of BitTorrent-like systems is also different from the -sequential order used in existing software package distributors. This in turn suppresses interaction with users +sequential order used in existing software package distributions. This in turn suppresses interaction with users given the difficulty in tracking speed and downloading progress. -In this paper, we propose a novel peer-to-peer assisted distributor design that +In this paper, we propose a novel peer-to-peer assisted distribution system design that addresses the above challenges. It enhances the existing distribution systems by providing compatible and yet more efficient downloading and updating services for software packages. Our design leads to the development of \texttt{apt-p2p}, a practical implementation based on the Debian \footnote{Debian - The Universal Operating System: {\it http://www.debian.org/}} package distribution system. We have addressed the key design issues in \texttt{apt-p2p}, including indexing table customization, response time reduction, and multi-value extension. They together ensure -that the altruistic users' resources be effectively utilized and thus significantly reduce the currently -sheer bandwidth requirements of hosting the software. +that the altruistic users' resources are effectively utilized and thus significantly reduces the currently +large bandwidth requirements of hosting the software. \texttt{apt-p2p} has been used in conjuction with Debian-based distribution of Linux -software packages and will also be available in the next release of Ubuntu. We have evaluated our currently deployment to +software packages and will also be available in the next release of Ubuntu. We have evaluated our current deployment to determine how effective it is at meeting our goals, and to see what effect it is having on the Debian package distribution system. In particular, our existing real user statistics have suggested that it responsively interacts with clients and substantially reduces server cost. @@ -106,8 +106,9 @@ have suggested that it responsively interacts with clients and substantially red The rest of this paper is organized as follows. The background and motivation are presented in Section~\ref{situation}, including an analysis of BitTorrent's use for this purpose in Section~\ref{bittorrent}. We propose our solution in Section~\ref{opportunity}. We then detail our sample implementation for Debian-based distributions in Section~\ref{implementation}, -including an in-depth look at our DHT -customizations in Section~\ref{custom_dht}. The performance of our implementation is evaluated in Section~\ref{analysis}. We examine some related work in Section~\ref{related}, and then +including an in-depth look at our system optimization +in Section~\ref{custom_dht}. The performance of our implementation is evaluated +in Section~\ref{analysis}. We examine some related work in Section~\ref{related}, and then Section~\ref{conclusions} concludes the paper and offers some future directions. %%%%%%%%%%%%%%%%%%%%%%%%%%% Section %%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -147,8 +148,8 @@ manager is called \texttt{portage}, SlackWare Linux uses \texttt{pkgtools}, and FreeBSD has a suite of command-line tools, all of which download these tarballs from web servers. -Similar tools have been used for other software packages. CPAN -distributes software packages for the PERL +Similar tools have been used for other types of software packages. CPAN +distributes packaged software for the PERL programming language, using SOAP RPC requests to find and download files. Cygwin provides many of the standard Unix/Linux tools in a Windows environment, using a @@ -167,12 +168,13 @@ to use, such as SourceForge. Given the free nature of this software, there are often a number of users motivated by altruism to want to help out with the distribution. -This is particularly true considering that many of this software is used by +This is particularly true considering that much of this software is used by groups that are staffed mostly, or sometimes completely, by volunteers. They are thus motivated to contribute their network resources, so as to promote the healthy development of the volunteer community that released the software. -We also naturally expect that peer-to-peer distribution can be implementation in -this context, which scale well with large user bases and can easily explore the network resources made available by +We also naturally expect that peer-to-peer distribution can be implemented in +this context, which will scale well with the currently large user bases +and can easily explore the network resources made available by the volunteers. @@ -194,7 +196,7 @@ architecture that the package is intended for. \begin{figure} \centering -\includegraphics[width=\columnwidth]{apt_p2p_simulation-size_CDF.eps} +\includegraphics[width=0.80\columnwidth]{apt_p2p_simulation-size_CDF.eps} \caption{The CDF of the size of packages in a Debian system, both for the actual size and adjusted size based on the popularity of the package.} @@ -205,7 +207,7 @@ For example, Figure~\ref{size_CDF} shows the size of the packages in the current Debian distribution. While 80\% of the packages are less than 512~KB, some of the packages are hundreds of megabytes. The entire archive consists of 22,298 packages and is approximately 119,000 MB -in size. Most of the packages are to be installed in any computer environment, but there are +in size. Many of the packages are to be installed in any computer environment, but there are also OS- or architecture-specific packages. \subsubsection{Package Updates} @@ -216,12 +218,12 @@ releasing a new version with improved functionality, or the distributor updating their packaging of the software to meet new requirements. Even if the distributor periodically makes \emph{stable} releases, which are snapshots of -all the packages in the archive at a certain time, updates are still +all the packages in the archive at a certain time, later updates are still released for security issues or serious bugs. \begin{figure} \centering -\includegraphics[width=\columnwidth]{size-quarter.eps} +\includegraphics[width=0.9\columnwidth]{size-quarter.eps} \caption{The amount of data in the 119,000 MB Debian archive that is updated each day, broken down by architecture.} \label{update_size} @@ -238,14 +240,14 @@ asynchronously on a worldwide scale. \subsubsection{Limited Interest} Finally, though there are a large number of packages and a large number of -users, the interest in a particular version of a package can be very +users, the interest in a particular package, or version of a package, can be very limited. Specifically, there are core packages that every user has to download, but most packages would fall in the category of optional or extra, and so are interesting to only a limited number of people. \begin{figure} \centering -\includegraphics[width=\columnwidth]{apt_p2p_popularity-cdf.eps} +\includegraphics[width=0.80\columnwidth]{apt_p2p_popularity-cdf.eps} \caption{The CDF of the popularity of packages in a Debian system.} \label{popularity_CDF} \end{figure} @@ -263,9 +265,9 @@ Given the relatively long time for software package downloading, existing packag some kind of indication of speed and completeness for users to monitor. Since previous client-server downloads occurred in a sequential fashion, the package management software also measures the speed -based on sequential downloading. To offer comparable user experience, it is naturally to expect that +based on sequential downloading. To offer comparable user experience, it is natural to expect that the new peer-to-peer solution be reasonably responsive at retrieving packages, -preferably enabling sequential downloading order, too. +preferably in a sequential downloading order too. \subsection{Why BitTorrent Doesn't Work Well} \label{bittorrent} @@ -282,7 +284,7 @@ An alternative is to create torrents tracking smaller groups of packages. Unfort quite difficult given the unique characteristic of free software packages. First, there is no obvious way to divide the packages into torrents. Most of the packages are too small, and there are too many packages -in the entire archive to create individual torrents for each one. +in the entire archive, to create individual torrents for each one. On the other hand, all the packages together are too large to track efficiently as a single torrent. Hence, some division of the archive's packages into torrents is obviously necessary, but wherever that @@ -291,9 +293,9 @@ or prevent some peers from connecting to others who do have the same content. In addition, a small number of the packages can be updated every day which would add new files to the torrent, thereby changing its \emph{infohash} identifier and making it a new torrent. This will -severely fracture the download population, even though peers in the +severely fracture the download population, since even though peers in the new torrent may share 99\% of the packages in common with peers in the -old torrent. +old torrent, they will be unable to communicate. Other issues also prevent BitTorrent from being a good solution to this problem. In particular, BitTorrent's fixed piece sizes (usually 512 KB) that disregard file @@ -307,21 +309,22 @@ management tools expectation of sequential downloads. On the other hand, there are aspects of BitTorrent that are no longer critical. Specifically, with altruistic peers -and all files being available without uploading, incentives to share +and all files being available to download without uploading, incentives to share become a less important issue. Also, the availability of seeds are -not critical either, as the mirror sites serve in that capacity -already. +not critical either, as the serves are already available to serve in +that capacity. %%%%%%%%%%%%%%%%%%%%%%%%%%% Section %%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{Peer-to-Peer Assisted Distributor: An Overview} \label{opportunity} -We now present the design of our peer-to-peer assisted distributor for free software package releases and +We now present the design of our peer-to-peer assisted distribution system for free software package releases and updates. A key principle in our design is that the new functionalities implemented in our distributor should be transparent to users, -thus offering the same experience as using conventional software management systems, despite enhanced efficiency. +thus offering the same experience as using conventional software management systems, but with enhanced efficiency. That said, we assume that the user is still attempting to download packages from a -server, but the requests will be proxied by our peer-to-peer program. The server is always available and has all of the package files. +server, but the requests will be proxied by our peer-to-peer program. +We further assume that the server is always available and has all of the package files. In addition, the cryptographic hash of the packages will be available separately from the package itself, and is usually contained in an \emph{index} file which also contains all the packages' names, @@ -329,7 +332,7 @@ locations and sizes. \begin{figure} \centering -\includegraphics[width=\columnwidth]{model_simple.eps} +\includegraphics[width=0.9\columnwidth]{model_simple.eps} \caption{The different phases of functionality of our peer-to-peer distribution model.} \label{model} \end{figure} @@ -342,7 +345,7 @@ available the index files containing the cryptographic hashes all packages. Later, in Phase~2, upon receiving a request from the user to download a package (5), our program will search the index files for the package being requested and find its hash (6). This hash can -then be looked up recursively in an indexing structure (a Distributed Hash Table [] in our implementation) (7), which will return a +then be looked up recursively in an indexing structure (a Distributed Hash Table in our implementation) (7), which will return a list of peers that have the package already (8). The package can then be downloaded from the peers (11,12), it can be verified using the hash (13), and if valid can be returned to the user (14). The @@ -352,15 +355,15 @@ as it is now a source for others to download from. In steps (11,12), the fact that this package is also available to download for free from a server is very important to our proposed model. If the package hash can not be found in the DHT, the peer can then fallback to -downloading from the original location (i.e. the network of -mirrors). The mirrors thus, with no modification to their -functionality, serve as seeds for the packages in the peer-to-peer +downloading from the original location (i.e. the server). +The server thus, with no modification to its +functionality, serves as a seed for the packages in the peer-to-peer system. Any packages that have just been updated, or that are very rare, and so don't have any peers available, can always be found on -the mirror. Once the peer has completed the download from the mirror +the server. Once the peer has completed the download from the server and verified the package, it can then add itself to the DHT as the first peer for the new package, so that future requests for the package -will not need the mirror. +will not need the server. This sparse interest in a large number of packages undergoing constant updating @@ -369,11 +372,7 @@ Table (DHT). DHTs require unique keys to store and retrieve strings of data, for which the cryptographic hashes used by these package management systems are perfect for. The stored and retrieved strings can then be pointers to the peers that have the package that hashes -to that key. A downloading peer can lookup the package hash in the -DHT and, if it is found, download the file from those peers and -verify the package with the hash. Once the download is complete, the -peer will add its entry to the DHT indicating that it now has the -package. +to that key. Note that, despite downloading the package from untrustworthy peers, the trust of the package is always guaranteed through the use @@ -382,43 +381,43 @@ until the hash is looked up in the DHT, so a hash must first come from a trusted source (i.e. the distributors server). Most distributors use index files that contain hashes for a large number of the packages in their archive, and which are also hashed. After retrieving the -index's hash from the mirror, the index file can be downloaded from +index's hash from the server, the index file can be downloaded from peers and verified. Then the program has access to all the hashes of the packages it will be downloading, all of which can be verified with a \emph{chain of trust} that stretches back to the original distributor's server. -\subsection{Implementation Options} -\label{imp_options} - -There are several ways to implement the desired peer-to-peer functionality -into the existing package management software. The functionality can -be directly integrated through modifications to the software, though -this could be difficult as the peer-to-peer functionality should be running -at all times. This is needed both for efficient lookups and to -support uploading of already downloaded packages. Unfortunately, the -package management tools typically only run until the download and -install request is complete. - -Many of the package management software implementations use HTTP -requests from web servers to download the packages, which makes it -possible to implement the peer-to-peer aspect as an almost standard HTTP -caching proxy. This proxy will run as a daemon in the background, -listening for requests from the package management tool for package -files, as well as serving (uploading) cached package to other peers. -It will get uncached requests first from the peer-to-peer system, or -fall back to the normal HTTP request from a server should it not -be found. For methods that don't use HTTP requests, other types of -proxies may also be possible. - -\subsection{Downloading From Peers} +% \subsection{Implementation Options} +% \label{imp_options} +% +% There are several ways to implement the desired peer-to-peer functionality +% into the existing package management software. The functionality can +% be directly integrated through modifications to the software, though +% this could be difficult as the peer-to-peer functionality should be running +% at all times. This is needed both for efficient lookups and to +% support uploading of already downloaded packages. Unfortunately, the +% package management tools typically only run until the download and +% install request is complete. +% +% Many of the package management software implementations use HTTP +% requests from web servers to download the packages, which makes it +% possible to implement the peer-to-peer aspect as an almost standard HTTP +% caching proxy. This proxy will run as a daemon in the background, +% listening for requests from the package management tool for package +% files, as well as serving (uploading) cached package to other peers. +% It will get uncached requests first from the peer-to-peer system, or +% fall back to the normal HTTP request from a server should it not +% be found. For methods that don't use HTTP requests, other types of +% proxies may also be possible. + +\subsection{Peer Downloading Protocol} \label{downloading} Although not necessary, we recommend implementing a download protocol that is similar to the protocol used to fetch packages from -the distributor's servers. This simplifies the peer-to-peer program, as it -can then treat peers and mirrors almost identically when requesting -packages. In fact, the mirrors can be used when there are only a few +the distributor's server. This simplifies the peer-to-peer program, as it +can then treat peers and the server almost identically when requesting +packages. In fact, the server can be used when there are only a few slow peers available for a file to help speed up the download process. @@ -438,7 +437,9 @@ to store and retrieve these piece hashes using the peer-to-peer protocol. In addition to storing the file download location in the DHT (which would still be used for small files), a peer will store a \emph{torrent string} containing the peer's hashes of the pieces of -the larger files. These piece hashes are compared ahead of time +the larger files (similar to (15) in Phase 3 of Figure~\ref{model}). +These piece hashes will be retrieved and compared ahead of time by +the downloading peer ((9,10) in Phase 2 of Figure~\ref{model}) to determine which peers have the same piece hashes (they all should), and then used during the download to verify the pieces of the downloaded package. @@ -469,9 +470,10 @@ implementation used by most of the existing BitTorrent clients to implement trackerless operation. The communication is all handled by UDP messages, and RPC (remote procedure call) requests and responses are all \emph{bencoded} in the same way as BitTorrent's -\texttt{.torrent} files. Khashmir uses the high-level Twisted -event-driven networking engine \cite{twisted}, so we also use -Twisted in our sample implementation for all other networking needs. +\texttt{.torrent} files. +% Khashmir uses the high-level Twisted +% event-driven networking engine \cite{twisted}, so we also use +% Twisted in our sample implementation for all other networking needs. More details of this customized DHT can be found below in Section~\ref{custom_dht}. @@ -489,10 +491,10 @@ index files that contain the hashes of the individual packages. %%%%%%%%%%%%%%%%%%%%%%%%%%% Section %%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{Customized DHT / System Optimization} +\section{System Optimization} \label{custom_dht} -A large contribution of our work is in the customization and use of +Another contribution of our work is in the customization and use of a Distributed Hash Table (DHT). Although our DHT is based on Kademlia, we have made many improvements to it to make it suitable for this application. In addition to a novel storage technique to @@ -501,34 +503,31 @@ up queries, allowed the storage of multiple values for each key, and incorporated some improvements from BitTorrent's tracker-less DHT implementation. -\subsection{Kademlia DHT Background} +\subsection{DHT Details} \label{dht} -DHT's operate by storing (\emph{key}, \emph{value}) pairs in a -distributed fashion such that no node will, on average, store more +DHTs operate by storing (\emph{key}, \emph{value}) pairs in a +distributed fashion such that no node will, on average, store more or have to work harder than any other node. They support two primitive operations: \emph{put}, which takes a key and a value and stores it in the DHT; and \emph{get}, which takes a key and returns a value (or values) that was previously stored with that key. These operations are -recursive, as each node does not know about all the other nodes in a +recursive, as each node does not know about all the other nodes in the DHT, and so must recursively search for the correct node to put to or get from. -The Kademlia DHT, like most other DHTs, assigns IDs to peers from +The Kademlia DHT, like most other DHTs, assigns IDs to peers randomly from the same space that is used for keys. The peers with IDs closest to -the desired key will then store the values for that key. Lookups are -recursive, as nodes are queried in each step that are exponentially -closer to the key than in the previous step. - -Nodes in a Kademlia system support four primitive requests. +the desired key will then store the values for that key. +Nodes support four primitive requests. \texttt{ping} will cause a peer to return nothing, and is only used -to determine if a node is still alive, while \texttt{store} tells a +to determine if a node is still alive. \texttt{store} tells a node to store a value associated with a given key. The most important primitives are \texttt{find\_node} and \texttt{find\_value}, which both function recursively to find nodes close to a key. The queried nodes will return a list of the nodes they know about that are closest to the key, allowing the querying -node to quickly traverse the DHT to find the nodes close to the +node to quickly traverse the DHT to find the nodes closest to the desired key. The only difference between \texttt{find\_node} and \texttt{find\_value} is that the \texttt{find\_value} query will cause a node to return a value, if it has one for that key, instead of a list of nodes. @@ -620,7 +619,7 @@ before a node is removed from the routing table. \begin{figure} \centering -\includegraphics[width=\columnwidth]{apt_p2p_improvements-find_value.eps} +\includegraphics[width=0.80\columnwidth]{apt_p2p_improvements-find_value.eps} \caption{The distribution of average response times PlanetLab nodes experience for \texttt{find\_value} queries. The original DHT implementation results are shown, as well as the successive @@ -628,14 +627,14 @@ improvements that we made to reduce the response time.} \label{improvements} \end{figure} -To test our changes during development, we ran the customized DHT +To test our changes during development, we ran our customized DHT for several hours after each major change on over 300 PlanetLab nodes \cite{planetlab}. Though the nodes are not expected to be firewalled or NATted, some can be quite overloaded and so consistently fail to respond within a timeout period, similar to NATted peers. The resulting distribution of the nodes' average response times is shown in Figure~\ref{improvements}. Each improvement successfully reduced -the response time, for a total reduction of more than half. The +the response time, for a total reduction of more than 50\%. The final distribution is also narrower, as the improvements make the system more predictable. However, there are still a large number of outliers with higher average response times, which are the @@ -645,7 +644,7 @@ constant as it is a configuration option, but can be much larger if the node is too overloaded for the program to be able to check for a timeout very often. -\subsection{Extension with Multiple Values} +\subsection{Multiple Values Extension} \label{multiple_values} The original design of Kademlia specified that each key would have @@ -680,7 +679,50 @@ abort the search once it has found enough values in some nodes, or it could choose to only request values from the nodes that are closest to the key being searched for. - +% \subsection{\textbf{OPTIONAL}: BitTorrent's Improvements} +% \label{bittorrent_dht} +% +% In the several years that some BitTorrent clients have been using a +% Kademlia-based DHT for tracker-less operation, the developers have +% made many enhancements which we can take advantage of. One of the +% most important is a security feature added to stop malicious nodes +% from subscribing other nodes as downloaders. When a node issues a +% request to another node to store its download info for that key, it +% must include a \emph{token} returned by the storing node in a recent +% \texttt{find\_node} request. The token is created by hashing the IP +% address of the requesting peer with a temporary secret that expires +% after several minutes. This prevents the requesting peer from faking +% its IP address in the store request, since it must first receive a +% response from a \texttt{find\_node} on that IP. +% +% We also made some BitTorrent-inspired changes to the parameters of +% the DHT originally specified by the authors of Kademlia. Since, as +% we will show later, peers stay online in our system for much longer +% periods of time, we reduced Kademlia's \emph{k} value from 20 to 8. +% The value is supposed to be large enough such that any given +% \emph{k} nodes are unlikely to fail within an hour of each other, +% which is very unlikely in our system given the long uptimes of +% nodes (see Figure~\ref{duration_online_1} in Section~\ref{analysis}. +% We also increased the number of concurrent outstanding +% requests allowed from 3 to 6 to speed up the recursive key finding +% processes. +% +% \subsection{\textbf{OPTIONAL}: Other Changes} +% \label{other_changes} +% +% In addition, we have allowed peers to store values in the DHT, even +% if the hash they are using is not the correct length. Most of the +% keys used in the DHT are based on the SHA1 hash, and so they are 20 +% bytes in length. However, some files in the targetted Debian package +% system are only hashed using the MD5 algorithm, and so the hashes +% retrieved from the server are 16 bytes in length. The DHT will still +% store values using these keys by padding the end of them with zeroes +% to the proper length, as the loss of uniqueness from the 4 less +% bytes is not an issue. Also, the DHT will happily store hashes that +% are longer than 20 bytes, such as those from the 32 byte SHA256 +% algorithm, by truncating them to the correct length. Since the +% requesting peer will have the full length of the hash, this will not +% affect its attempt to verify the downloaded file. %%%%%%%%%%%%%%%%%%%%%%%%%%% Section %%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -700,7 +742,7 @@ our implementation. \begin{figure} \centering -\includegraphics[width=\columnwidth]{AptP2PWalker-peers.eps} +\includegraphics[width=0.80\columnwidth]{AptP2PWalker-peers.eps} \caption{The number of peers found in the system, and how many are behind a firewall or NAT.} \label{walker_peers} @@ -736,7 +778,7 @@ take appropriate steps to circumvent it. \begin{figure} \centering -\includegraphics[width=\columnwidth]{AptP2PDuration-peers.eps} +\includegraphics[width=0.80\columnwidth]{AptP2PDuration-peers.eps} \caption{The CDF of how long an average session will last.} \label{duration_peers} \end{figure} @@ -752,23 +794,23 @@ much longer than those reported by Saroiu et. al. \cite{saroiu2001} for other peer-to-peer systems, which had 50\% of Napster and Gnutella sessions lasting only 1 hour. -\begin{figure} -\centering -\includegraphics[width=\columnwidth]{AptP2PDuration-ind_peers.eps} -\caption{\textbf{OPTIONAL}: The CDF of the average time individual peers stay in the -system.} -\label{duration_ind_peers} -\end{figure} - -\textbf{OPTIONAL}: We also examined the average time each individual peer spends in the -system. Figure~\ref{duration_peers} shows the cumulative -distribution of how long each individual peer remains in the system. -Here we see that 50\% of peers have average stays in the system -longer than 10 hours. +% \begin{figure} +% \centering +% \includegraphics[width=0.80\columnwidth]{AptP2PDuration-ind_peers.eps} +% \caption{\textbf{OPTIONAL}: The CDF of the average time individual peers stay in the +% system.} +% \label{duration_ind_peers} +% \end{figure} +% +% \textbf{OPTIONAL}: We also examined the average time each individual peer spends in the +% system. Figure~\ref{duration_peers} shows the cumulative +% distribution of how long each individual peer remains in the system. +% Here we see that 50\% of peers have average stays in the system +% longer than 10 hours. \begin{figure} \centering -\includegraphics[width=\columnwidth]{AptP2PDuration-online_1.eps} +\includegraphics[width=0.80\columnwidth]{AptP2PDuration-online_1.eps} \caption{The fraction of peers that, given their current duration in the system, will stay online for another hour.} \label{duration_online_1} @@ -788,22 +830,22 @@ Our results also show that, for our system, over 80\% of all peers will remain online another hour, compared with around 50\% for Gnutella. -\begin{figure} -\centering -\includegraphics[width=\columnwidth]{AptP2PDuration-online_6.eps} -\caption{\textbf{OPTIONAL}: The fraction of peers that, given their current duration in -the system, will stay online for another 6 hours.} -\label{duration_online_6} -\end{figure} - -\textbf{OPTIONAL}: Since our peers are much longer-lived than other peer-to-peer systems, we -also looked at the fraction of peers that stay online for another 6 -hours. Figure~\ref{duration_online_6} shows that over 60\% of peers -that are online for 10 hours will stay online for another 6. -However, we see an interesting decrease in this fraction between 8 -and 12 hours, which can also be seen in -Figure~\ref{duration_online_1}. We believe this to be due to desktop -users, who regularly turn off their computers at night. +% \begin{figure} +% \centering +% \includegraphics[width=0.80\columnwidth]{AptP2PDuration-online_6.eps} +% \caption{\textbf{OPTIONAL}: The fraction of peers that, given their current duration in +% the system, will stay online for another 6 hours.} +% \label{duration_online_6} +% \end{figure} +% +% \textbf{OPTIONAL}: Since our peers are much longer-lived than other peer-to-peer systems, we +% also looked at the fraction of peers that stay online for another 6 +% hours. Figure~\ref{duration_online_6} shows that over 60\% of peers +% that are online for 10 hours will stay online for another 6. +% However, we see an interesting decrease in this fraction between 8 +% and 12 hours, which can also be seen in +% Figure~\ref{duration_online_1}. We believe this to be due to desktop +% users, who regularly turn off their computers at night. \subsection{Peer Statistics} \label{peer_stats} @@ -819,7 +861,7 @@ it uses the same port for both its DHT (UDP) requests and download \begin{figure} \centering -\includegraphics[width=\columnwidth]{AptP2PDownloaded-peers.eps} +\includegraphics[width=0.80\columnwidth]{AptP2PDownloaded-peers.eps} \caption{The number of peers that were contacted to determine their bandwidth, and the total number of peers in the system.} \label{down_peers} @@ -833,8 +875,8 @@ system during this time. \begin{figure} \centering -\includegraphics[width=\columnwidth]{AptP2PDownloaded-bw.eps} -\caption{\textbf{OPTIONAL}: The bandwidth of data that the contacted peers have +\includegraphics[width=0.80\columnwidth]{AptP2PDownloaded-bw.eps} +\caption{The bandwidth of data that the contacted peers have downloaded and uploaded.} \label{down_bw} \end{figure} @@ -848,15 +890,17 @@ from other peers, which is saving the mirrors from supplying that bandwidth. The actual numbers are only a lower bound, since we have only contacted 30\% of the peers in the system, but we can estimate that \texttt{apt-p2p} has already saved the mirrors 15 GB of -bandwidth, or 1 GB per day. +bandwidth, or 1 GB per day. Considering the current small number of +users this savings is quite large, and is expected to grow +considerably as more users participate in the P2P system. We also collected the statistics on the measured response time peers were experiencing when sending requests to the DHT. We found that the recursive \texttt{find\_value} query, which is necessary before a download can occur, is taking 17 seconds on average. This -indicates that, on average, requests are experiencing almost 2 +indicates that, on average, requests are experiencing almost 2 full stalls while waiting for the 9 second timeouts to occur on -unresponsive peers. This is longer than our target of 10 seconds, +unresponsive peers. This time is longer than our target of 10 seconds, although it will only lead to a slight average delay in downloading of 1.7 seconds when the default 10 concurrent downloads are occurring.This increased response time is due to the number of peers @@ -869,8 +913,8 @@ the system). We were also concerned that the constant DHT requests and responses, even while not downloading, would overwhelm some peers' network -connections. However, we found that peers are using 200 to 300 bytes -per second of bandwidth in servicing the DHT. These numbers are +connections. However, we found that peers are using 200 to 300 bytes/sec +of bandwidth in servicing the DHT. These numbers are small enough to not affect any other network services the peer would be running. @@ -891,16 +935,16 @@ modifications to the distribution system to support it. Our system considers all the files available to users to download, and makes use of the existing infrastructure unmodified. -\textbf{OPTIONAL}: Others have also used DHTs to support this type of functionality. -Kenosis \cite{kenosis} is a peer-to-peer Remote Procedure Call -client also based on the Kademlia DHT, but it is meant as a peer-to-peer -primitive system on which other tools can be built, and so it has no -file sharing functionality at all. Many have used a DHT as a drop-in -replacement for the tracker in a BitTorrent system -\cite{bittorrent-dht, azureus-dht}, but such systems only use the -DHT to find peers for the same torrent, so the file sharing uses -traditional BitTorrent and so is not ideal for the reasons listed -in Section~\ref{bittorrent}. +% \textbf{OPTIONAL}: Others have also used DHTs to support this type of functionality. +% Kenosis \cite{kenosis} is a peer-to-peer Remote Procedure Call +% client also based on the Kademlia DHT, but it is meant as a peer-to-peer +% primitive system on which other tools can be built, and so it has no +% file sharing functionality at all. Many have used a DHT as a drop-in +% replacement for the tracker in a BitTorrent system +% \cite{bittorrent-dht, azureus-dht}, but such systems only use the +% DHT to find peers for the same torrent, so the file sharing uses +% traditional BitTorrent and so is not ideal for the reasons listed +% in Section~\ref{bittorrent}. % \cite{deltacast}