You are not logged in.

#1 2013-08-16 11:41:54

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

[solved] USB stick as cache

hi fellows,

I have an unused but not too old (at least compared with my hardware on signature big_smile)
and I would know if I can use it as a cache (à-la readyboost of W)

or better: first, I should know if this operation make sense, with my combination of hardware (I think through benchmark)
then I could "build" this equipment

thanks

Last edited by nTia89 (2013-08-17 11:51:37)


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#2 2013-08-16 11:45:48

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,550
Website

Re: [solved] USB stick as cache

USB sticks tend to be terribly slow I/O.  While the flash memory itself is certainly fast, the usb is a bottleneck.  In most cases I/O to a usb flash drive will be slower than to an internal hard drive.  If this is the case here, I don't see how it would be useful as a cache.

EDIT: perhaps there is some other way of using unformatted usb sticks more directly that would side-step this - so I could be wrong.  I'm speaking only from experience with writing blocks of data to partitioned usb flash drives which is always *much* slower than saving it to the harddisk.

Last edited by Trilby (2013-08-16 11:47:50)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2013-08-16 12:42:27

phanisvara
Member
From: west bengal, india
Registered: 2012-07-08
Posts: 74

Re: [solved] USB stick as cache

i know that USB sticks' life time is limited to a certain no. of write opreations. using one as cache would probably condemn it to an early grave  sad

Offline

#4 2013-08-16 12:46:55

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: [solved] USB stick as cache

phanisvara wrote:

i know that USB sticks' life time is limited to a certain no. of write opreations. using one as cache would probably condemn it to an early grave  sad

yes, I know it

but in my case the USB is unused and will remain in that status....


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#5 2013-08-16 13:05:47

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [solved] USB stick as cache

Windows did exactly this with ReadyBoost. Looking into it would probably be worthwhile.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#6 2013-08-16 18:02:29

Max-P
Member
Registered: 2011-06-11
Posts: 164

Re: [solved] USB stick as cache

Like already said, USB sticks are usually very slow and would actually slow things down more than anything else unless you have a super-fast 32 GB USB3 drive.

You should test it before actually setting everything up.

Here are some samples from my computer:

max-p ~ % sudo hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads: 624 MB in  3.00 seconds = 207.94 MB/sec
max-p ~ % sudo hdparm -t /dev/sdb

/dev/sdb:
 Timing buffered disk reads: 344 MB in  3.00 seconds = 114.62 MB/sec

max-p ~ % sudo hdparm -t /dev/sdc    

/dev/sdc:
 Timing buffered disk reads:  52 MB in  3.03 seconds =  17.15 MB/sec

sda is an SSD
sdb is a 7200 RPM HDD
sdc is a 16GB USB stick.

You can use dd to write stuff to it and see how fast it went, I'm not doing it on mine because I have data on it, but it's around 3 Mb/s write speed, this is way worse than the HDD.


Unless you have a corner case where you need a lot of random-access over sequential read, it's probably not worth it at all. Your USB stick has to be at least faster than your disk if you want benefits of doing that.

From what I read, Windows uses this for random-access on small files. Linux already use RAM as a cache, so it would make more sense to me to use zram to increase the ram capacity so you can have more data on RAM for ultra-fast access instead of messing around with USB sticks.


Anway, what you want is probably bcache. Have fun.

Offline

#7 2013-08-16 19:53:29

arcon
Member
Registered: 2013-05-27
Posts: 128

Re: [solved] USB stick as cache

I am not sure about this but, you can create Swap File in your usb and  you can use it for suspending your system.


The short cuts are only short because they don't actually go anywhere. -- Trilby
Nothing feels better than being understood -- awayand
A pathetic dreamer smile

Offline

#8 2013-08-16 20:41:12

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: [solved] USB stick as cache

Max-P wrote:

Like already said, USB sticks are usually very slow and would actually slow things down more than anything else unless you have a super-fast 32 GB USB3 drive.

You should test it before actually setting everything up.

Here are some samples from my computer:

max-p ~ % sudo hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads: 624 MB in  3.00 seconds = 207.94 MB/sec
max-p ~ % sudo hdparm -t /dev/sdb

/dev/sdb:
 Timing buffered disk reads: 344 MB in  3.00 seconds = 114.62 MB/sec

max-p ~ % sudo hdparm -t /dev/sdc    

/dev/sdc:
 Timing buffered disk reads:  52 MB in  3.03 seconds =  17.15 MB/sec

sda is an SSD
sdb is a 7200 RPM HDD
sdc is a 16GB USB stick.

You can use dd to write stuff to it and see how fast it went, I'm not doing it on mine because I have data on it, but it's around 3 Mb/s write speed, this is way worse than the HDD.


Unless you have a corner case where you need a lot of random-access over sequential read, it's probably not worth it at all. Your USB stick has to be at least faster than your disk if you want benefits of doing that.

From what I read, Windows uses this for random-access on small files. Linux already use RAM as a cache, so it would make more sense to me to use zram to increase the ram capacity so you can have more data on RAM for ultra-fast access instead of messing around with USB sticks.


Anway, what you want is probably bcache. Have fun.

thank you for your super-comprehensive reply. I'll test my system as soon as I can

decant swap partition on usb could be a good idea too


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#9 2013-08-17 11:51:23

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: [solved] USB stick as cache

my hd :

[mattia@arch-dekstop ~]$ sudo hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads: 200 MB in  3.02 seconds =  66.23 MB/sec
[mattia@arch-dekstop ~]$ sudo hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads: 204 MB in  3.04 seconds =  67.08 MB/sec
[mattia@arch-dekstop ~]$ sudo hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads: 200 MB in  3.03 seconds =  66.07 MB/sec
[mattia@arch-dekstop ~]$ sudo hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads: 204 MB in  3.03 seconds =  67.37 MB/sec
[mattia@arch-dekstop ~]$ sudo hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads: 200 MB in  3.01 seconds =  66.54 MB/sec

instead, my usb:

[mattia@arch-dekstop ~]$ sudo hdparm -t /dev/sdb

/dev/sdb:
 Timing buffered disk reads:  50 MB in  3.01 seconds =  16.62 MB/sec
[mattia@arch-dekstop ~]$ sudo hdparm -t /dev/sdb

/dev/sdb:
 Timing buffered disk reads:  50 MB in  3.00 seconds =  16.65 MB/sec
[mattia@arch-dekstop ~]$ sudo hdparm -t /dev/sdb

/dev/sdb:
 Timing buffered disk reads:  52 MB in  3.12 seconds =  16.69 MB/sec
[mattia@arch-dekstop ~]$ sudo hdparm -t /dev/sdb

/dev/sdb:
 Timing buffered disk reads:  52 MB in  3.12 seconds =  16.67 MB/sec
[mattia@arch-dekstop ~]$ sudo hdparm -t /dev/sdb

/dev/sdb:
 Timing buffered disk reads:  52 MB in  3.12 seconds =  16.68 MB/sec

this close the problem....


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

Board footer

Powered by FluxBB