I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit df7b3dd8 authored by zzz's avatar zzz
Browse files

* Scale prng.buffers based on max memory, reduce default from 16 to 9

parent 22ea79a4
No related branches found
No related tags found
No related merge requests found
...@@ -92,8 +92,16 @@ public class RouterContext extends I2PAppContext { ...@@ -92,8 +92,16 @@ public class RouterContext extends I2PAppContext {
envProps = new Properties(); envProps = new Properties();
if (envProps.getProperty("time.disabled") == null) if (envProps.getProperty("time.disabled") == null)
envProps.setProperty("time.disabled", "false"); envProps.setProperty("time.disabled", "false");
if (envProps.getProperty("prng.buffers") == null) if (envProps.getProperty("prng.buffers") == null) {
envProps.setProperty("prng.buffers", "16"); // How many of these 256 KB buffers do we need?
// One clue: prng.bufferFillTime is ~10ms on my system,
// and prng.bufferFillTime event count is ~30 per minute,
// or about 2 seconds per buffer - so about 200x faster
// to fill than to drain - so we don't need too many
long maxMemory = Runtime.getRuntime().maxMemory();
long buffs = Math.min(16, Math.max(2, maxMemory / (14 * 1024 * 1024)));
envProps.setProperty("prng.buffers", "" + buffs);
}
return envProps; return envProps;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment