PDA

View Full Version : Tweaking disk cache in µtorrent 100/100 Connections only



SBcheater
26.09.09, 18:27
!!!This guide is for people with 10/100mbit connections ONLY!!!

For high speeds you need a bunch of very fast drives that can get fast transfer rates at a high number of random reads/writes. While under Linux you can get high transfer rates with fast drives easly, under Windows you can't.


Here I will show you how to overcome this.:top:


1. Using Disk Cache.

The trick here is to write the data in the RAM and then write it off to the disk in as sequential as possible pattern = higher write speed. You can specify how much of your RAM you want to dedicate as a cache for Utorrent here:

Options -> Preferences -> Advanced -> Disk Cache

There are 2 possible scenarios:

- You specify a cache size at least as big as your torrent file size so the whole torrent will get cached very fast in your RAM and then you will have to wait a bit for it to write off completely.

(CAUTION : Power failure and/or HDD crash may adversely effect downloaded data and/or data under pipeline, and you may lose data in case of an unforeseen even of a power failure or HDD crach beyond recovery : This is a drawback of the first scenario discovered by anon)

Practically this means that you will download the torrent to your RAM possibly at a very high rate and then when it reaches 99.9% completion it will start to write out the remaining pieces from the RAM to your hard drive and you will have to wait for it to finish (it can take a while depending on the file size) . You can monitor the write out process in the Pieces subtab. This is a very good way to get the torrent the fastest way you can with a slow hard drive.
The bad think about it is that most of the time you won't have enough free RAM to reserve for caching simply because the files will be too big.

- You specify a compact cache size and adjust simultaneously the number of connections and the download speed to avoid disk overload.

Disk overloads occurs when the cache gets full and the disk can't keep up writing out the data fast enough. If it occurs the best way to fix it is to either increase the cache size or stop the torrent, wait for all the pieces from the cache to get written out, and lower the number of connections per torrent and the download speed. The best way to tell if your hard disk can keep up with the current speed is to monitor the Pieces subtab window and see if the pieces number grows or shrinks. If the pieces list is getting bigger and bigger then the disk writes out pieces slower then they are written into the RAM (cache) and if the torrent size is fairly big the disk will overload at some time when the cache gets full. The best case is when the pieces are written out about as fast as they are written in the cache, so there is no danger of filling in the whole cache. Usually its best to allow 10-20 peers to connect to you at the start and raise the number by 5 until you reach the fastest speed at which the disk can keep up with the pace. Keep in mind that downloading from more peers at slower rates is more stressful for the disk then downloading from fewer peers at higher rates.

The bad thing about using only disk caching is that you can get high speeds only in one direction, either uploading or downloading fast. If you start downloading something fast your upload speed will cripple down when the disk starts to write out the pieces. If you have a Gbit line don't expect to get more then 15-20 MB/s with caching.

Here are some settings when using disk cache:

http://i28.tinypic.com/2vtxvzk.jpg


> Write out untouched blocks every 2 minutes: Disabled

> Write out finished pieces immediately: Enabled


Clears up the cache for new pieces as fast as possible

> Turn off read caching if the upload speed is slow: Disabled

> Remove old blocks from the cache: Enabled

> Increase automatic cache size when cache trashing: Enabled


You could enable it if you want the cache size to automatically increase if it gets filled in or disabled it if you want to have a fixed sized cache.



2. Using RAM Disk.

To get really fast DL/UL under Windows simultaneously in both directions you will need to use a RAM Disk.

A RAM Disk is a part of the RAM which gets reserved and used as a logical drive, of course all the contents on it are erased when the computer restarts/shuts down. The good thing about the RAM Disk is that it can utilize Gbit speeds and it doesn't overload (of course a decent CPU is also needed), the bad thing is that you will need some good amount of RAM to make a good use of it. Of course you can use it only to upload fast smaller releases from it or to download fast releases to it and then move them to the hard drive for seeding, thus enabling you to download and upload fast at once (upload from HDD, download to RAM Disk, or reversed). And if you have a lot of RAM available you can download/upload releases from/to it at rates no hard drive can match. That's especially useful for uploaders, who can FXP releases to the hard drive and seed from the RAM Disk at very high rates. If you want to utilize Gbit speeds under Windows a RAM Disk is a must. When using a RAM Disk make sure that caching is disabled.

Here are some settings:

http://i28.tinypic.com/ib9rox.png

Using 2.5 GB RAM Disk with a 100/100 Mbit connection:

http://i26.tinypic.com/29p4t52.png


3. Other important things.

- Make sure to increase “Global maximum number of connections” and the connected peers/upload slots per torrent values in Options -> Preferences -> Bandwidth, the default values are too low. If you are on DSL/Cable don't set too high values to avoid overloading your router.

