据我所知,LWT插件总是以SERIAL一致性级别完成.如果为true,这是否意味着读取插入为LWT的行,可以安全地读取一致性级别为ANY?
换句话说,我假设LWT插入是完全一致的,使得任何后续读取也完全一致,无论一致性水平如何?
我正在尝试创建Lwt的并发示例,并想出了这个小样本
let () =
Lwt_main.run (
let start = Unix.time () in
Lwt_io.open_file Lwt_io.Input "/dev/urandom" >>= fun data_source ->
Lwt_unix.mkdir "serial" 0o777 >>= fun () ->
Lwt_list.iter_p
(fun count ->
let count = string_of_int count in
Lwt_io.open_file
~flags:[Unix.O_RDWR; Unix.O_CREAT]
~perm:0o777
~mode:Lwt_io.Output ("serial/file"^ count ^ ".txt") >>= fun h ->
Lwt_io.read ~count:52428800
data_source >>= Lwt_io.write_line h)
[0;1;2;3;4;5;6;7;8;9] >>= fun () ->
let finished = Unix.time () in
Lwt_io.printlf "Execution time took %f seconds" (finished -. start))
Run Code Online (Sandbox Code Playgroud)
编辑:要求50GB它是:"然而这是非常缓慢,基本无用.内部绑定是否需要以某种方式强制?"
编辑:我最初写的要求50 GB,它从未完成,现在我有一个不同的问题,要求50MB,执行几乎是瞬间和du -sh报告只有80k的目录大小.
编辑:我也尝试使用相同的错误结果显式关闭文件句柄的代码. …