scala-io, moving file from tmpfs too slow
Asked Answered
S

1

6

I faced up with a strange scala-io moveTo method issue. Here is my filesystem, tmp directory resides in ram.

~ % df -Th                                                               ~/ :)
Filesystem     Type      Size  Used Avail Use% Mounted on
rootfs         rootfs    112G   18G   89G  17% /
/dev           devtmpfs  3.9G     0  3.9G   0% /dev
run            tmpfs     3.9G  236K  3.9G   1% /run
/dev/sda       btrfs     112G   18G   89G  17% /
shm            tmpfs     3.9G  872K  3.9G   1% /dev/shm
tmpfs          tmpfs     3.9G   34M  3.9G   1% /tmp

When moving file from tmp to home directory or backwards, first it's wery slow (subjectively about 1M/s, while iotop shows ridiculous 1500M/s), second it causes 100% cpu load. When moving files within same filesystem, everything works as expected.

Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_03).
Type in expressions to have them evaluated.
Type :help for more information.

scala> import scalax.file.Path
import scalax.file.Path

scala> val tmp = Path("/tmp/ensime")
tmp: scalax.file.Path = Path(/tmp/ensime)

scala> tmp.exists
res0: Boolean = true

scala> val home = Path("/home/_4e6/dest")
home: scalax.file.Path = Path(/home/_4e6/dest)

scala> home.exists
res1: Boolean = false

scala> tmp.moveTo(home)  // very slow
res2: scalax.file.Path = Path(/home/_4e6/dest)

scala> home.moveTo(tmp)  // a bit faster but still unsatisfactory
res3: scalax.file.Path = Path(/tmp/ensime)

In addition, copyTo method works fine; replace and atomicMove flags doesn't change anything; and ramfs is not working for me.

scala> val fs = scalax.file.ramfs.RamFileSystem()
fs: scalax.file.ramfs.RamFileSystem = Ram File System

scala> val ramTmp = fs("/tmp/ensime")
ramTmp: scalax.file.Path = RamPath(/tmp/ensime)

scala> ramTmp.exists
res9: Boolean = false
Skeie answered 22/3, 2012 at 9:5 Comment(0)
S
0

Turned out, it was an issue with moveTo implementation. Now it's fixed.

Skeie answered 26/3, 2012 at 13:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.