Closed qyzhaojinxi closed 2 years ago
perhaps disk IO is way slower on the android device, CPU + Network interrupts, android's are less powerful devices than Mac's high quality hardware. However < 3M/s is weird.
I'd take a look at your session parameters, we do have some limitations for FrostWire on android in terms of max connections
sp.set_str(settings_pack.string_types.listen_interfaces.swigValue(), ctx.interfaces);
sp.set_int(settings_pack.int_types.max_retry_port_bind.swigValue(), ctx.retries);
sp.set_str(settings_pack.string_types.dht_bootstrap_nodes.swigValue(), dhtBootstrapNodes());
sp.set_int(settings_pack.int_types.active_limit.swigValue(), 2000);
sp.set_int(settings_pack.int_types.stop_tracker_timeout.swigValue(), 0);
sp.set_int(settings_pack.int_types.alert_queue_size.swigValue(), 5000);
sp.set_bool(settings_pack.bool_types.enable_dht.swigValue(), ctx.enableDht);
sp.set_bool(settings_pack.bool_types.enable_lsd.swigValue(), true);
sp.set_bool(settings_pack.bool_types.enable_upnp.swigValue(), true);
sp.set_bool(settings_pack.bool_types.enable_natpmp.swigValue(), true);
private static String dhtBootstrapNodes() {
StringBuilder sb = new StringBuilder();
sb.append("dht.libtorrent.org:25401").append(",");
sb.append("router.bittorrent.com:6881").append(",");
sb.append("dht.transmissionbt.com:6881").append(",");
// for DHT IPv6
sb.append("router.silotis.us:6881");
return sb.toString();
}
private static SettingsPack defaultSettings() {
SettingsPack sp = new SettingsPack();
//sp.broadcastLSD(true); //setting was deprecated/removed on libtorrent 1.2.4 (Feb 10th 2020)
sp.validateHttpsTrackers(false);
if (ctx.optimizeMemory) {
int maxQueuedDiskBytes = sp.maxQueuedDiskBytes();
sp.maxQueuedDiskBytes(maxQueuedDiskBytes / 2);
int sendBufferWatermark = sp.sendBufferWatermark();
sp.sendBufferWatermark(sendBufferWatermark / 2);
sp.cacheSize(256);
sp.activeDownloads(4);
sp.activeSeeds(4);
sp.maxPeerlistSize(200);
//sp.setGuidedReadCache(true);
sp.tickInterval(1000);
sp.inactivityTimeout(60);
sp.seedingOutgoingConnections(false);
sp.connectionsLimit(200);
} else {
sp.activeDownloads(10);
sp.activeSeeds(10);
}
return sp;
}
defaultValues.put(Constants.PREF_KEY_NETWORK_ENABLE_DHT, true);
defaultValues.put(Constants.PREF_KEY_NETWORK_USE_WIFI_ONLY, false);
defaultValues.put(Constants.PREF_KEY_TORRENT_SEED_FINISHED_TORRENTS, true);
defaultValues.put(Constants.PREF_KEY_TORRENT_SEED_FINISHED_TORRENTS_WIFI_ONLY, true);
defaultValues.put(Constants.PREF_KEY_TORRENT_MAX_DOWNLOAD_SPEED, 0L);
defaultValues.put(Constants.PREF_KEY_TORRENT_MAX_UPLOAD_SPEED, 0L);
defaultValues.put(Constants.PREF_KEY_TORRENT_MAX_DOWNLOADS, 10L);
defaultValues.put(Constants.PREF_KEY_TORRENT_MAX_UPLOADS, 20L);
defaultValues.put(Constants.PREF_KEY_TORRENT_MAX_TOTAL_CONNECTIONS, 1200L);
defaultValues.put(Constants.PREF_KEY_TORRENT_MAX_PEERS, 200L);
defaultValues.put(Constants.PREF_KEY_TORRENT_DELETE_STARTED_TORRENT_FILES, false);
defaultValues.put(Constants.PREF_KEY_TORRENT_TRANSFER_DETAIL_LAST_SELECTED_TAB_INDEX, 1); // pieces
defaultValues.put(Constants.PREF_KEY_TORRENT_SEQUENTIAL_TRANSFERS_ENABLED, false);
try setting ctx.optimizeMemory = false
and see if it gets any faster
I already have set this.
ctx.homeDir = paths.libtorrent();
ctx.torrentsDir = paths.torrents();
ctx.dataDir = paths.data();
ctx.optimizeMemory = false;
// port range [37000, 57000]
int port0 = 37000 + new Random().nextInt(20000);
int port1 = port0 + 10; // 10 retries
String iface = "0.0.0.0:%1$d,[::]:%1$d";
ctx.interfaces = String.format(Locale.US, iface, port0);
ctx.retries = port1 - port0;
ctx.enableDht = ConfigurationManager.instance().getBoolean(Constants.PREF_KEY_NETWORK_ENABLE_DHT);
hmm, I think you'll have to profile the app and see if there's anything else eating up resources.
such a dramatic slowdown feels like disk I/O. Is this happening with all android devices you're testing with? Maybe if you test with a more expensive device (top of the line Samsung or OnePlus) I'll be testing download performance for us in a few days and let you know if I find something.
Thank you. I will also test it on different devices.
Hi, find anything about this?
with the same wifi and the same torrent. The speed is often below 3M/s on android version and is up to 8M/s on Mac version.
I set speed limit is 0 by defaut. I can't find why.