akka流中异步文件IO的当前状态是什么?
What is the current state of asynchronous file IO in akka streams?
目标:
我希望 Akka 的文件 IO 尽可能异步和非阻塞。
我目前的知识状态:
在 older project documentation 你可以读到这个:
Note
Since the current version of Akka (2.3.x) needs to support JDK6, the
currently provided File IO implementations are not able to utilise
Asynchronous File IO operations, as these were introduced in JDK7 (and
newer). Once Akka is free to require JDK8 (from 2.4.x) these
implementations will be updated to make use of the new NIO APIs (i.e.
AsynchronousFileChannel).
当前的 akka 版本是“2.5.4”。 akka-stream 的当前版本是“2.11”或“2.12”。在 current documentation 上面的注释丢失了,它只是明确提到文件 IO 意味着阻塞操作,这些操作由专用于 IO 操作的调度程序处理。
在 akka-streams Jar-File 中的 'MANIFEST.MF' 文件中有一行:
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
所以我想它需要 Java 8.
有 related to scala asynchronous file IO but its from January 2015. 个包含:
Akka IO, while not providing file IO in it's core, has a module
developed by Dario Rexin, which allows to use AsynchronousFileChannel
with Akka IO in a very simple manner. Have a look at this library to
make use of it: https://github.com/drexin/akka-io-file
问题:
- akka 流文件 IO 的当前状态有多异步?
- akka 流文件 IO 是否使用来自 Java 的 NIO 的 'AsynchronousFileChannel'?
- 我需要做些什么才能使用 Java 的 NIO 中的 'AsynchronousFileChannel' 吗?
- How asynchronous is the current state of akka streams file IO?
仔细阅读 source code shows that Akka Stream's FileIO uses java.nio.ByteBuffer
and java.nio.channels.FileChannel
. And as the documentation 状态,文件 IO 操作 运行 在专用调度程序上隔离。
有空档pull request that attempts to use AsynchronousFileChannel
. Based on the benchmark results reported in that PR, the PR might be closed in favor of trying a newer approach with synchronous NIO as captured in another PR。
- Does akka streams file IO use 'AsynchronousFileChannel' from Java's NIO?
没有
- Do I have to do something to use 'AsynchronousFileChannel' from Java's NIO?
这个问题没有实际意义,因为 Akka Streams 不使用 AsynchronousFileChannel
。
目标:
我希望 Akka 的文件 IO 尽可能异步和非阻塞。
我目前的知识状态:
在 older project documentation 你可以读到这个:
Note
Since the current version of Akka (2.3.x) needs to support JDK6, the currently provided File IO implementations are not able to utilise Asynchronous File IO operations, as these were introduced in JDK7 (and newer). Once Akka is free to require JDK8 (from 2.4.x) these implementations will be updated to make use of the new NIO APIs (i.e. AsynchronousFileChannel).
当前的 akka 版本是“2.5.4”。 akka-stream 的当前版本是“2.11”或“2.12”。在 current documentation 上面的注释丢失了,它只是明确提到文件 IO 意味着阻塞操作,这些操作由专用于 IO 操作的调度程序处理。
在 akka-streams Jar-File 中的 'MANIFEST.MF' 文件中有一行:
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
所以我想它需要 Java 8.
有
Akka IO, while not providing file IO in it's core, has a module developed by Dario Rexin, which allows to use AsynchronousFileChannel with Akka IO in a very simple manner. Have a look at this library to make use of it: https://github.com/drexin/akka-io-file
问题:
- akka 流文件 IO 的当前状态有多异步?
- akka 流文件 IO 是否使用来自 Java 的 NIO 的 'AsynchronousFileChannel'?
- 我需要做些什么才能使用 Java 的 NIO 中的 'AsynchronousFileChannel' 吗?
- How asynchronous is the current state of akka streams file IO?
仔细阅读 source code shows that Akka Stream's FileIO uses java.nio.ByteBuffer
and java.nio.channels.FileChannel
. And as the documentation 状态,文件 IO 操作 运行 在专用调度程序上隔离。
有空档pull request that attempts to use AsynchronousFileChannel
. Based on the benchmark results reported in that PR, the PR might be closed in favor of trying a newer approach with synchronous NIO as captured in another PR。
- Does akka streams file IO use 'AsynchronousFileChannel' from Java's NIO?
没有
- Do I have to do something to use 'AsynchronousFileChannel' from Java's NIO?
这个问题没有实际意义,因为 Akka Streams 不使用 AsynchronousFileChannel
。