# video playback from ZFS freezes sometimes



## hedgehog (Dec 19, 2009)

greetings. there is thread with problem similar to my one, but it marked as solved so i started new one.

somewhy my videoplayback pauses when i play videofiles from ZFS pool. i still have drive with NTFS partition attached, when i play same video from it - everything smooth and fine. i tried to tune ZFS and got faster read-write speed in result, but problem with video still exist.

i'm running freebsd 8.0 amd64 with 2GB RAM on drive formatted using GPT with everything but swap on ZFS. the kernel is GENERIC

videocard: nvidia, 8800GTS with beta drivers NVIDIA-FreeBSD-x86_64-195.22 (downloaded from official site)

HDD with freebsd partitions: WD Caviar Green WD5000AADS, 5400-7200 rpm, 500G, 32MB cache, SATAII
HDD with ntfs partition: Seagate ST3250620A, 7200rpm, 250G, ATA

i've try to use followint ZFS settings:

```
egrep 'kmem|arc' /boot/loader.conf
vm.kmem_size_max="1024M"
vm.kmem_size="1024M"
vfs.zfs.arc_max="512M"
```

i also changed kern.maxvnodes to 400000

playback still pauses when playing from zfs pool.

*woops, forgot abotut this thread. problem solved by cleaning case. there was too much dust*


----------



## hedgehog (Dec 22, 2009)

i've set cache to 10Mb in Kplayer settings and it's smooth now

looks like temporary solution


----------



## ZappyDaemon (Dec 23, 2009)

this is why i revert from zfs to ufs2 on my laptop.


----------



## oliverh (Dec 23, 2009)

I didn't see such problems so far in FreeBSD nor OpenSolaris while using ZFS (without any tuning). It runs very smooth especially on a laptop with ATI (radeonhd) even with high-resolution x264-encoded videos.

Maybe you should change the player or verify its config. I'm using plain mplayer to play all kind of videos. Most people I know are using smplayer as capable frontend to it.

UFS2+SU can be especially a no-brainer while using blu-ray material, because it is slooow. Make sure you don't have compression activated for ZFS.


----------



## hedgehog (Dec 24, 2009)

compression are off on filesystem, where i store videofiles ( i just checked it out to be sure ^^ )

i've tried few videoplayers: mplayer, kplayer (which are actually gui frontend for mplayer) and dragon. all of those are acting same: short freezes when playing from zfs, smooth if i use video files on ntfs (different hard drive). however, increasing cache in kplayer partially solved this problem. maybe my HDD tries to go slower (since its caviar green) when its not necessary? i'm not too familiar with it.

there is diskinfo output:

```
# diskinfo -c ad4               
ad4                                                               
        512             # sectorsize                              
        500107862016    # mediasize in bytes (466G)               
        976773168       # mediasize in sectors                    
        969021          # Cylinders according to firmware.        
        16              # Heads according to firmware.            
        63              # Sectors according to firmware.          
        WD-WCAV91372288 # Disk ident.                             

I/O command overhead:
        time to read 10MB block      0.128252 sec       =    0.006 msec/sector
        time to read 20480 sectors   2.107287 sec       =    0.103 msec/sector
        calculated command overhead                     =    0.097 msec/sector
```


```
# diskinfo -t ad4
ad4                                                
        512             # sectorsize               
        500107862016    # mediasize in bytes (466G)
        976773168       # mediasize in sectors     
        969021          # Cylinders according to firmware.
        16              # Heads according to firmware.    
        63              # Sectors according to firmware.  
        WD-WCAV91372288 # Disk ident.                     

Seek times:
        Full stroke:      250 iter in   6.810630 sec =   27.243 msec
        Half stroke:      250 iter in   4.990863 sec =   19.963 msec
        Quarter stroke:   500 iter in   8.412453 sec =   16.825 msec
        Short forward:    400 iter in   3.670970 sec =    9.177 msec
        Short backward:   400 iter in   2.818845 sec =    7.047 msec
        Seq outer:       2048 iter in   0.305781 sec =    0.149 msec
        Seq inner:       2048 iter in   0.243596 sec =    0.119 msec
Transfer rates:                                                     
        outside:       102400 kbytes in   1.103217 sec =    92819 kbytes/sec
        middle:        102400 kbytes in   1.326754 sec =    77181 kbytes/sec
        inside:        102400 kbytes in   2.128079 sec =    48119 kbytes/sec
```

as i understand those stats aren't bad for single drive. any suggestions would be appreciated, thank you.


----------



## graudeejs (Dec 24, 2009)

If you're using mplayer try my setting:

~/.mplayer/config

```
cache = 16384
#audiofile-cache = 512
cache-min = 2.0
cache-seek-min = 5
framedrop = yes
```


----------



## oliverh (Dec 24, 2009)

For cache I wouldn't use more than 2048 (maybe 4096kb, apart from DVDs), there isn't any efficient cache-handling-routine in mplayer. Furthermore even with e.g. 8192kb of cache mplayer fills just the 4% of it at first play. To change this behavior you have to use -cache-min, using trial and error to get the proper value.

Even a corrupt index in a avi-file could lead to such a behavior (option -forceidx to build one).

Those WD green drives, are they using some kind of power-down feature?


----------



## hedgehog (Dec 24, 2009)

thank you for responses. unfortunately i cannot test your suggestions because it's running nicely and smooth now. i did not touch any settings. i've just install&launch world of warcraft (my friend told me i wont be able to do so under freebsdx64) and at some point game has stopped freezing... video players too (i've revert cache settings for kplayer back to default).
mystic? :]


----------



## oliverh (Dec 24, 2009)

Maybe a hardware failure or some incompatibility.


----------



## zeiz (Dec 25, 2009)

oliverh said:
			
		

> Those WD green drives, are they using some kind of power-down feature?


WDC gives "intellipower" in place of rpm. Elsewhere I saw 5400-7200 (?)
In doubts that any "intelligence" could be added to $60 stuff. It's probably a salesmen trick again: most time it works @5400 but sometimes (theoretically) may spin 7200 but if it spins 7200 all the time it's life...


----------