- If you are seeding/leeching a lot of things at a time or simply use a lot of programs that connect to Internet at once you may experience slow connectivity in your torrents (like you are seeing the peers but it takes some time to start transferring data with them), that's probably because of the 10 half-open simultaneous connection attempts (not 10 half-open connections in total) limit by Windows (note that this value varies, depending on the OS version) . To verify that look for event ID 4226 “TCP/IP has reached the security limit imposed on the number of concurrent TCP connect attempts” in your event logs. Luckily you can remove it with 3rd parity tools (google for LvlLord patch). Here is a list of which operation systems have a limit and which not:

OSes that have a limit:

- Windows XP SP2 & SP3, Windows 2003 SP1 & SP2, Vista up to SP1, Windows 2008 up to SP1

OSes that don't/won't have a limit:

- Windows 2000/2000 Server all versions, Windows XP up to SP1, Windows 2003 with no SP, Vista with SP2, Windows 2008 SP2, Windows 7

Additionally UT implements also such a limit so you need to lift it off too (default is , go to Options -> Preferences -> Advanced


>net.max_halfopen - that's the limiting value in UT

>bt.connect_speed – here you specify how many new connections per second UT will try to create, up to the limit specified in net.max_halfopen.


Raising the limit too high is not recommended. Also, if you are on DSL/Cable don't set it high because it can overload your router. For example if you set it to 100 half-open attempts your computer will try to reach 100 hosts each second. Now if you have set the connected peers value in UT at 140 for example, and a few peers drop out, you will start sending out 100 requests per second until you connect again to a few peers and the connection limit is full again. Then when someone drops again you will do this all over again.




:shockkk!: Please leave your feedback about outcomes of above implementation :shockkk!:

anon
26.09.09, 18:53
Great tutorial. But note:


- You specify a cache size at least as big as your torrent file size so the whole torrent will get cached very fast in your RAM and then you will have to wait a bit for it to write off completely.

If there's a power failure before or as you are finishing the torrent, all that data will be lost forever.

SBcheater
26.09.09, 19:03
If there's a power failure before or as you are finishing the torrent, all that data will be lost forever.

That's a brilliant highlight you have made anon, power failure during disk operation never came into my mind, this is perhaps I am using a UPS, I will surely put your highlight tip in a "CAUTION TAB" in above tut.

anon
26.09.09, 19:04
this is perhaps I am using a UPS

Most likely :wink: If your power ever goes off, you have a few minutes to save your work - others won't.

slikrapid
27.09.09, 05:24
power failure during disk operation never came into my mind, this is perhaps I am using a UPS

regardless of that the OS can also freeze and again the data is lost

afaik another way to avoid disk caching problems is to spread your downloads/uploads across several hard drives

alpacino
27.09.09, 10:06
Nice tutorial. Correct if I'm wrong, but as you say, this is for seedbox users right? Not only that, you must consider the user in this case is locally using this seedbox, and not as many others that use them remotely right? So in this case the "common user" should be worried about this tweaking, but the SB owner might be.

anon
27.09.09, 10:30
Not only that, you must consider the user in this case is locally using this seedbox, and not as many others that use them remotely right?

You can change the disk cache settings from the uTorrent UI, if that's what you mean. And since this makes the box download data to RAM (tremendously fast) and record it to the disk when the torrent finishes, it's useful for both. :biggrin:

SBcheater
27.09.09, 15:25
this is for seedbox users right?

No it is not just specific to seedbox users, it target all connections whose bandwidth ranges between 10 - 100 Mbit


user in this case is locally using this seedbox, and not as many others that use them remotely right?

Yes, furthermore this method is not specific to users with a seedbox.

alpacino
28.09.09, 06:16
No it is not just specific to seedbox users, it target all connections whose bandwidth ranges between 10 - 100 Mbit



Yes, furthermore this method is not specific to users with a seedbox.

Oh thanks. At first I thought you had made a typo. Where is written 10-100, I thought it should be 100-100. :top:

Sazzy
20.08.14, 20:17
Came here through Google :lol:
Never been a uTorrent fan, but really want to start using it anyway due to 2.2.1 being so lightweight compared to VEM. Should I be changing the default Disk Cache settings on a normal system?

anon
20.08.14, 21:24
Yes - the default settings don't do the best job.

Since I seed a lot, I use a huge (600 MB) cache and aggressive settings to minimize the pressure put on the disk. (Note that when stopping a torrent, its content gets discarded from the cache.)

Sazzy
20.08.14, 22:08
Do we have a thread going on about that anon? Or are these the settings described above?

Closest relevant thread i've found is http://www.sb-innovation.de/showthread.php?threadid=3923

anon
20.08.14, 23:21
Or are these the settings described above?

Skimming through the first post it seems yes, but here are the settings I'm talking about anyway.

Override automatic cache size: yes, and you set something between 50 and 100 MB, in proportion to your download speed.
Write out untouched blocks: no
Write out finished pieces immediately: no

If memory serves me well, you use no upload because of the law in your country, so the read cache settings have no relevance.