当前位置: 首页 > news >正文

北京 网站建设600佛山网站的建设

北京 网站建设600,佛山网站的建设,哪里可以做购物网站,阜新网站推广目录 什么是 Direct IO java 支持 使用场景 数据库 反思 在之前的文章零拷贝基础上#xff0c;有一个针对那些不需要在操作系统的 page cache 里保存的情况#xff0c;即绕过 page cache#xff0c;对于 linux 提供了 direct io 的功能。 https://blog.csdn.net/zlpzl…目录 什么是 Direct IO java 支持 使用场景 数据库 反思 在之前的文章零拷贝基础上有一个针对那些不需要在操作系统的 page cache 里保存的情况即绕过 page cache对于 linux 提供了 direct io 的功能。 https://blog.csdn.net/zlpzlpzyd/article/details/135317834 什么是 Direct IO Direct IO也叫无缓冲IO裸IOrawIO意思是使用无缓冲IO对文件进行读写不会经过page cache。 通常我们使用的文件流读取、内存映射都属于 Cache IO因为将数据写入文件首先会写入cache最终再落盘到 IO device 或者称为 disk上。 cache IO 使得我们在写入、读取预读取、顺序读取等特性文件数据的时候性能得以提升能够从cache(内存)中读取数据。 直接 IO则是直接将数据写入文件、或者从文件中读取出来绕过了cache这使得看起来性能没那么好但是仔细分析无论哪种IO方式最终数据都必须落盘而两种的区别在于有无 page cache。 参照图片即是直接走最后的红色方式直接访问操作系统的 block io layer 来实现 direct io。 这样的话针对那种不经常使用的文件尤其是大文件可以使用这种方式来处理了。 那 java 里是否提供了这个功能在网上搜了一下发现了如下 https://bugs.openjdk.org/browse/JDK-8189192 从 jdk 10 开始原生支持 java 支持 主要添加了3个地方 java.nio.file.FileStore /*** Returns the number of bytes per block in this file store.** p File storage is typically organized into discrete sequences of bytes* called iblocks/i. A block is the smallest storage unit of a file store.* Every read and write operation is performed on a multiple of blocks.** implSpec The implementation in this class throws* {code UnsupportedOperationException}.** return a positive value representing the block size of this file store,* in bytes** throws IOException* if an I/O error occurs** throws UnsupportedOperationException* if the operation is not supported** since 10*/ public long getBlockSize() throws IOException {throw new UnsupportedOperationException(); } com.sun.nio.file.ExtendedOpenOption /*** Requires that direct I/O be used for read or write access.* Attempting to open a file with this option set will result in* an {code UnsupportedOperationException} if the operating system or* file system does not support Direct I/O or a sufficient equivalent.** apiNote* The DIRECT option enables performing file I/O directly between user* buffers and the file thereby circumventing the operating system page* cache and possibly avoiding the thrashing which could otherwise occur* in I/O-intensive applications. This option may be of benefit to* applications which do their own caching or do random I/O operations* on large data sets. It is likely to provide the most benefit when* the file is stored on a device which has high I/O throughput capacity.* The option should be used with caution however as in general it is* likely to degrade performance. The performance effects of using it* should be evaluated in each particular circumstance.** since 10*/ DIRECT(FileSystemOption.DIRECT); ByteBuffer#alignedSlice 从 java 9 开始支持 Path p; // initialization omitted int blockSize Math.toIntExact(Files.getFileStore(p).getBlockSize()); int capacity Math.addExact(blockSize, blockSize - 1); ByteBuffer block ByteBuffer.allocateDirect(capacity).alignedSlice(blockSize); try (FileChannel fc FileChannel.open(p, StandardOpenOption.READ, ExtendedOpenOption.DIRECT)) {int result fc.read(block); } 使用场景 针对那种不经常使用的文件尤其是大文件可以使用 direct io 来处理了。 数据库 mysql 的 innodb 引擎就用了这个绕过 page cache https://dev.mysql.com/doc/refman/8.0/en/innodb-parameters.html#sysvar_innodb_flush_method 反思 让我想到了一点很多功能底层支持但是工具里没有最终还是看 cpu 层次指令集和操作系统的 api 是否支持。例如 java 的很多功能之前不支持后面底层支持了在 java 里也提供了对应的 api 间接使用这些底层功能。让我想到了虚拟线程的问题在 alibaba 自研的 dragonwell jdk 之前的 jdk 里不支持开发人员就改写了 jvm 的源码从底层上支持虚拟线程。 美团自研的 mjdk 针对现有的  java.util.zip.* 中使用的底层 zlib 改写使用 Intel 开源的 ISA-L 进行改造优化  https://mp.weixin.qq.com/s/etzzmbOsAzzLU13BsrXxTA 鉴于 java 的使用人员多市场份额大现在不像之前更新那么快了。对于底层 api 的支持也没有那么快了自己要想使用那些底层操作系统的功能需要自己编写 api 后面打包到 jdk 里去通过 java api 来间接调用操作系统的 api这样可以从 jdk 层面来支持这些底层的功能。 参考链接 https://blog.csdn.net/alex_xfboy/article/details/91865675 https://blog.csdn.net/weixin_39971435/article/details/114475097 https://blog.csdn.net/rekingman/article/details/109037276
http://www.zqtcl.cn/news/24757/

相关文章:

  • 天津市网站建设 网页制作两人合伙做网站但不准备开公司
  • 做网站没赚到钱宁夏免费做网站
  • 东明网站制作制作音乐视频的软件
  • 济南网站建设公司排行凡客诚品官方商城
  • wordpress建站打不开二级页面南京代做网站
  • 西安优秀的集团门户网站建设李家沱网站建设
  • 网站建设合同性质哪个网站做外贸好
  • 新手做自己的网站小吃车广告设计图片
  • 单位网站建设要多少钱深圳做网站的网络公司
  • phpmysql网站开发项目式教程建设网站要不要工商执照
  • 东莞网站建站公司wordpress后台模板修改
  • 雅布设计站长之家的seo综合查询工具
  • 武昌做网站公司网站建站报价
  • 什么网站做简历免费邯郸网站建设地方
  • 怎样简单做网站网站开发入门书籍
  • 湖南省建设银行网站官网邯郸seo营销
  • 域名解析完成网站怎么做淄博网站推广那家好
  • 橘子建站是什么网站根目录是哪里
  • 政务网站建设标准wordpress中英文建站
  • 网站托管服务适合用于哪种类型的网站郑州做网站的专业公司
  • 网上哪里有辅导高考生做难题的网站网站建设价格西安
  • 上海频道网站建设公司商贸行业网站建设
  • pc网站建设ps制作网页实现页面跳转
  • 建设自己的企业网站需要什么广东做陶瓷的网站
  • 网站如何做免费的推广服务推广软文范例
  • 金华网站制作案例网站费用明细
  • 个人网站一定要备案吗深圳 网站公司
  • 最新手机网站推荐php多平台商城网站系统建设
  • 中山骏域网站建设网站空间ip地址查询
  • 我的网站要怎样做才能让人家搜到百度收录官网