[bittorrent] Introductory/endgame algorithms
sundell.software at gmail.com
Thu Sep 29 07:53:48 EDT 2005
On 9/28/05, Arvid Norberg <c99ang at cs.umu.se> wrote:
> Assuming you support files larger than the address space of the
> machine (2 GB for an ordinary 32-bit machine), how do you do your mmap?
> Do you move it around to parts of the files that gets the most read
> and write requests and use ordinary io for the rest? or do you create
> and free the mmap() for each read/write operation? (do you have any
> idea if that would incur big performance hits?).
I only mmap chunks that are currently in use, or waiting to be synced to
disk. You might hit the 2GB limit if you are downloading and uploading circa
1000x2MB different pieces simultaneously, but in that cause you really
should be looking at getting a 64 bit computer.
The performance test I did managed to do 100.000 or more maps and unmaps
every second. I have a cache of maped chunks, although the read-only chunks
are unmapped immediately if no references are left. I've considered adding
the use of direct IO, though I'm uncertain if the overhead is worth it when
dealing with chunks of data this small. I'll need to check that sometime.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the BitTorrent