Files
i2p.www/www.i2p2/pages/performance.html

125 lines
6.9 KiB
HTML
Raw Normal View History

2008-01-31 20:38:37 +00:00
{% extends "_layout.html" %}
{% block title %}Performance{% endblock %}
{% block content %}
2010-08-30 00:57:54 +00:00
Updated August 2010, current as of router version 0.8
<p>Probably one of the most frequent things people ask is "how fast is I2P?",
2004-07-12 10:24:00 +00:00
and no one seems to like the answer - "it depends". After trying out I2P, the
next thing they ask is "will it get faster?", and the answer to that is a most
emphatic <b>yes</b>.</p>
2010-03-21 19:41:10 +00:00
<p>There are a few major techniques that can be done to improve the perceived
2004-07-12 10:24:00 +00:00
performance of I2P - some of the following are CPU related, others bandwidth
related, and others still are protocol related. However, all of those
2010-03-21 19:41:10 +00:00
dimensions affect the latency, throughput, and perceived performance of the
2004-07-12 10:24:00 +00:00
network, as they reduce contention for scarce resources. This list is of course
not comprehensive, but it does cover the major ones that are seen.</p>
<p>For past performance improvements see the <a href="performance-history.html">
Performance History</a>.
2004-07-06 20:39:18 +00:00
<h2>Better peer profiling and selection</h2>
2004-07-12 10:24:00 +00:00
<p>Probably one of the most important parts of getting faster performance will
be improving how routers choose the peers that they build their tunnels through
- making sure they don't use peers with slow links or ones with fast links that
are overloaded, etc. In addition, we've got to make sure we don't expose
ourselves to a
2010-03-21 19:41:10 +00:00
<a href="http://www.cs.rice.edu/Conferences/IPTPS02/101.pdf">Sybil</a> attack
2004-07-12 10:24:00 +00:00
from a powerful adversary with lots of fast machines. </p>
2004-07-06 20:39:18 +00:00
<h2>Network database tuning</h2>
2004-07-12 10:24:00 +00:00
<p>We're going to want to be more efficient with the network database's healing
and maintenance algorithms - rather than constantly explore the keyspace for new
peers - causing a significant number of network messages and router load - we
can slow down or even stop exploring until we detect that there's something new
worth finding (e.g. decay the exploration rate based upon the last time someone
gave us a reference to someone we had never heard of). We can also do some
tuning on what we actually send - how many peers we bounce back (or even if we
bounce back a reply), as well as how many concurrent searches we perform.</p>
2004-07-06 20:39:18 +00:00
2010-08-30 00:57:54 +00:00
<h2>Session Tag Tuning and Improvements</h2>
2004-07-12 10:24:00 +00:00
<p>The way the <a href="how_elgamalaes">ElGamal/AES+SessionTag</a> algorithm
works is by managing a set of random one-time-use 32 byte arrays, and expiring
them if they aren't used quickly enough. If we expire them too soon, we're
forced to fall back on a full (expensive) ElGamal encryption, but if we don't
expire them quickly enough, we've got to reduce their quantity so that we don't
run out of memory (and if the recipient somehow gets corrupted and loses some
tags, even more encryption failures may occur prior to detection). With some
more active detection and feedback driven algorithms, we can safely and more
efficiently tune the lifetime of the tags, replacing the ElGamal encryption with
a trivial AES operation.</p>
2010-08-30 00:57:54 +00:00
<p>
Additional ideas for improving Session Tag delivery are described on the
<a href="how_elgamalaes.html#future">ElGamal/AES+SessionTag page</a>.
</p>
2004-07-06 20:39:18 +00:00
2010-08-30 00:57:54 +00:00
<h2 id="prng">Migrate sessionTag to synchronized PRNG</h2>
<p>Right now, our <a href="how_elgamalaes.html">ElGamal/AES+SessionTag</a>
algorithm works by tagging each encrypted message with a unique random
32 byte nonce (a "session tag"), identifying that message as being encrypted
with the associated AES session's key. This prevents peers from distinguishing
messages that are part of the same session, since each message has a completely
new random tag. To accomplish this, every few messages bundle a whole
new set of session tags within the encrypted message itself, transparently
delivering a way to identify future messages. We then have to keep track
of what messages are successfully delivered so that we know what tags
we may use.</p>
<p>This works fine and is fairly robust, however it is inefficient in terms
of bandwidth usage, as it requires the delivery of these tags ahead of
time (and not all tags may be necessary, or some may be wasted, due to
their expiration). On average though, predelivering the session tag costs
32 bytes per message (the size of a tag). As Taral suggested though, that
size can be avoided by replacing the delivery of the tags with a synchronized
PRNG - when a new session is established (through an ElGamal encrypted
block), both sides seed a PRNG for use and generate the session tags on
demand (with the recipient precalculating the next few possible values
to handle out of order delivery).</p>
2004-07-06 20:39:18 +00:00
<h2>Longer lasting tunnels</h2>
2004-07-12 10:24:00 +00:00
<p>The current default tunnel duration of 10 minutes is fairly arbitrary, though
2010-03-21 19:41:10 +00:00
it "feels okay". Once we've got tunnel healing code and more effective failure
2004-07-12 10:24:00 +00:00
detection, we'll be able to more safely vary those durations, reducing the
network and CPU load (due to expensive tunnel creation messages).</p>
2004-07-06 20:39:18 +00:00
<p>
This appears to be an easy fix for high load on the big-bandwidth routers, but
we should not resort to it until we've tuned the tunnel building algorithms further.
2010-08-30 00:57:54 +00:00
However, the 10 minute tunnel lifetime is hardcoded in quite a few places,
so substantial effort would be required to change the duration.
Also, it would be difficult to maintain backward compatibility with such a change.
</p><p>
2010-08-30 00:57:54 +00:00
Currently, since the network average tunnel build success rate is fairly high,
there are no current plans to extend tunnel lifetime.
</p>
2004-07-06 20:39:18 +00:00
<h2>Adjust the timeouts</h2>
2010-03-21 19:41:10 +00:00
<p>Yet another of the fairly arbitrary but "okay feeling" things we've got are the
2004-07-12 10:24:00 +00:00
current timeouts for various activities. Why do we have a 60 second "peer
unreachable" timeout? Why do we try sending through a different tunnel that a
LeaseSet advertises after 10 seconds? Why are the network database queries
bounded by 60 or 20 second limits? Why are destinations configured to ask for a
new set of tunnels every 10 minutes? Why do we allow 60 seconds for a peer to
reply to our request that they join a tunnel? Why do we consider a tunnel that
doesn't pass our test within 60 seconds "dead"?</p>
<p>Each of those imponderables can be addressed with more adaptive code, as well
2010-03-21 19:41:10 +00:00
as tunable parameters to allow for more appropriate tradeoffs between
2004-07-12 10:24:00 +00:00
bandwidth, latency, and CPU usage.</p>
2004-07-06 20:39:18 +00:00
<h2>Full streaming protocol improvements</h2>
<ul>
2010-08-26 14:10:37 +00:00
<li>Perhaps re-enable the interactive stream profile (the
current implementation only uses the bulk stream profile).</li>
<li>Client level bandwidth limiting (in either or both directions on a stream,
or possibly shared across multiple streams). This would be in addition to
the router's overall bandwidth limiting, of course.</li>
<li>Access control lists (only allowing streams to or from certain other known
destinations).</li>
<li>Web controls and monitoring the health of the various streams, as well
as the ability to explicitly close or throttle them.</li>
</ul>
2010-08-30 00:57:54 +00:00
<p>
Additional ideas for improving the streaming library are described on the
<a href="streaming.html#future">streaming library page</a>.
</p>
{% endblock %}