tweak the auto-cache-size logic to have slightly smaller cache

This commit is contained in:
arvidn 2018-08-05 16:11:40 +02:00 committed by Arvid Norberg
parent c426ba88d4
commit 51fb1e3d6b
4 changed files with 11 additions and 11 deletions

View File

@ -484,7 +484,7 @@ int poll_interval = 5;
int max_connections_per_torrent = 50;
bool seed_mode = false;
bool stats_enabled = false;
int cache_size = 1024;
int cache_size = -1;
bool share_mode = false;
bool disable_storage = false;

View File

@ -979,9 +979,9 @@ namespace libtorrent {
// or receive buffer also count against this limit. Send and receive
// buffers will never be denied to be allocated, but they will cause
// the actual cached blocks to be flushed or evicted. If this is set
// to -1, the cache size is automatically set to the amount of
// physical RAM available in the machine divided by 8. If the amount
// of physical RAM cannot be determined, it's set to 1024 (= 16 MiB).
// to -1, the cache size is automatically set based on the amount of
// physical RAM on the machine. If the amount of physical RAM cannot
// be determined, it's set to 1024 (= 16 MiB).
//
// ``cache_expiry`` is the number of seconds from the last cached write
// to a piece in the write cache, to when it's forcefully flushed to
@ -1593,7 +1593,7 @@ namespace libtorrent {
out_enc_policy,
in_enc_policy,
// determines the encryption level of the connections. This setting
// determines the encryption level of the connections. This setting
// will adjust which encryption scheme is offered to the other peer,
// as well as which encryption scheme is selected by the client. See
// enc_level enum for options.

View File

@ -303,8 +303,8 @@ namespace libtorrent {
// The more physical RAM, the smaller portion of it is allocated
// for the cache.
// we take a 30th of everything exceeding 4 GiB
// a 20th of everything exceeding 1 GiB
// we take a 40th of everything exceeding 4 GiB
// a 30th of everything exceeding 1 GiB
// and a 10th of everything below a GiB
constexpr std::int64_t gb = 1024 * 1024 * 1024;
@ -312,15 +312,15 @@ namespace libtorrent {
std::int64_t result = 0;
if (phys_ram > 4 * gb)
{
result += (phys_ram - 4 * gb) / 30;
result += (phys_ram - 4 * gb) / 40;
phys_ram = 4 * gb;
}
if (phys_ram > 1 * gb)
{
result += (phys_ram - 1 * gb) / 20;
result += (phys_ram - 1 * gb) / 30;
phys_ram = 1 * gb;
}
result += phys_ram / 10;
result += phys_ram / 20;
m_max_use = int(result / default_block_size);
}

View File

@ -248,7 +248,7 @@ constexpr int CLOSE_FILE_INTERVAL = 0;
SET(send_buffer_watermark_factor, 50, nullptr),
SET(choking_algorithm, settings_pack::fixed_slots_choker, nullptr),
SET(seed_choking_algorithm, settings_pack::round_robin, nullptr),
SET(cache_size, 1024, nullptr),
SET(cache_size, 2048, nullptr),
DEPRECATED_SET(cache_buffer_chunk_size, 0, nullptr),
SET(cache_expiry, 300, nullptr),
SET(disk_io_write_mode, settings_pack::enable_os_cache, nullptr),